RE: [PATCH v2] acpi/ghes: Prevent sleeping with spinlock held

Ira Weiny
2024-02-21T04:59:19Z

Dan Williams wrote:
> Ira Weiny wrote:

[snip]

> >
> > - guard(rwsem_read)(&cxl_cper_rw_sem);
> > - if (cper_callback)
> > - cper_callback(event_type, rec);
>
> Given a work function can be set atomically there is no need to create /
> manage a registration lock. Set a 'struct work' instance to a CXL
> provided routine on cxl_pci module load and restore it to a nop function
> + cancel_work_sync() on cxl_pci module exit.

Ok I'll look into this.

>
> > + wi = kmalloc(sizeof(*wi), GFP_ATOMIC);
>
> The system is already under distress trying to report an error it should
> not dip into emergency memory reserves to report errors. Use a kfifo()
> similar to how memory_failure_queue() avoids memory allocation in the
> error reporting path.

I have a question on ghes_proc() [ghes_do_proc()]. Can they be called by
2 threads at the same time? It seems like there could be multiple
platform devices which end up queueing into the single kfifo. So either
there needs to be a kfifo per device or synchronization with multiple
writers.

Ira