linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Luck, Tony" <tony.luck@intel.com>
To: Jiaqi Yan <jiaqiyan@google.com>,
	"kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>,
	"kirill@shutemov.name" <kirill@shutemov.name>,
	"shy828301@gmail.com" <shy828301@gmail.com>,
	"tongtiangen@huawei.com" <tongtiangen@huawei.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Cc: "naoya.horiguchi@nec.com" <naoya.horiguchi@nec.com>,
	"linmiaohe@huawei.com" <linmiaohe@huawei.com>,
	"Wang, Jue" <juew@google.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"osalvador@suse.de" <osalvador@suse.de>
Subject: RE: [PATCH v7 1/2] mm/khugepaged: recover from poisoned anonymous memory
Date: Fri, 18 Nov 2022 16:46:04 +0000	[thread overview]
Message-ID: <SJ1PR11MB6083A2F99BC138061F50BFC8FC099@SJ1PR11MB6083.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20221118013157.1333622-2-jiaqiyan@google.com>

+/*
+ * Machine check exception handled version of copy_highpage.
+ * Return true if copying page content failed; otherwise false.
+ * Note handling #MC requires arch opt-in.
+ */
+static inline bool copy_highpage_mc(struct page *to, struct page *from)
+{
+	char *vfrom, *vto;
+	unsigned long ret;
+
+	vfrom = kmap_local_page(from);
+	vto = kmap_local_page(to);
+	ret = copy_mc_to_kernel(vto, vfrom, PAGE_SIZE);
+	kunmap_local(vto);
+	kunmap_local(vfrom);
+
+	return ret > 0;
+}

Andrew Morton took my patches to recover from copy-on-write faults
into the -mm tree. They are now sitting in linux-next (hopefully) ready
for the next merge window.

I had copied this function from an earlier version of your patch, but
there was a suggestion that copy_mc_user_highpage() would be a
more consistent name with other copy code that can handle machine
checks. There was also an upstream change to copy_highpage()
that needed to be reflected here.

Net result, this version is already in flight:

static inline int copy_mc_user_highpage(struct page *to, struct page *from,
					unsigned long vaddr, struct vm_area_struct *vma)
{
	unsigned long ret;
	char *vfrom, *vto;

	vfrom = kmap_local_page(from);
	vto = kmap_local_page(to);
	ret = copy_mc_to_kernel(vto, vfrom, PAGE_SIZE);
	if (!ret)
		kmsan_unpoison_memory(page_address(to), PAGE_SIZE);
	kunmap_local(vto);
	kunmap_local(vfrom);

	return ret;
}

-Tony

  reply	other threads:[~2022-11-18 16:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-18  1:31 [PATCH v7 0/2] Memory poison recovery in khugepaged collapsing Jiaqi Yan
2022-11-18  1:31 ` [PATCH v7 1/2] mm/khugepaged: recover from poisoned anonymous memory Jiaqi Yan
2022-11-18 16:46   ` Luck, Tony [this message]
2022-11-18 19:38     ` Jiaqi Yan
2022-11-18 22:18       ` Andrew Morton
2022-11-18  1:31 ` [PATCH v7 2/2] mm/khugepaged: recover from poisoned file-backed memory Jiaqi Yan

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=SJ1PR11MB6083A2F99BC138061F50BFC8FC099@SJ1PR11MB6083.namprd11.prod.outlook.com \
    --to=tony.luck@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=jiaqiyan@google.com \
    --cc=juew@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kirill@shutemov.name \
    --cc=linmiaohe@huawei.com \
    --cc=linux-mm@kvack.org \
    --cc=naoya.horiguchi@nec.com \
    --cc=osalvador@suse.de \
    --cc=shy828301@gmail.com \
    --cc=tongtiangen@huawei.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