From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Alison Schofield <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 3/5] tools/testing/cxl: Mock the Inject Poison mailbox command
Date: Thu, 8 Dec 2022 14:53:59 +0000 [thread overview]
Message-ID: <20221208145359.00000251@Huawei.com> (raw)
In-Reply-To: <Y5FsX+aRbB0Erlfp@aschofie-mobl2>
On Wed, 7 Dec 2022 20:47:27 -0800
Alison Schofield <alison.schofield@intel.com> wrote:
> On Wed, Nov 30, 2022 at 02:58:47PM +0000, Jonathan Cameron wrote:
> > On Tue, 29 Nov 2022 20:34:35 -0800
> > alison.schofield@intel.com wrote:
> >
> > > From: Alison Schofield <alison.schofield@intel.com>
> > >
> > > Mock the injection of poison by storing the device:address entry in a
> > > cxl_test array: mock_poison[]. Limit the array to 64 entries and fail
> > > new inject requests when full.
> > >
> > > Introducing the mock_poison[] list here, makes it available for use in
> > > the mock of Clear Poison, and the mock of Get Poison List.
> > >
> > > Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> >
> > Main question I have here is whether we want to mock per device injected poison
> > lists, or just one global. I think we want per device so we can reflect
> > the limits as would be retrieved from Identify Memory Device Output Payload.
> > Whilst we don't do anything useful with it yet, we should also update
> > the mocked response to that command to reflect this.
> >
> > Perhaps we should have a sysfs attribute to read how many entries we can
> > inject? Seems like that would be useful for testing flows on real devices,
> > particularly if the device only supports a very small number!
>
> Jonathan,
>
> Thanks for the review and helping me see the use case. I see the usefulness of
> the per device model but am not clear on the sysfs attr for number of entries.
>
> If user wants to know how many entries can be injected, just inject til I tell
> you no more! Remember that count, run your test w it.
>
> If user wants to dial down that number to something custom, then I can
> see RW attr being useful. Mock driver sets it to a max, and user can
> lower it.
>
> Is that useful?
At this stage - no idea ;)
Probably a wait and see question. If no one asks for it, don't bother
providing the support.
Jonathan
>
> Alison
>
> >
> > > ---
> > > tools/testing/cxl/test/mem.c | 53 ++++++++++++++++++++++++++++++++++++
> > > 1 file changed, 53 insertions(+)
> > >
> > > diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c
> > > index a4f81915ec03..98acb9a644df 100644
> > > --- a/tools/testing/cxl/test/mem.c
> > > +++ b/tools/testing/cxl/test/mem.c
> > > @@ -13,6 +13,7 @@
> > > #define LSA_SIZE SZ_128K
> > > #define DEV_SIZE SZ_2G
> > > #define EFFECT(x) (1U << x)
> > > +#define MOCK_INJECT_POISON_MAX 64
> > >
> > > static struct cxl_cel_entry mock_cel[] = {
> > > {
> > > @@ -43,6 +44,10 @@ static struct cxl_cel_entry mock_cel[] = {
> > > .opcode = cpu_to_le16(CXL_MBOX_OP_GET_POISON),
> > > .effect = cpu_to_le16(0),
> > > },
> > > + {
> > > + .opcode = cpu_to_le16(CXL_MBOX_OP_INJECT_POISON),
> > > + .effect = cpu_to_le16(0),
> > > + },
> > > };
> > >
> > > /* See CXL 2.0 Table 181 Get Health Info Output Payload */
> > > @@ -210,6 +215,51 @@ static int mock_health_info(struct cxl_dev_state *cxlds,
> > > return 0;
> > > }
> > >
> > > +static struct mock_poison {
> > > + struct cxl_dev_state *cxlds;
> > > + u64 dpa;
> > > +} mock_poison[MOCK_INJECT_POISON_MAX];
> >
> > Don't we want one of these per device instance?
> >
> > > +
> > > +static bool mock_poison_add(struct cxl_dev_state *cxlds, u64 dpa)
> > > +{
> > > + for (int i = 0; i < MOCK_INJECT_POISON_MAX; i++) {
> > > + if (!mock_poison[i].cxlds) {
> > > + mock_poison[i].cxlds = cxlds;
> > > + mock_poison[i].dpa = dpa;
> > > + return true;
> > > + }
> > > + }
> > > + dev_dbg(cxlds->dev, "Mock poison list full: %d\n",
> > > + MOCK_INJECT_POISON_MAX);
> > Slightly nicer maybe to use the text from
> > https://elixir.bootlin.com/linux/latest/source/drivers/cxl/cxlmem.h#L128
> > and have: "Mock poison injection limit has been reached: %d\n" ..
> >
> > > + return false;
> > > +}
> >
>
next prev parent reply other threads:[~2022-12-08 14:54 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 4:34 [PATCH 0/5] cxl: CXL Inject & Clear Poison alison.schofield
2022-11-30 4:34 ` [PATCH 1/5] cxl/memdev: Add support for the Inject Poison mailbox command alison.schofield
2022-11-30 14:31 ` Jonathan Cameron
2022-11-30 14:40 ` Jonathan Cameron
2022-12-01 16:42 ` Dave Jiang
2022-12-08 4:20 ` Alison Schofield
2022-12-01 17:26 ` Dave Jiang
2022-12-08 4:17 ` Alison Schofield
2022-12-04 22:04 ` Dan Williams
2022-12-08 4:16 ` Alison Schofield
2022-11-30 4:34 ` [PATCH 2/5] cxl/memdev: Add support for the Clear " alison.schofield
2022-11-30 14:43 ` Jonathan Cameron
2022-12-01 20:14 ` Alison Schofield
2022-12-01 17:54 ` Dave Jiang
2022-12-01 20:09 ` Alison Schofield
2022-11-30 4:34 ` [PATCH 3/5] tools/testing/cxl: Mock the Inject " alison.schofield
2022-11-30 14:58 ` Jonathan Cameron
2022-12-08 4:47 ` Alison Schofield
2022-12-08 14:53 ` Jonathan Cameron [this message]
2022-11-30 4:34 ` [PATCH 4/5] tools/testing/cxl: Mock the Clear " alison.schofield
2022-11-30 15:01 ` Jonathan Cameron
2022-11-30 4:34 ` [PATCH 5/5] tools/testing/cxl: Use injected poison for Get Poison List alison.schofield
2022-11-30 15:15 ` Jonathan Cameron
2022-12-08 4:30 ` Alison Schofield
2022-12-08 14:54 ` 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=20221208145359.00000251@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