Linux CXL
 help / color / mirror / Atom feed
From: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
To: Jonathan Cameron <Jonathan.Cameron@huawei.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: Wed, 27 Nov 2024 11:46:49 -0800	[thread overview]
Message-ID: <72d0a9a3-228e-55d8-273b-c6175d8a1f25@amd.com> (raw)
In-Reply-To: <20241126155724.0000634c@huawei.com>

On 11/26/2024 7:57 AM, Jonathan Cameron wrote:
> 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.

Okay I will change.
> 
> 
>>   {
>> -	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.
okay.

Thanks
Smita
> 
>>   		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)
> 

  reply	other threads:[~2024-11-27 19:46 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
2024-11-27 19:46     ` Smita Koralahalli [this message]
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=72d0a9a3-228e-55d8-273b-c6175d8a1f25@amd.com \
    --to=smita.koralahallichannabasappa@amd.com \
    --cc=Jonathan.Cameron@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox