Message ID | 20221031201029.102123-3-tony.luck@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Copy-on-write poison recovery | expand |
Hi, Tony, Greg, Does it make sense to include this patch series in the 5.15.y LTS kernel? I just checked: it's not in 5.15.112. Thanks! -jane On 10/31/2022 1:10 PM, Tony Luck wrote: > Cannot call memory_failure() directly from the fault handler because > mmap_lock (and others) are held. > > It is important, but not urgent, to mark the source page as h/w poisoned > and unmap it from other tasks. > > Use memory_failure_queue() to request a call to memory_failure() for the > page with the error. > > Also provide a stub version for CONFIG_MEMORY_FAILURE=n > > Reviewed-by: Miaohe Lin <linmiaohe@huawei.com> > Tested-by: Shuai Xue <xueshuai@linux.alibaba.com> > Signed-off-by: Tony Luck <tony.luck@intel.com> > Message-Id: <20221021200120.175753-3-tony.luck@intel.com> > Signed-off-by: Tony Luck <tony.luck@intel.com> > --- > include/linux/mm.h | 5 ++++- > mm/memory.c | 4 +++- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 8bbcccbc5565..03ced659eb58 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -3268,7 +3268,6 @@ enum mf_flags { > int mf_dax_kill_procs(struct address_space *mapping, pgoff_t index, > unsigned long count, int mf_flags); > extern int memory_failure(unsigned long pfn, int flags); > -extern void memory_failure_queue(unsigned long pfn, int flags); > extern void memory_failure_queue_kick(int cpu); > extern int unpoison_memory(unsigned long pfn); > extern int sysctl_memory_failure_early_kill; > @@ -3277,8 +3276,12 @@ extern void shake_page(struct page *p); > extern atomic_long_t num_poisoned_pages __read_mostly; > extern int soft_offline_page(unsigned long pfn, int flags); > #ifdef CONFIG_MEMORY_FAILURE > +extern void memory_failure_queue(unsigned long pfn, int flags); > extern int __get_huge_page_for_hwpoison(unsigned long pfn, int flags); > #else > +static inline void memory_failure_queue(unsigned long pfn, int flags) > +{ > +} > static inline int __get_huge_page_for_hwpoison(unsigned long pfn, int flags) > { > return 0; > diff --git a/mm/memory.c b/mm/memory.c > index b6056eef2f72..eae242351726 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -2866,8 +2866,10 @@ static inline int __wp_page_copy_user(struct page *dst, struct page *src, > unsigned long addr = vmf->address; > > if (likely(src)) { > - if (copy_mc_user_highpage(dst, src, addr, vma)) > + if (copy_mc_user_highpage(dst, src, addr, vma)) { > + memory_failure_queue(page_to_pfn(src), 0); > return -EHWPOISON; > + } > return 0; > } >
Jane, You should do some analysis and testing to make sure that applying just this patch to 5.15.y works. There has been a bunch of recovery changes and I'm not sure if this depends on other changes. -Tony -----Original Message----- From: Jane Chu <jane.chu@oracle.com> Sent: Thursday, May 18, 2023 2:50 PM To: Luck, Tony <tony.luck@intel.com>; Andrew Morton <akpm@linux-foundation.org>; Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Alexander Potapenko <glider@google.com>; Naoya Horiguchi <naoya.horiguchi@nec.com>; Miaohe Lin <linmiaohe@huawei.com>; Matthew Wilcox <willy@infradead.org>; Shuai Xue <xueshuai@linux.alibaba.com>; Williams, Dan J <dan.j.williams@intel.com>; linux-mm@kvack.org; linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/2] mm, hwpoison: When copy-on-write hits poison, take page offline Hi, Tony, Greg, Does it make sense to include this patch series in the 5.15.y LTS kernel? I just checked: it's not in 5.15.112. Thanks! -jane On 10/31/2022 1:10 PM, Tony Luck wrote: > Cannot call memory_failure() directly from the fault handler because > mmap_lock (and others) are held. > > It is important, but not urgent, to mark the source page as h/w poisoned > and unmap it from other tasks. > > Use memory_failure_queue() to request a call to memory_failure() for the > page with the error. > > Also provide a stub version for CONFIG_MEMORY_FAILURE=n > > Reviewed-by: Miaohe Lin <linmiaohe@huawei.com> > Tested-by: Shuai Xue <xueshuai@linux.alibaba.com> > Signed-off-by: Tony Luck <tony.luck@intel.com> > Message-Id: <20221021200120.175753-3-tony.luck@intel.com> > Signed-off-by: Tony Luck <tony.luck@intel.com> > --- > include/linux/mm.h | 5 ++++- > mm/memory.c | 4 +++- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 8bbcccbc5565..03ced659eb58 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -3268,7 +3268,6 @@ enum mf_flags { > int mf_dax_kill_procs(struct address_space *mapping, pgoff_t index, > unsigned long count, int mf_flags); > extern int memory_failure(unsigned long pfn, int flags); > -extern void memory_failure_queue(unsigned long pfn, int flags); > extern void memory_failure_queue_kick(int cpu); > extern int unpoison_memory(unsigned long pfn); > extern int sysctl_memory_failure_early_kill; > @@ -3277,8 +3276,12 @@ extern void shake_page(struct page *p); > extern atomic_long_t num_poisoned_pages __read_mostly; > extern int soft_offline_page(unsigned long pfn, int flags); > #ifdef CONFIG_MEMORY_FAILURE > +extern void memory_failure_queue(unsigned long pfn, int flags); > extern int __get_huge_page_for_hwpoison(unsigned long pfn, int flags); > #else > +static inline void memory_failure_queue(unsigned long pfn, int flags) > +{ > +} > static inline int __get_huge_page_for_hwpoison(unsigned long pfn, int flags) > { > return 0; > diff --git a/mm/memory.c b/mm/memory.c > index b6056eef2f72..eae242351726 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -2866,8 +2866,10 @@ static inline int __wp_page_copy_user(struct page *dst, struct page *src, > unsigned long addr = vmf->address; > > if (likely(src)) { > - if (copy_mc_user_highpage(dst, src, addr, vma)) > + if (copy_mc_user_highpage(dst, src, addr, vma)) { > + memory_failure_queue(page_to_pfn(src), 0); > return -EHWPOISON; > + } > return 0; > } >
On Thu, May 18, 2023 at 02:49:44PM -0700, Jane Chu wrote: > Hi, Tony, Greg, > > Does it make sense to include this patch series in the > 5.15.y LTS kernel? I just checked: it's not in 5.15.112. <formletter> This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly. </formletter>
diff --git a/include/linux/mm.h b/include/linux/mm.h index 8bbcccbc5565..03ced659eb58 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3268,7 +3268,6 @@ enum mf_flags { int mf_dax_kill_procs(struct address_space *mapping, pgoff_t index, unsigned long count, int mf_flags); extern int memory_failure(unsigned long pfn, int flags); -extern void memory_failure_queue(unsigned long pfn, int flags); extern void memory_failure_queue_kick(int cpu); extern int unpoison_memory(unsigned long pfn); extern int sysctl_memory_failure_early_kill; @@ -3277,8 +3276,12 @@ extern void shake_page(struct page *p); extern atomic_long_t num_poisoned_pages __read_mostly; extern int soft_offline_page(unsigned long pfn, int flags); #ifdef CONFIG_MEMORY_FAILURE +extern void memory_failure_queue(unsigned long pfn, int flags); extern int __get_huge_page_for_hwpoison(unsigned long pfn, int flags); #else +static inline void memory_failure_queue(unsigned long pfn, int flags) +{ +} static inline int __get_huge_page_for_hwpoison(unsigned long pfn, int flags) { return 0; diff --git a/mm/memory.c b/mm/memory.c index b6056eef2f72..eae242351726 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2866,8 +2866,10 @@ static inline int __wp_page_copy_user(struct page *dst, struct page *src, unsigned long addr = vmf->address; if (likely(src)) { - if (copy_mc_user_highpage(dst, src, addr, vma)) + if (copy_mc_user_highpage(dst, src, addr, vma)) { + memory_failure_queue(page_to_pfn(src), 0); return -EHWPOISON; + } return 0; }