[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c2388b52-fba1-43a2-93c8-0700dd5aea92@zohomail.com>
Date: Thu, 20 Feb 2025 09:42:23 +0800
From: Li Ming <ming.li@...omail.com>
To: Dan Williams <dan.j.williams@...el.com>, dave.jiang@...el.com,
jonathan.cameron@...wei.com
Cc: linux-cxl@...r.kernel.org, linux-kernel@...r.kernel.org,
dave@...olabs.net, alison.schofield@...el.com, vishal.l.verma@...el.com,
ira.weiny@...el.com
Subject: Re: [PATCH v2 7/7] cxl/region: Drop goto pattern of
construct_region()
On 2/20/2025 9:04 AM, Dan Williams wrote:
> Li Ming wrote:
>> Some operations need to be protected by the cxl_region_rwsem in
>> construct_region(). Currently, construct_region() uses down_write() and
>> up_write() for the cxl_region_rwsem locking, so there is a goto pattern
>> after down_write() invoked to release cxl_region_rwsem.
>>
>> construct region() can be optimized to remove the goto pattern. The
>> changes are creating a new function called construct_auto_region() which
>> will include all checking and operations protected by the
>> cxl_region_rwsem, and using guard(rwsem_write) to replace down_write()
>> and up_write() in construct_auto_region().
>>
>> Signed-off-by: Li Ming <ming.li@...omail.com>
>> ---
>> v2:
>> - Rename __construct_region() to construct_auto_region(). (Jonathan and Dave)
>> ---
>> drivers/cxl/core/region.c | 71 +++++++++++++++++++++------------------
>> 1 file changed, 39 insertions(+), 32 deletions(-)
>>
>> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
>> index 320a3f218131..7a9e51aba9f4 100644
>> --- a/drivers/cxl/core/region.c
>> +++ b/drivers/cxl/core/region.c
>> @@ -3216,49 +3216,31 @@ static int match_region_by_range(struct device *dev, const void *data)
>> return 0;
>> }
>>
>> -/* Establish an empty region covering the given HPA range */
>> -static struct cxl_region *construct_region(struct cxl_root_decoder *cxlrd,
>> - struct cxl_endpoint_decoder *cxled)
>> +static int construct_auto_region(struct cxl_region *cxlr,
> ...probably would have called this __construct_region() since there is
> little distinction that merits adding the "auto" qualifier.
Sure, will revert this renaming, continue to use __construct_region(), thanks for review.
Ming
>
> Other than that, for this and the others you can add:
>
> Reviewed-by: Dan Williams <dan.j.williams@...el.com>
Powered by blists - more mailing lists