RE: [PATCH] kernel: x86: tboot: Replace mdelay with usleep_range in tboot_wait_for_aps

From: Thomas Gleixner
Date: Thu Jan 25 2018 - 04:35:42 EST


On Wed, 24 Jan 2018, Sun, Ning wrote:

Please do NOT top post and do NOT include the whole mail header in your
reply.

> >> The function tboot_wait_for_aps is not called in atomic context.
> >> Thus mdelay can be replaced with usleep_range, to reduce busy wait.
> > And how did you establish that it's not called in atomic context?
> >
> It is reported by a static analysis tool written by myself. This tool
> finds that mdelay in tboot_wait_for_aps is not called by holding a
> spinlock or in an interrupt handler, thus mdelay can be replaced.

> It looks like tboot_wait_for_aps(...) is not called in atomic context .

You are both failing to look at the calling context of this. Care to follow
the invocation chain and look at the context?

Thanks,

tglx