From: Jonathan Cameron <jic23@kernel.org>
To: Shaikh Kamaluddin <shaikhkamal2012@gmail.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
Dave Jiang <dave.jiang@intel.com>,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Dan Williams <djbw@kernel.org>, Miaohe Lin <linmiaohe@huawei.com>,
Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@kernel.org>,
Breno Leitao <leitao@debian.org>, Ira Weiny <iweiny@kernel.org>,
Li Ming <ming.li@zohomail.com>, Richard Cheng <icheng@nvidia.com>,
Naoya Horiguchi <nao.horiguchi@gmail.com>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Brendan Jackman <brendan.jackman@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>,
linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, David Hildenbrand <david@kernel.org>,
Oscar Salvador <osalvador@suse.de>,
Kiryl Shutsemau <kas@kernel.org>, Harry Yoo <harry@kernel.org>
Subject: Re: [RFC PATCH 2/5] cxl/region: Factor decoder poison-list retrieval
Date: Fri, 16 Oct 2026 23:21:03 +0100 [thread overview]
Message-ID: <20261016232103.6497bbb2@jic23-hlaptop> (raw)
In-Reply-To: <20261010162017.62506-3-shaikhkamal2012@gmail.com>
On Sat, 10 Oct 2026 21:50:10 +0530
Shaikh Kamaluddin <shaikhkamal2012@gmail.com> wrote:
> poison_by_decoder() performs two different operations: it queries an
> unmapped DPA gap preceding an endpoint decoder, then queries the DPA
> resource assigned to that decoder and its region.
>
> Factor the second operation into cxl_get_poison_by_decoder(). Give the
> helper an optional snapshot so a later region-probe caller can retain
> records from exactly one mapped decoder. Keep the existing endpoint
> walk, skipped-DPA queries, partition-tail queries, -EFAULT handling, and
> trace behavior unchanged.
>
> Signed-off-by: Shaikh Kamaluddin <shaikhkamal2012@gmail.com>
> ---
> drivers/cxl/core/region.c | 41 ++++++++++++++++++++++++++++++++++-----
> 1 file changed, 36 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 75b8092e6dc2..c72524923b38 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -2940,6 +2940,40 @@ static int cxl_get_poison_unmapped(struct cxl_memdev *cxlmd,
> return rc;
> }
>
> +enum cxl_poison_query_policy {
> + CXL_POISON_QUERY_DIAGNOSTIC,
> + CXL_POISON_QUERY_PREONLINE,
For now, perhaps focus on flags defining what you want done, not when the
query is happening.
> +};
> +
> +static int cxl_get_poison_by_decoder(struct cxl_endpoint_decoder *cxled,
> + struct cxl_poison_snapshot *snapshot,
> + enum cxl_poison_query_policy policy)
> +{
> + struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
> + struct cxl_dev_state *cxlds = cxlmd->cxlds;
> + enum cxl_partition_mode mode;
> + u64 offset, length;
> + int rc;
> +
> + if (!cxled->dpa_res)
> + return 0;
> +
> + mode = cxlds->part[cxled->part].mode;
> + offset = cxled->dpa_res->start;
> + length = resource_size(cxled->dpa_res);
> + if (snapshot)
> + rc = cxl_mem_get_poison_snapshot(cxlmd, offset, length,
> + cxled->cxld.region, snapshot);
> + else
> + rc = cxl_mem_get_poison(cxlmd, offset, length,
> + cxled->cxld.region);
> +
> + if (rc == -EFAULT && mode == CXL_PARTMODE_RAM &&
> + policy == CXL_POISON_QUERY_DIAGNOSTIC)
This is becoming odd enough I'd add some comments saying why
we are eating the error return.
> + rc = 0;
> + return rc;
> +}
> +
> static int poison_by_decoder(struct device *dev, void *arg)
> {
> struct cxl_poison_context *ctx = arg;
> @@ -2971,11 +3005,8 @@ static int poison_by_decoder(struct device *dev, void *arg)
> return rc;
> }
>
> - offset = cxled->dpa_res->start;
> - length = cxled->dpa_res->end - offset + 1;
> - rc = cxl_mem_get_poison(cxlmd, offset, length, cxled->cxld.region);
> - if (rc == -EFAULT && mode == CXL_PARTMODE_RAM)
> - rc = 0;
> + rc = cxl_get_poison_by_decoder(cxled, NULL,
> + CXL_POISON_QUERY_DIAGNOSTIC);
> if (rc)
> return rc;
>
next prev parent reply other threads:[~2026-10-16 22:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 16:20 [RFC PATCH 0/5] cxl, mm: Keep device-reported poison out of the page allocator Shaikh Kamaluddin
2026-10-10 16:20 ` [RFC PATCH 1/5] cxl/mbox: Add Get Poison List snapshot support Shaikh Kamaluddin
2026-10-10 16:20 ` [RFC PATCH 2/5] cxl/region: Factor decoder poison-list retrieval Shaikh Kamaluddin
2026-10-16 22:21 ` Jonathan Cameron [this message]
2026-10-10 16:20 ` [RFC PATCH 3/5] mm/memory-failure: Add a pre-online poison registry Shaikh Kamaluddin
2026-10-10 16:20 ` [RFC PATCH 4/5] mm/page_alloc: Keep pre-online poison out of the buddy allocator Shaikh Kamaluddin
2026-10-15 7:27 ` Richard Cheng
2026-10-10 16:20 ` [RFC PATCH 5/5] cxl/region: Register device poison before exposing RAM Shaikh Kamaluddin
2026-10-15 7:59 ` Richard Cheng
2026-10-16 22:35 ` Jonathan Cameron
2026-10-16 20:42 ` [RFC PATCH 0/5] cxl, mm: Keep device-reported poison out of the page allocator 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=20261016232103.6497bbb2@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alison.schofield@intel.com \
--cc=brendan.jackman@linux.dev \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=david@kernel.org \
--cc=djbw@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=harry@kernel.org \
--cc=icheng@nvidia.com \
--cc=iweiny@kernel.org \
--cc=kas@kernel.org \
--cc=leitao@debian.org \
--cc=linmiaohe@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=ming.li@zohomail.com \
--cc=nao.horiguchi@gmail.com \
--cc=osalvador@suse.de \
--cc=shaikhkamal2012@gmail.com \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=vishal.l.verma@intel.com \
--cc=ziy@nvidia.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