Received: by 10.223.176.5 with SMTP id f5csp636394wra; Tue, 30 Jan 2018 16:59:10 -0800 (PST) X-Google-Smtp-Source: AH8x224YyAqaQFekB9wTXyFhC4Khw3G7GbJxNYaG3FtpyOYHxI/1GaMgyZXRXZq1k7gGnXriHDqA X-Received: by 10.98.24.22 with SMTP id 22mr32434674pfy.65.1517360350038; Tue, 30 Jan 2018 16:59:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517360350; cv=none; d=google.com; s=arc-20160816; b=XO0u+P5eIbc+zYS3GmPGDloEdLH4OSuRo8oqH4hrwM8D8PQSvs5h7WCgpzPOjb4rPs c/I6wxp+JL1Jldd1tEgfYkVsdxV/924YjBH/pAHRhzdCF+/iPWxF2iBw759fSzpXxlXG fOQMZTeibLtAH5aqQFevJJ9bQkJeL4uffUyAgUoT2gTrTYkdDZnFVnP4V15H1AaJmtKA BncyAV+joSbNTORXuPf5himA+fSOiTaITbDYdbH9+nMwDl2V7PnvFGkRUvI5wuMV/28c zK36g2PTqBrSvFDOZdC+skrvjuzW3ZJ/nuLwCHvi1x7iVWQv6oAQ/rW8pZN/KRF6+9J6 Ucew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=Xu4u3R+UGEq2f+7Kt8MY8Q0Yy2NKlQIyeCQOuHsmvTg=; b=PLtx5NsbL5LVgF5YGp433bxEhlYl+eOpsghzW7Fkoc2b/mFefPWz2UZ2/2YRF1c5gf KwAT7ErJ3lL8WMt8PevUJyNyItIElKgJg2qv6ZjH+zBq0dIEYB0vhtBErCeji0a0REw7 nbFw7A5iQd8rq+AsatvfQlbvqERCjynC6mHUdBVyXrNIRKVbF5m3XxaFH87b13bhyfaX rFmbYwdsrcSVBx9UBsuae5/4YoVaGrirFB8ZbexiO/GeMO5fp1rD25aKaeb5RkH4pKkb 5NsvUlYvkHBOu9EesDOwGc1LUhvdUkTnKecWUcFRnzU4W4aYzdX5yuEy8I3Ceaz9yocB zmGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=BNHr4X7K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b89-v6si750948plb.49.2018.01.30.16.58.55; Tue, 30 Jan 2018 16:59:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=BNHr4X7K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754202AbeA3X7y (ORCPT + 99 others); Tue, 30 Jan 2018 18:59:54 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:45850 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753315AbeA3X7w (ORCPT ); Tue, 30 Jan 2018 18:59:52 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w0UNxhPE104125; Tue, 30 Jan 2018 23:59:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=Xu4u3R+UGEq2f+7Kt8MY8Q0Yy2NKlQIyeCQOuHsmvTg=; b=BNHr4X7KahCONrzwNmPWYxI8PuFhI04zr2c0gTwSI+4h6DnIkzHUDS+emOFONKWMtzIS w8DBQ6UCvKvLXagHPfk6VkSwoa9kvPjS1OU4RBUiEm/fQOZx7hM0rLnj0H8d65yx2teS xj4lVkneTvR3dxIPbnyhU+kFVxkt/WuP0BHZUKFqoKoeTKf9xD+0kvX+/WnRrkINqLzb ywNw4nWX0s8+MOa6EXj5KrLpasbiIRHeUd21LUOEeyW0Oj+rUv5z86eM4VL6B+Cug/Am 26DyINdHwWCp5ZgdfnZaJpL45IDsy3S+9G6Wx2ioaJSQNU2D3kIwFgCGVYYJkA6rCJ7u fg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2fu11frfee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 30 Jan 2018 23:59:43 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w0UNuela009133 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 30 Jan 2018 23:56:40 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w0UNudOd020171; Tue, 30 Jan 2018 23:56:39 GMT Received: from [192.168.1.164] (/98.246.252.205) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 30 Jan 2018 15:56:39 -0800 Subject: Re: [PATCH v2] mm: hwpoison: disable memory error handling on 1GB hugepage To: Naoya Horiguchi , linux-mm@kvack.org Cc: Andrew Morton , Michal Hocko , "Aneesh Kumar K.V" , Anshuman Khandual , linux-kernel@vger.kernel.org References: <20180130013919.GA19959@hori1.linux.bs1.fc.nec.co.jp> <1517284444-18149-1-git-send-email-n-horiguchi@ah.jp.nec.com> From: Mike Kravetz Message-ID: <82efe26e-e217-6124-0d88-d4f25d12386d@oracle.com> Date: Tue, 30 Jan 2018 15:56:37 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <1517284444-18149-1-git-send-email-n-horiguchi@ah.jp.nec.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8790 signatures=668657 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801300293 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/29/2018 07:54 PM, Naoya Horiguchi wrote: > Recently the following BUG was reported: > > Injecting memory failure for pfn 0x3c0000 at process virtual address 0x7fe300000000 > Memory failure: 0x3c0000: recovery action for huge page: Recovered > BUG: unable to handle kernel paging request at ffff8dfcc0003000 > IP: gup_pgd_range+0x1f0/0xc20 > PGD 17ae72067 P4D 17ae72067 PUD 0 > Oops: 0000 [#1] SMP PTI > ... > CPU: 3 PID: 5467 Comm: hugetlb_1gb Not tainted 4.15.0-rc8-mm1-abc+ #3 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.3-1.fc25 04/01/2014 > > You can easily reproduce this by calling madvise(MADV_HWPOISON) twice on > a 1GB hugepage. This happens because get_user_pages_fast() is not aware > of a migration entry on pud that was created in the 1st madvise() event. > > I think that conversion to pud-aligned migration entry is working, > but other MM code walking over page table isn't prepared for it. > We need some time and effort to make all this work properly, so > this patch avoids the reported bug by just disabling error handling > for 1GB hugepage. > > Signed-off-by: Naoya Horiguchi > Acked-by: Michal Hocko // for v1 > Cc: > --- > ChangeLog v1 -> v2: > - add comment about what we need to support hwpoision for pud-sized hugetlb > - use "page size > PMD_SIZE" condition instead of hstate_is_gigantic() > --- > include/linux/mm.h | 1 + > mm/memory-failure.c | 16 ++++++++++++++++ > 2 files changed, 17 insertions(+) > > diff --git v4.15-rc8-mmotm-2018-01-18-16-31/include/linux/mm.h v4.15-rc8-mmotm-2018-01-18-16-31_patched/include/linux/mm.h > index 63f7ba1..6b3df81 100644 > --- v4.15-rc8-mmotm-2018-01-18-16-31/include/linux/mm.h > +++ v4.15-rc8-mmotm-2018-01-18-16-31_patched/include/linux/mm.h > @@ -2607,6 +2607,7 @@ enum mf_action_page_type { > MF_MSG_POISONED_HUGE, > MF_MSG_HUGE, > MF_MSG_FREE_HUGE, > + MF_MSG_NON_PMD_HUGE, > MF_MSG_UNMAP_FAILED, > MF_MSG_DIRTY_SWAPCACHE, > MF_MSG_CLEAN_SWAPCACHE, > diff --git v4.15-rc8-mmotm-2018-01-18-16-31/mm/memory-failure.c v4.15-rc8-mmotm-2018-01-18-16-31_patched/mm/memory-failure.c > index d530ac1..264e020 100644 > --- v4.15-rc8-mmotm-2018-01-18-16-31/mm/memory-failure.c > +++ v4.15-rc8-mmotm-2018-01-18-16-31_patched/mm/memory-failure.c > @@ -508,6 +508,7 @@ static const char * const action_page_types[] = { > [MF_MSG_POISONED_HUGE] = "huge page already hardware poisoned", > [MF_MSG_HUGE] = "huge page", > [MF_MSG_FREE_HUGE] = "free huge page", > + [MF_MSG_NON_PMD_HUGE] = "non-pmd-sized huge page", > [MF_MSG_UNMAP_FAILED] = "unmapping failed page", > [MF_MSG_DIRTY_SWAPCACHE] = "dirty swapcache page", > [MF_MSG_CLEAN_SWAPCACHE] = "clean swapcache page", > @@ -1090,6 +1091,21 @@ static int memory_failure_hugetlb(unsigned long pfn, int trapno, int flags) > return 0; > } > > + /* > + * TODO: hwpoison for pud-sized hugetlb doesn't work right now, so > + * simply disable it. In order to make it work properly, we need > + * make sure that: > + * - conversion of a pud that maps an error hugetlb into hwpoison > + * entry properly works, and > + * - other mm code walking over page table is aware of pud-aligned > + * hwpoison entries. > + */ > + if (huge_page_size(page_hstate(head)) > PMD_SIZE) { > + action_result(pfn, MF_MSG_NON_PMD_HUGE, MF_IGNORED); > + res = -EBUSY; > + goto out; > + } > + > if (!hwpoison_user_mappings(p, pfn, trapno, flags, &head)) { > action_result(pfn, MF_MSG_UNMAP_FAILED, MF_IGNORED); > res = -EBUSY; > Thanks, that does catch all those other huge page sizes. Reviewed-by: Mike Kravetz It would really be helpful to get some comments from the powerpc folks as this does seem to impact them most. Perhaps arm64 as well? -- Mike Kravetz