linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Huang, Ying" <ying.huang@intel.com>
To: Shuai Xue <xueshuai@linux.alibaba.com>
Cc: "Luck, Tony" <tony.luck@intel.com>,
	"rjw@rjwysocki.net" <rjw@rjwysocki.net>,
	"lenb@kernel.org" <lenb@kernel.org>,
	"james.morse@arm.com" <james.morse@arm.com>,
	"bp@alien8.de" <bp@alien8.de>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"graeme.gregory@linaro.org" <graeme.gregory@linaro.org>,
	"will.deacon@arm.com" <will.deacon@arm.com>,
	"myron.stowe@redhat.com" <myron.stowe@redhat.com>,
	"Brown, Len" <len.brown@intel.com>
Subject: Re: [BUG] kernel side can NOT trigger memory error with einj
Date: Mon, 21 Mar 2022 10:43:16 +0800	[thread overview]
Message-ID: <87wngoc9ff.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <78cefd4c-f735-2ec4-0c09-35c8191280c5@linux.alibaba.com> (Shuai Xue's message of "Sun, 20 Mar 2022 21:11:58 +0800")

Shuai Xue <xueshuai@linux.alibaba.com> writes:

> 在 2022/3/18 AM12:57, Luck, Tony 写道:
>>> -       rc = apei_exec_run(&trigger_ctx, ACPI_EINJ_TRIGGER_ERROR);
>>> +       ptr = kmap(pfn_to_page(pfn));
>>> +       tmp = *(ptr + (param1 & ~ PAGE_MASK));
>> 
>> That hack works when the trigger action is just trying to access the injected
>> location. But on Intel platforms the trigger "kicks" the patrol scrubber in the
>> memory controller to access the address. So the error is triggered not by
>> an access from the core, but by internal memory controller access.
>> 
>> This results in a different error signature (for an uncorrected error injection
>> it will be a UCNA or SRAO in Intel acronym-speak).
>
> As far as I know, APEI only defines five injection instructions, ACPI_EINJ_READ_REGISTER,
> ACPI_EINJ_READ_REGISTER_VALUE, ACPI_EINJ_WRITE_REGISTER, ACPI_EINJ_WRITE_REGISTER_VALUE and
> ACPI_EINJ_NOOP. ACPI_EINJ_TRIGGER_ERROR action should run one of them, I don't see
> any of them will kick the patrol scrubber. For example, trigger with ACPI_EINJ_READ_REGISTER:
>
> apei_exec_run(&trigger_ctx, ACPI_EINJ_TRIGGER_ERROR)
>     __apei_exec_run	// ins=0
>         => apei_exec_read_register
>             => apei_read
>                 => acpi_os_read_memory
>                     => acpi_map_vaddr_lookup    /* lookup VA of PA from acpi_ioremap */
>                     => acpi_os_ioremap
> 		    => acpi_os_read_iomem
> 			=> *(u32 *) value = readl(virt_addr);
>
> As we can see, the error is triggered by access from the core. However, the physical
> address can NOT be mapped by acpi_os_ioremap.
>
> If I missed anything, please let me know. Thank you very much.

As the name suggested, ACPI_EINJ_READ/WRITE_REGISTER are used to
read/write device registers via iomem.  They aren't used to read/write
normal physical memory.  If that's needed, you can try some other method
I guess.

If you write a device register, the device can kick the patrol scrubber
for you.  This device behavior needs not to be defined in APEI spec.

Best Regards,
Huang, Ying

> Best Regards,
> Shuai

  reply	other threads:[~2022-03-21  2:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08  5:19 [BUG] kernel side can NOT trigger memory error with einj Shuai Xue
2022-03-16 17:29 ` Luck, Tony
2022-03-17  2:56   ` Shuai Xue
2022-03-17 16:57     ` Luck, Tony
2022-03-20 13:11       ` Shuai Xue
2022-03-21  2:43         ` Huang, Ying [this message]
2022-03-22  3:36           ` Shuai Xue
2022-03-21 15:54         ` Luck, Tony

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=87wngoc9ff.fsf@yhuang6-desk2.ccr.corp.intel.com \
    --to=ying.huang@intel.com \
    --cc=bp@alien8.de \
    --cc=graeme.gregory@linaro.org \
    --cc=james.morse@arm.com \
    --cc=len.brown@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myron.stowe@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=tony.luck@intel.com \
    --cc=will.deacon@arm.com \
    --cc=xueshuai@linux.alibaba.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).