From: Shiyang Ruan <ruansy.fnst@fujitsu.com>
To: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Cc: linux-cxl@vger.kernel.org, linux-edac@vger.kernel.org,
linux-mm@kvack.org, dan.j.williams@intel.com,
vishal.l.verma@intel.com, alison.schofield@intel.com,
bp@alien8.de, dave.jiang@intel.com, dave@stgolabs.net,
ira.weiny@intel.com, james.morse@arm.com, linmiaohe@huawei.com,
mchehab@kernel.org, nao.horiguchi@gmail.com, rric@kernel.org,
tony.luck@intel.com
Subject: Re: [PATCH v4 2/2] cxl: avoid duplicated report from MCE & device
Date: Mon, 2 Sep 2024 22:19:25 +0800 [thread overview]
Message-ID: <c7e48e89-88fb-4810-8bdb-9307203a0091@fujitsu.com> (raw)
In-Reply-To: <20240827165255.00003184@Huawei.com>
在 2024/8/27 23:52, Jonathan Cameron 写道:
> On Thu, 8 Aug 2024 23:13:28 +0800
> Shiyang Ruan <ruansy.fnst@fujitsu.com> wrote:
>
>> Since CXL device is a memory device, while CPU is consuming a poison
>> page of CXL device, it always triggers a MCE (via interrupt #18) and
>> calls memory_failure() to handle POISON page, no matter which-First path
>> is configured. CXL device could also find and report the POISON, kernel
>> now not only traces but also calls memory_failure() to handle it, which
>> is marked as "NEW" in the figure blow.
>> ```
>> 1. MCE (interrupt #18, while CPU consuming POISON)
>> -> do_machine_check()
>> -> mce_log()
>> -> notify chain (x86_mce_decoder_chain)
>> -> memory_failure() <---------------------------- EXISTS
>> 2.a FW-First (optional, CXL device proactively find&report)
>> -> CXL device -> Firmware
>> -> OS: ACPI->APEI->GHES->CPER -> CXL driver -> trace
>> \-> memory_failure()
>> ^----- NEW
>> 2.b OS-First (optional, CXL device proactively find&report)
>> -> CXL device -> MSI
>> -> OS: CXL driver -> trace
>> \-> memory_failure()
>> ^------------------------------- NEW
>> ```
>>
>> But in this way, the memory_failure() could be called twice or even at
>> same time, as is shown in the figure above: (1.) and (2.a or 2.b),
>> before the POISON page is cleared. memory_failure() has it own mutex
>> lock so it actually won't be called at same time and the later call
>> could be avoided because HWPoison bit has been set. However, assume
>> such a scenario, "CXL device reports POISON error" triggers 1st call,
>> user see it from log and want to clear the poison by executing `cxl
>> clear-poison` command, and at the same time, a process tries to access
>> this POISON page, which triggers MCE (it's the 2nd call).
>
> Attempting to clear poison in a page that is online seems unwise.
> Does that ever make sense today?
To be honest, I am not sure about this. Even if the error from CXL
device is recoverable, we don't reuse it again?
>
>> Since there
>> is no lock between the 2nd call with clearing poison operation, race
>> condition may happen, which may cause HWPoison bit of the page in an
>> unknown state.
>
> As long as that state is always wrong in the sense we think it's poisoned
> when it isn't we don't care.
The 2nd memory_failure() need this state to determine whether to
continue its process or return.
>>
>> Thus, we have to avoid the 2nd call. This patch[2] introduces a new
>> notifier_block into `x86_mce_decoder_chain` and a POISON cache list, to
>> stop the 2nd call of memory_failure(). It checks whether the current
>> poison page has been reported (if yes, stop the notifier chain, don't
>> call the following memory_failure() to report again).
>>
>
> If we do want to do this, it belongs in the generic code, not arch specific
> part. Can we do similar in memory failure?
Yes, I saw the build error. Will fix this.
>
> To RAS reviewers, this isn't a new problem unique to CXL. Does a solution
> like this make sense in practice, or are we fine to always let two reports
> for the same error get handled?
>
>
> Jonathan
>
>
--
Thanks,
Ruan.
prev parent reply other threads:[~2024-09-02 14:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 15:13 [PATCH v4 0/2] cxl: add device reporting poison handler Shiyang Ruan
2024-08-08 15:13 ` [PATCH v4 1/2] cxl/core: introduce device reporting poison hanlding Shiyang Ruan
2024-08-08 18:28 ` Fan Ni
2024-08-21 13:57 ` Shiyang Ruan
2024-08-27 15:46 ` Jonathan Cameron
2024-09-02 14:03 ` Shiyang Ruan
2024-08-08 15:13 ` [PATCH v4 2/2] cxl: avoid duplicated report from MCE & device Shiyang Ruan
2024-08-09 7:31 ` kernel test robot
2024-08-09 7:31 ` kernel test robot
2024-08-09 11:48 ` kernel test robot
2024-08-27 15:52 ` Jonathan Cameron
2024-09-02 14:19 ` Shiyang Ruan [this message]
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=c7e48e89-88fb-4810-8bdb-9307203a0091@fujitsu.com \
--to=ruansy.fnst@fujitsu.com \
--cc=Jonathan.Cameron@Huawei.com \
--cc=alison.schofield@intel.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=james.morse@arm.com \
--cc=linmiaohe@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mchehab@kernel.org \
--cc=nao.horiguchi@gmail.com \
--cc=rric@kernel.org \
--cc=tony.luck@intel.com \
--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;
as well as URLs for NNTP newsgroup(s).