All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] cxl/mem: Fix for the index of Clear Event Record Handle
@ 2024-03-18  2:29 Yuquan Wang
  2024-03-18  2:29 ` [PATCH v2 1/1] " Yuquan Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Yuquan Wang @ 2024-03-18  2:29 UTC (permalink / raw)
  To: ira.weiny, jonathan.cameron, dan.j.williams
  Cc: linux-cxl, linux-kernel, qemu-devel, chenbaozi, Yuquan Wang

This is a simple fix for the index of 'Clear Event Record' Handle. The
print content of dev_dbg from Clear Event Records mailbox command would
report the handle of the next record to clear not the current one.

The problem was found when I was doing the debug of CXL Event Error on
Qemu. I injected an individual event through QMP 
'cxl-inject-general-media-event':
{ "execute": "cxl-inject-general-media-event",
    "arguments": {
        "path": "/machine/peripheral/cxl-mem0",
        "log": "informational",
        "flags": 1,
        "dpa": 1000,
        "descriptor": 3,
        "type": 3,
        "transaction-type": 192,
        "channel": 3,
        "device": 5,
        "component-id": "iras mem"
    }}

Then the kernel printed: 
[ 1639.106181] cxl_pci 0000:0d:00.0: Event log '0': Clearing 0

However, the line 36 in 'hw/cxl/cxl-events.c': log->next_handle = 1;
It will set the actual handle value of injected event to '1'.

With this fix, the kernel will print:
[  122.456750] cxl_pci 0000:0d:00.0: Event log '0': Clearing 1
which is in line with the simulated value in Qemu.

Yuquan Wang (1):
  cxl/mem: Fix for the index of Clear Event Record Handle

 drivers/cxl/core/mbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/1] cxl/mem: Fix for the index of Clear Event Record Handle
  2024-03-18  2:29 [PATCH v2 0/1] cxl/mem: Fix for the index of Clear Event Record Handle Yuquan Wang
@ 2024-03-18  2:29 ` Yuquan Wang
  2024-03-18 10:57     ` Jonathan Cameron via
  2024-03-18 16:51   ` fan
  0 siblings, 2 replies; 7+ messages in thread
From: Yuquan Wang @ 2024-03-18  2:29 UTC (permalink / raw)
  To: ira.weiny, jonathan.cameron, dan.j.williams
  Cc: linux-cxl, linux-kernel, qemu-devel, chenbaozi, Yuquan Wang

The dev_dbg info for Clear Event Records mailbox command would report
the handle of the next record to clear not the current one.

This was because the index 'i' had incremented before printing the
current handle value.

Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
---
 drivers/cxl/core/mbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index 9adda4795eb7..b810a6aa3010 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -915,7 +915,7 @@ static int cxl_clear_event_record(struct cxl_memdev_state *mds,
 
 		payload->handles[i++] = gen->hdr.handle;
 		dev_dbg(mds->cxlds.dev, "Event log '%d': Clearing %u\n", log,
-			le16_to_cpu(payload->handles[i]));
+			le16_to_cpu(payload->handles[i-1]));
 
 		if (i == max_handles) {
 			payload->nr_recs = i;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/1] cxl/mem: Fix for the index of Clear Event Record Handle
  2024-03-18  2:29 ` [PATCH v2 1/1] " Yuquan Wang
@ 2024-03-18 10:57     ` Jonathan Cameron via
  2024-03-18 16:51   ` fan
  1 sibling, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2024-03-18 10:57 UTC (permalink / raw)
  To: Yuquan Wang
  Cc: ira.weiny, dan.j.williams, linux-cxl, linux-kernel, qemu-devel,
	chenbaozi

On Mon, 18 Mar 2024 10:29:28 +0800
Yuquan Wang <wangyuquan1236@phytium.com.cn> wrote:

> The dev_dbg info for Clear Event Records mailbox command would report
> the handle of the next record to clear not the current one.
> 
> This was because the index 'i' had incremented before printing the
> current handle value.
> 
> Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
> ---
>  drivers/cxl/core/mbox.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index 9adda4795eb7..b810a6aa3010 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -915,7 +915,7 @@ static int cxl_clear_event_record(struct cxl_memdev_state *mds,
>  
>  		payload->handles[i++] = gen->hdr.handle;
>  		dev_dbg(mds->cxlds.dev, "Event log '%d': Clearing %u\n", log,
> -			le16_to_cpu(payload->handles[i]));
> +			le16_to_cpu(payload->handles[i-1]));
Trivial but needs spaces around the -. e.g.  [i - 1] 

Maybe Dan can fix up whilst applying.

Otherwise

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

>  
>  		if (i == max_handles) {
>  			payload->nr_recs = i;


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/1] cxl/mem: Fix for the index of Clear Event Record Handle
@ 2024-03-18 10:57     ` Jonathan Cameron via
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron via @ 2024-03-18 10:57 UTC (permalink / raw)
  To: Yuquan Wang
  Cc: ira.weiny, dan.j.williams, linux-cxl, linux-kernel, qemu-devel,
	chenbaozi

On Mon, 18 Mar 2024 10:29:28 +0800
Yuquan Wang <wangyuquan1236@phytium.com.cn> wrote:

> The dev_dbg info for Clear Event Records mailbox command would report
> the handle of the next record to clear not the current one.
> 
> This was because the index 'i' had incremented before printing the
> current handle value.
> 
> Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
> ---
>  drivers/cxl/core/mbox.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index 9adda4795eb7..b810a6aa3010 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -915,7 +915,7 @@ static int cxl_clear_event_record(struct cxl_memdev_state *mds,
>  
>  		payload->handles[i++] = gen->hdr.handle;
>  		dev_dbg(mds->cxlds.dev, "Event log '%d': Clearing %u\n", log,
> -			le16_to_cpu(payload->handles[i]));
> +			le16_to_cpu(payload->handles[i-1]));
Trivial but needs spaces around the -. e.g.  [i - 1] 

Maybe Dan can fix up whilst applying.

Otherwise

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

>  
>  		if (i == max_handles) {
>  			payload->nr_recs = i;



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/1] cxl/mem: Fix for the index of Clear Event Record Handle
  2024-03-18  2:29 ` [PATCH v2 1/1] " Yuquan Wang
  2024-03-18 10:57     ` Jonathan Cameron via
@ 2024-03-18 16:51   ` fan
  1 sibling, 0 replies; 7+ messages in thread
From: fan @ 2024-03-18 16:51 UTC (permalink / raw)
  To: Yuquan Wang
  Cc: ira.weiny, jonathan.cameron, dan.j.williams, linux-cxl,
	linux-kernel, qemu-devel, chenbaozi

On Mon, Mar 18, 2024 at 10:29:28AM +0800, Yuquan Wang wrote:
> The dev_dbg info for Clear Event Records mailbox command would report
> the handle of the next record to clear not the current one.
> 
> This was because the index 'i' had incremented before printing the
> current handle value.
> 
> Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
> ---
>  drivers/cxl/core/mbox.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index 9adda4795eb7..b810a6aa3010 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -915,7 +915,7 @@ static int cxl_clear_event_record(struct cxl_memdev_state *mds,
>  
>  		payload->handles[i++] = gen->hdr.handle;
>  		dev_dbg(mds->cxlds.dev, "Event log '%d': Clearing %u\n", log,
> -			le16_to_cpu(payload->handles[i]));
> +			le16_to_cpu(payload->handles[i-1]));

LGTM except for the space issue mentioned by Jonathan.

After the fix,
Reviewed-by: Fan Ni <fan.ni@samsung.com>

Fan
>  
>  		if (i == max_handles) {
>  			payload->nr_recs = i;
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/1] cxl/mem: Fix for the index of Clear Event Record Handle
  2024-03-18 10:57     ` Jonathan Cameron via
  (?)
@ 2024-03-19  0:38     ` Dan Williams
  2024-03-19 18:31       ` Dave Jiang
  -1 siblings, 1 reply; 7+ messages in thread
From: Dan Williams @ 2024-03-19  0:38 UTC (permalink / raw)
  To: Jonathan Cameron, Yuquan Wang
  Cc: ira.weiny, dan.j.williams, linux-cxl, linux-kernel, qemu-devel,
	chenbaozi

Jonathan Cameron wrote:
> On Mon, 18 Mar 2024 10:29:28 +0800
> Yuquan Wang <wangyuquan1236@phytium.com.cn> wrote:
> 
> > The dev_dbg info for Clear Event Records mailbox command would report
> > the handle of the next record to clear not the current one.
> > 
> > This was because the index 'i' had incremented before printing the
> > current handle value.
> > 
> > Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
> > ---
> >  drivers/cxl/core/mbox.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> > index 9adda4795eb7..b810a6aa3010 100644
> > --- a/drivers/cxl/core/mbox.c
> > +++ b/drivers/cxl/core/mbox.c
> > @@ -915,7 +915,7 @@ static int cxl_clear_event_record(struct cxl_memdev_state *mds,
> >  
> >  		payload->handles[i++] = gen->hdr.handle;
> >  		dev_dbg(mds->cxlds.dev, "Event log '%d': Clearing %u\n", log,
> > -			le16_to_cpu(payload->handles[i]));
> > +			le16_to_cpu(payload->handles[i-1]));
> Trivial but needs spaces around the -. e.g.  [i - 1] 
> 
> Maybe Dan can fix up whilst applying.
> 
> Otherwise
> 
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

I have enlisted Dave to start wrangling CXL kernel patches upstream, and
I will fall back to just reviewing.

Dave, you can add my:

Reviewed-by: Dan Williams <dan.j.williams@intel.com>

...with the same caveat as above.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/1] cxl/mem: Fix for the index of Clear Event Record Handle
  2024-03-19  0:38     ` Dan Williams
@ 2024-03-19 18:31       ` Dave Jiang
  0 siblings, 0 replies; 7+ messages in thread
From: Dave Jiang @ 2024-03-19 18:31 UTC (permalink / raw)
  To: Dan Williams, Jonathan Cameron, Yuquan Wang
  Cc: ira.weiny, linux-cxl, linux-kernel, qemu-devel, chenbaozi



On 3/18/24 5:38 PM, Dan Williams wrote:
> Jonathan Cameron wrote:
>> On Mon, 18 Mar 2024 10:29:28 +0800
>> Yuquan Wang <wangyuquan1236@phytium.com.cn> wrote:
>>
>>> The dev_dbg info for Clear Event Records mailbox command would report
>>> the handle of the next record to clear not the current one.
>>>
>>> This was because the index 'i' had incremented before printing the
>>> current handle value.
>>>
>>> Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
>>> ---
>>>  drivers/cxl/core/mbox.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
>>> index 9adda4795eb7..b810a6aa3010 100644
>>> --- a/drivers/cxl/core/mbox.c
>>> +++ b/drivers/cxl/core/mbox.c
>>> @@ -915,7 +915,7 @@ static int cxl_clear_event_record(struct cxl_memdev_state *mds,
>>>  
>>>  		payload->handles[i++] = gen->hdr.handle;
>>>  		dev_dbg(mds->cxlds.dev, "Event log '%d': Clearing %u\n", log,
>>> -			le16_to_cpu(payload->handles[i]));
>>> +			le16_to_cpu(payload->handles[i-1]));
>> Trivial but needs spaces around the -. e.g.  [i - 1] 
>>
>> Maybe Dan can fix up whilst applying.
>>
>> Otherwise
>>
>> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> I have enlisted Dave to start wrangling CXL kernel patches upstream, and
> I will fall back to just reviewing.
> 
> Dave, you can add my:
> 
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>
> 
> ...with the same caveat as above.

Applied, updated, and added 
Fixes: 6ebe28f9ec72 ("cxl/mem: Read, trace, and clear events on driver load")

> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-03-19 18:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-18  2:29 [PATCH v2 0/1] cxl/mem: Fix for the index of Clear Event Record Handle Yuquan Wang
2024-03-18  2:29 ` [PATCH v2 1/1] " Yuquan Wang
2024-03-18 10:57   ` Jonathan Cameron
2024-03-18 10:57     ` Jonathan Cameron via
2024-03-19  0:38     ` Dan Williams
2024-03-19 18:31       ` Dave Jiang
2024-03-18 16:51   ` fan

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.