All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiaqi Yan <jiaqiyan@google.com>
To: "Luck, Tony" <tony.luck@intel.com>,
	"HORIGUCHI NAOYA(堀口 直也)" <naoya.horiguchi@nec.com>
Cc: "dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"david@redhat.com" <david@redhat.com>,
	 "Aktas, Erdem" <erdemaktas@google.com>,
	"pgonda@google.com" <pgonda@google.com>,
	 "rientjes@google.com" <rientjes@google.com>,
	"Hsiao, Duen-wen" <duenwen@google.com>,
	 "Vilas.Sridharan@amd.com" <Vilas.Sridharan@amd.com>,
	"Malvestuto, Mike" <mike.malvestuto@intel.com>,
	 "gthelen@google.com" <gthelen@google.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	 "jthoughton@google.com" <jthoughton@google.com>,
	"Ghannam, Yazen" <Yazen.Ghannam@amd.com>,
	 Sean Christopherson <seanjc@google.com>
Subject: Re: [RFC] Kernel Support of Memory Error Detection.
Date: Thu, 10 Nov 2022 12:25:03 -0800	[thread overview]
Message-ID: <CACw3F527uDU3t6S_buRhCRsPFrabKCumF2H_5Jp_WzBTVVD8qQ@mail.gmail.com> (raw)
In-Reply-To: <SJ1PR11MB6083AE844ABC664FD1A8276BFC3E9@SJ1PR11MB6083.namprd11.prod.outlook.com>

On Wed, Nov 9, 2022 at 8:16 AM Luck, Tony <tony.luck@intel.com> wrote:
>
> > I think that another viewpoint of how we prioritize memory type to scan
> > is kernel vs userspace memory. Current hwpoison mechanism does little to
> > recover from errors in kernel pages (slab, reserved), so there seesm
> > little benefit to detect such errors proactively and beforehand.  If the
> > resource for scanning is limited, the user might think of focusing on
> > scanning userspace memory.
>
> Page cache is (in some many use cases) a large user of kernel memory, and there
> would be options for recovery if errors were pre-emptively found: clean page ->
> re-read from storage, modified page -> mark in some way to force EIO for read()
> and fail(?) mmap().
>
> -Tony

Adding the page cache into discussion, I would like to separate the
memory scanner from mm's recovery mechanism.

We want to build an agnostic in-kernel scanner that safely detects
memory errors in physical memory.
(e.g. for IntelX86 all usable physical pages in e820), ideally without
the need to know the "memory type" (owned by user vs kernel? free vs
allocated? page cache dirty vs clean? owned by virtualization guest vs
host).
After the scanner detects a PFN has a memory error, it reports to the
memory-failure module, who classifies the type of the memory page and
takes recovery actions accordingly.
(For example, page cache will be handled by me_pagecache_dirty/clean,
I believe that's basically what Tony described)
So the proactive scanner should always improve the kernel's memory
reliability by recovering more error pages and recover proactively
(not waiting until someone's access).

That being said, prioritizing scanning a certain type of memory is
then hard (if not impossible).
Because the in-kernel background thread design sees all memory the
same type, physical memory, to make things simple.

The alternative is we assume there is a caller to drive the scanner.
This caller can be either userspace or kernel space (our RFC chooses userspace).
Then the caller can prioritize or only scan a certain type of memory,
but caller has to secure the memory regions before passing to scanner.

The "How to Scan" section in RFC has more details. Please do share
your opinion/preference for the two designs.


  reply	other threads:[~2022-11-10 20:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 15:50 [RFC] Kernel Support of Memory Error Detection Jiaqi Yan
2022-11-03 16:27 ` Luck, Tony
2022-11-03 16:40   ` Nadav Amit
2022-11-08  2:24     ` Jiaqi Yan
2022-11-08 16:17       ` Luck, Tony
2022-11-09  5:04         ` HORIGUCHI NAOYA(堀口 直也)
2022-11-10 20:23           ` Jiaqi Yan
2022-11-18  1:19           ` Jiaqi Yan
2022-11-18 14:38             ` Sridharan, Vilas
2022-11-18 17:10               ` Luck, Tony
2022-11-07 16:59 ` Sridharan, Vilas
2022-11-09  5:29 ` HORIGUCHI NAOYA(堀口 直也)
2022-11-09 16:15   ` Luck, Tony
2022-11-10 20:25     ` Jiaqi Yan [this message]
2022-11-10 20:23   ` Jiaqi Yan
2022-11-30  5:31 ` David Rientjes
2022-12-13  9:27   ` HORIGUCHI NAOYA(堀口 直也)
2022-12-13 18:09     ` Luck, Tony
2022-12-13 19:03       ` Jiaqi Yan
2022-12-14 14:45         ` Yazen Ghannam

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=CACw3F527uDU3t6S_buRhCRsPFrabKCumF2H_5Jp_WzBTVVD8qQ@mail.gmail.com \
    --to=jiaqiyan@google.com \
    --cc=Vilas.Sridharan@amd.com \
    --cc=Yazen.Ghannam@amd.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@redhat.com \
    --cc=duenwen@google.com \
    --cc=erdemaktas@google.com \
    --cc=gthelen@google.com \
    --cc=jthoughton@google.com \
    --cc=linux-mm@kvack.org \
    --cc=mike.malvestuto@intel.com \
    --cc=naoya.horiguchi@nec.com \
    --cc=pgonda@google.com \
    --cc=rientjes@google.com \
    --cc=seanjc@google.com \
    --cc=tony.luck@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.