From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
Cc: <linux-efi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-cxl@vger.kernel.org>, Ard Biesheuvel <ardb@kernel.org>,
"Alison Schofield" <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
Dan Williams <dan.j.williams@intel.com>,
Yazen Ghannam <yazen.ghannam@amd.com>,
"Terry Bowman" <terry.bowman@amd.com>
Subject: Re: [PATCH v3 5/7] acpi/ghes, cxl: Refactor work registration functions to support multiple workqueues
Date: Tue, 26 Nov 2024 15:57:24 +0000 [thread overview]
Message-ID: <20241126155724.0000634c@huawei.com> (raw)
In-Reply-To: <20241119003915.174386-6-Smita.KoralahalliChannabasappa@amd.com>
On Tue, 19 Nov 2024 00:39:13 +0000
Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com> wrote:
> Refactor the work registration and unregistration functions in GHES to
> enable reuse across different workqueues. This update lays the foundation
> for integrating additional workqueues in the CXL subsystem for better
> modularity and code reuse.
>
> Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
> ---
> drivers/acpi/apei/ghes.c | 34 +++++++++++++++++++++++++---------
> 1 file changed, 25 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index 082c409707ba..62ffe6eb5503 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -717,26 +717,42 @@ static void cxl_cper_post_event(enum cxl_event_type event_type,
> schedule_work(cxl_cper_work);
> }
>
> -int cxl_cper_register_event_work(struct work_struct *work)
> +static int cxl_cper_register_work(struct work_struct **work_ptr,
> + spinlock_t *lock,
> + struct work_struct *work)
This is a somewhat strange interface. It doesn't
really do anything particularly useful. I'd be tempted to
just open code this at each call site.
> {
> - if (cxl_cper_work)
> + if (*work_ptr)
> return -EINVAL;
>
> - guard(spinlock)(&cxl_cper_work_lock);
> - cxl_cper_work = work;
> + guard(spinlock)(lock);
> + *work_ptr = work;
> return 0;
> }
> -EXPORT_SYMBOL_NS_GPL(cxl_cper_register_event_work, CXL);
>
> -int cxl_cper_unregister_event_work(struct work_struct *work)
> +static int cxl_cper_unregister_work(struct work_struct **work_ptr,
> + spinlock_t *lock,
> + struct work_struct *work)
> {
> - if (cxl_cper_work != work)
> + if (*work_ptr != work)
As above.
> return -EINVAL;
>
> - guard(spinlock)(&cxl_cper_work_lock);
> - cxl_cper_work = NULL;
> + guard(spinlock)(lock);
> + *work_ptr = NULL;
> return 0;
> }
> +
> +int cxl_cper_register_event_work(struct work_struct *work)
> +{
> + return cxl_cper_register_work(&cxl_cper_work, &cxl_cper_work_lock,
> + work);
> +}
> +EXPORT_SYMBOL_NS_GPL(cxl_cper_register_event_work, CXL);
> +
> +int cxl_cper_unregister_event_work(struct work_struct *work)
> +{
> + return cxl_cper_unregister_work(&cxl_cper_work, &cxl_cper_work_lock,
> + work);
> +}
> EXPORT_SYMBOL_NS_GPL(cxl_cper_unregister_event_work, CXL);
>
> int cxl_cper_kfifo_get(struct cxl_cper_work_data *wd)
next prev parent reply other threads:[~2024-11-26 15:57 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-19 0:39 [PATCH v3 0/7] acpi/ghes, cper, cxl: Process CXL CPER Protocol errors Smita Koralahalli
2024-11-19 0:39 ` [PATCH v3 1/7] efi/cper, cxl: Prefix protocol error struct and function names with cxl_ Smita Koralahalli
2024-11-26 15:05 ` Jonathan Cameron
2024-12-02 18:12 ` Ira Weiny
2024-11-19 0:39 ` [PATCH v3 2/7] efi/cper, cxl: Make definitions and structures global Smita Koralahalli
2024-11-26 15:09 ` Jonathan Cameron
2024-12-02 18:15 ` Ira Weiny
2024-11-19 0:39 ` [PATCH v3 3/7] efi/cper, cxl: Remove cper_cxl.h Smita Koralahalli
2024-11-26 15:51 ` Jonathan Cameron
2024-11-27 19:36 ` Smita Koralahalli
2024-12-02 18:15 ` Ira Weiny
2024-11-19 0:39 ` [PATCH v3 4/7] acpi/ghes, cxl: Rename cxl_cper_register_work to cxl_cper_register_event_work Smita Koralahalli
2024-11-26 15:53 ` Jonathan Cameron
2024-11-19 0:39 ` [PATCH v3 5/7] acpi/ghes, cxl: Refactor work registration functions to support multiple workqueues Smita Koralahalli
2024-11-26 15:57 ` Jonathan Cameron [this message]
2024-11-27 19:46 ` Smita Koralahalli
2024-11-19 0:39 ` [PATCH v3 6/7] acpi/ghes, cper: Recognize and cache CXL Protocol errors Smita Koralahalli
2024-11-26 16:05 ` Jonathan Cameron
2024-12-02 18:41 ` Ira Weiny
2024-12-06 16:16 ` Koralahalli Channabasappa, Smita
2024-11-19 0:39 ` [PATCH v3 7/7] acpi/ghes, cxl/pci: Process CXL CPER Protocol Errors Smita Koralahalli
2024-11-26 16:05 ` Jonathan Cameron
2024-11-27 20:35 ` Smita Koralahalli
2024-12-02 18:48 ` Ira Weiny
2024-12-06 16:29 ` Koralahalli Channabasappa, Smita
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241126155724.0000634c@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=Smita.KoralahalliChannabasappa@amd.com \
--cc=alison.schofield@intel.com \
--cc=ardb@kernel.org \
--cc=dan.j.williams@intel.com \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=terry.bowman@amd.com \
--cc=vishal.l.verma@intel.com \
--cc=yazen.ghannam@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.