On 2023-09-20, Petr Mladek <[email protected]> wrote:
> The nbcon console is locked when the 'prio' and 'cpu' fields in
> console->nbcon_state stay the same. The locking algorithm would
> break when the locked context got migrated to another CPU.
>
> Add assert into nbcon_context_try_acquire(). It would warn when
> the function is called in a context where the CPU migration
> is possible.
static bool nbcon_context_try_acquire(struct nbcon_context *ctxt)
{
unsigned int cpu = smp_processor_id();
Doesn't smp_processor_id() already provide the necessary checking and
warning?
John
On Wed 2023-09-20 15:06:08, John Ogness wrote:
> On 2023-09-20, Petr Mladek <[email protected]> wrote:
> > The nbcon console is locked when the 'prio' and 'cpu' fields in
> > console->nbcon_state stay the same. The locking algorithm would
> > break when the locked context got migrated to another CPU.
> >
> > Add assert into nbcon_context_try_acquire(). It would warn when
> > the function is called in a context where the CPU migration
> > is possible.
>
> static bool nbcon_context_try_acquire(struct nbcon_context *ctxt)
> {
> unsigned int cpu = smp_processor_id();
>
> Doesn't smp_processor_id() already provide the necessary checking and
> warning?
Ah, I have missed it. Please, forgot this patch.
Best Regards,
Petr