Linux CXL
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: <alison.schofield@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	"Ben Widawsky" <bwidawsk@kernel.org>,
	Dave Jiang <dave.jiang@intel.com>, <linux-cxl@vger.kernel.org>
Subject: Re: [PATCH v2 5/6] tools/testing/cxl: Use injected poison for get poison list
Date: Mon, 23 Jan 2023 15:16:53 +0000	[thread overview]
Message-ID: <20230123151653.00006eee@Huawei.com> (raw)
In-Reply-To: <e4c530ac9c073eb753a98a052216d58a571799e4.1674101475.git.alison.schofield@intel.com>

On Wed, 18 Jan 2023 21:00:20 -0800
alison.schofield@intel.com wrote:

> From: Alison Schofield <alison.schofield@intel.com>
> 
> Prior to poison inject support, the mock of 'Get Poison List'
> returned a poison list containing a single mocked error record.
> 
> Now, following the addition of poison inject and clear support,
> use the mock_poison_list[] as the source of records for 'Get
> Poison List' requests.
> 
> This supports confirmation of inject and clear poison commands.
> 
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
A comment inline.  Either way I'm fine with this.

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

> ---
>  tools/testing/cxl/test/mem.c | 56 ++++++++++++++++++++++++------------
>  1 file changed, 38 insertions(+), 18 deletions(-)
> 
> diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c
> index bb0be9fe3fe9..14d74bfb3124 100644
> --- a/tools/testing/cxl/test/mem.c
> +++ b/tools/testing/cxl/test/mem.c
> @@ -582,31 +582,51 @@ static struct mock_poison {
>  	u64 dpa;
>  } mock_poison_list[MOCK_INJECT_TEST_MAX];
>  
> +static struct cxl_mbox_poison_payload_out
> +*cxl_get_injected_po(struct cxl_dev_state *cxlds, u64 offset, u64 length)
> +{
> +	struct cxl_mbox_poison_payload_out *po;
> +	int nr_records = 0;
> +	u64 dpa;
> +
> +	po = kzalloc(struct_size(po, record, MOCK_INJECT_DEV_MAX), GFP_KERNEL);
> +	if (!po)
> +		return NULL;
> +
> +	for (int i = 0; i < MOCK_INJECT_TEST_MAX; i++) {
> +		if (mock_poison_list[i].cxlds != cxlds)
> +			continue;
> +		if (mock_poison_list[i].dpa < offset ||
> +		    mock_poison_list[i].dpa > offset + length - 1)

I was thinking that we could move this to the add side of things, but
perhaps it actually makes sense in both code paths?

> +			continue;
> +
> +		dpa = mock_poison_list[i].dpa + CXL_POISON_SOURCE_INJECTED;
> +		po->record[nr_records].address = cpu_to_le64(dpa);
> +		po->record[nr_records].length = cpu_to_le32(1);
> +		nr_records++;
> +		if (nr_records == MOCK_INJECT_DEV_MAX)
> +			break;
> +	}
> +
> +	/* Always return count, even when zero */
> +	po->count = cpu_to_le16(nr_records);
> +
> +	return po;
> +}
> +


  reply	other threads:[~2023-01-23 15:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19  5:00 [PATCH v2 0/6] cxl: CXL Inject & Clear Poison alison.schofield
2023-01-19  5:00 ` [PATCH v2 1/6] cxl/memdev: Add support for the Inject Poison mailbox command alison.schofield
2023-01-27 23:06   ` Dan Williams
2023-01-28  2:47     ` Alison Schofield
2023-01-29  3:49       ` Dan Williams
2023-01-19  5:00 ` [PATCH v2 2/6] cxl/memdev: Add support for the Clear " alison.schofield
2023-01-27 23:56   ` Dan Williams
2023-01-28  1:17     ` Alison Schofield
2023-01-28  2:19       ` Dan Williams
2023-01-19  5:00 ` [PATCH v2 3/6] tools/testing/cxl: Mock the Inject " alison.schofield
2023-01-23 15:10   ` Jonathan Cameron
2023-01-24  0:06     ` Alison Schofield
2023-01-19  5:00 ` [PATCH v2 4/6] tools/testing/cxl: Mock the Clear " alison.schofield
2023-01-19  5:00 ` [PATCH v2 5/6] tools/testing/cxl: Use injected poison for get poison list alison.schofield
2023-01-23 15:16   ` Jonathan Cameron [this message]
2023-01-24  0:24     ` Alison Schofield
2023-01-24 10:15       ` Jonathan Cameron
2023-01-19  5:00 ` [PATCH v2 6/6] tools/testing/cxl: Add a param to test poison injection limits alison.schofield
2023-01-23 15:28   ` Jonathan Cameron
2023-01-23 23:57     ` Alison Schofield
2023-01-23 17:13 ` [PATCH v2 0/6] cxl: CXL Inject & Clear Poison Jonathan Cameron
2023-01-23 23:42   ` Alison Schofield
2023-01-24 10:21     ` Jonathan Cameron

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=20230123151653.00006eee@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=bwidawsk@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=vishal.l.verma@intel.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