[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cf0421d6-f002-4dc1-b3cd-5b535d79cc1d@zohomail.com>
Date: Thu, 13 Feb 2025 12:15:24 +0800
From: Li Ming <ming.li@...omail.com>
To: Dave Jiang <dave.jiang@...el.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: dave@...olabs.net, alison.schofield@...el.com, vishal.l.verma@...el.com,
ira.weiny@...el.com, dan.j.williams@...el.com, linux-cxl@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 7/7] cxl/region: Drop goto pattern of
construct_region()
On 2/12/2025 5:24 AM, Dave Jiang wrote:
>
> On 2/11/25 10:36 AM, Jonathan Cameron wrote:
>> On Tue, 11 Feb 2025 15:57:27 +0800
>> Li Ming <ming.li@...omail.com> wrote:
>>
>>> Some operations need to be procted by the cxl_region_rwsem in construct
>>> region(). Currently, construct_region() uses down_write() and up_write()
>>> for the cxl_region_rwsem, 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_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_region().
>>>
>>> Signed-off-by: Li Ming <ming.li@...omail.com>
>>> ---
>>> 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 36f3771818d3..170278bdcedc 100644
>>> --- a/drivers/cxl/core/region.c
>>> +++ b/drivers/cxl/core/region.c
>>> @@ -3217,49 +3217,31 @@ static int match_region_by_range(struct device *dev, const void *data)
>>> return rc;
>>> }
>>>
>>> -/* 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_region(struct cxl_region *cxlr,
>> This is only factoring out part, so I'm not sure the naming makes sense.
>> I don't have a better name however as this is doing various different things...
>> setup_region() doesn't feel right either...
> setup_auto_region()? construct_auto_region()?
>
> DJ
Will use construct_auto_region() in V2 if no a better name, thanks for that.
Ming
Powered by blists - more mailing lists