From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 1/2] mm, Make __get_user_pages return -EHWPOISON for HWPOISON page optionally Date: Sun, 16 Jan 2011 17:35:48 +0200 Message-ID: <4D331054.4030206@redhat.com> References: <1294908168.4596.58.camel@yhuang-dev> <4D2ED737.6050802@redhat.com> <1294969036.4596.67.camel@yhuang-dev> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , Andi Kleen , "Luck, Tony" , Dean Nelson , Andrew Morton To: Huang Ying Return-path: Received: from mx1.redhat.com ([209.132.183.28]:2792 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753061Ab1APPgK (ORCPT ); Sun, 16 Jan 2011 10:36:10 -0500 In-Reply-To: <1294969036.4596.67.camel@yhuang-dev> Sender: kvm-owner@vger.kernel.org List-ID: On 01/14/2011 03:37 AM, Huang Ying wrote: > On Thu, 2011-01-13 at 18:43 +0800, Avi Kivity wrote: > > On 01/13/2011 10:42 AM, Huang Ying wrote: > > > Make __get_user_pages return -EHWPOISON for HWPOISON page only if > > > FOLL_HWPOISON is specified. With this patch, the interested callers > > > can distinguish HWPOISON page from general FAULT page, while other > > > callers will still get -EFAULT for pages, so the user space interface > > > need not to be changed. > > > > > > get_user_pages_hwpoison is added as a variant of get_user_pages that > > > can return -EHWPOISON for HWPOISON page. > > > > > > This feature is needed by KVM, where UCR MCE should be relayed to > > > guest for HWPOISON page, while instruction emulation and MMIO will be > > > tried for general FAULT page. > > > > > > The idea comes from Andrew Morton. > > > > > > Signed-off-by: Huang Ying > > > Cc: Andrew Morton > > > > > > +#ifdef CONFIG_MEMORY_FAILURE > > > +int get_user_pages_hwpoison(struct task_struct *tsk, struct mm_struct *mm, > > > + unsigned long start, int nr_pages, int write, > > > + int force, struct page **pages, > > > + struct vm_area_struct **vmas); > > > +#else > > > > Since we'd also like to add get_user_pages_noio(), perhaps adding a > > flags field to get_user_pages() is better. > > Or export __get_user_pages()? That's better, yes. -- error compiling committee.c: too many arguments to function