Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1772999rwl; Wed, 12 Apr 2023 18:58:54 -0700 (PDT) X-Google-Smtp-Source: AKy350ZcwEWQzgIWAM4QUMklctGozwtBo86ZH3b81Nb+/0Bm5z0hZqCTgKx9IWzu/vJgJ/dI5CBI X-Received: by 2002:aa7:c90e:0:b0:4fa:785d:121 with SMTP id b14-20020aa7c90e000000b004fa785d0121mr176582edt.16.1681351133969; Wed, 12 Apr 2023 18:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681351133; cv=none; d=google.com; s=arc-20160816; b=hHajVV0R8rUj5OmvLN3iDYimOQk0+GKOBv9Gyd0v3RVXRM6e6mLD6Le7gNP2a0/bDX MSvG42IOeMrLFU+WHDbQyXZyne42nPleu0LPAHej3GqE9qSXSwRKttRD2IUuAnDL4C5t U+15r4QcbGY6pZflOKvHGkziq9pZGxdfUUQw1IICnCMGqPF/1g+AhVq9aZQBQQjubjv8 /oue48IXJ9XrmKIP+UoPDN6Nv38lv9BZfC6jquXS6UTNJEAljyGkPmTNS2Dr/GLBgs/6 wtGho1N2Z5LCs0dF086fK2DfuFnwUlneiS95mOJH1dnvRm+03dAuFQujCDdqwP5OuKoR kwQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=0NJzBWo/yQy2TDQOUQwKSpMSX3CnjBsGyHMqKB4PQ7U=; b=g83oZxZEYgLHBsdqjjt5gHTxXFVNRscqPTG2ICNv1fEmMaoNm48cZgZVEvnyuVNahG IyQDAYbOtSi550ca1+HUFbeSnYS5cId+hCMCJblXIhYP30VE/yQMLKk1Hk7K7JC8eHWf OyJ4P1h/jShT0gHsDLpu32X14GV2ulJIev+djoSinjWUES1vyKv9I6BPHURYZhJnjBpz L1XKzrgQRbQDo7F2tjWny+89tkVSzZhOkdtNESp1K3FdSKieJiWTQyg1UCZ8ipdlDS4e PK6M5Jj0C1g2uxtBG1UEAW5yy0qzAunszlzzs7ZNSKjJYFas3r8yEHC7PE4Bhy0G0ETR kBTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gk14-20020a17090790ce00b00947d844d9d0si408568ejb.969.2023.04.12.18.58.29; Wed, 12 Apr 2023 18:58:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229807AbjDMBvw (ORCPT + 99 others); Wed, 12 Apr 2023 21:51:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229722AbjDMBvt (ORCPT ); Wed, 12 Apr 2023 21:51:49 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 521FB7281 for ; Wed, 12 Apr 2023 18:51:48 -0700 (PDT) Received: from dggpemm100009.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4PxjGY0KpjzDsgD; Thu, 13 Apr 2023 09:51:01 +0800 (CST) Received: from [10.174.179.24] (10.174.179.24) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 13 Apr 2023 09:51:45 +0800 Subject: Re: [PATCH -next] mm: hwpoison: support recovery from HugePage copy-on-write faults To: Mike Kravetz , Andrew Morton References: <20230411092741.780679-1-liushixin2@huawei.com> <20230412181350.GA22818@monkey> <20230412145718.0bcb7dd98112a3010711ad0b@linux-foundation.org> <20230412222138.GB4759@monkey> CC: Naoya Horiguchi , Tony Luck , Miaohe Lin , Muchun Song , , From: Liu Shixin Message-ID: <6a5f3acb-bbc5-9e36-e194-84ec15b059b5@huawei.com> Date: Thu, 13 Apr 2023 09:51:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20230412222138.GB4759@monkey> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.24] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/4/13 6:21, Mike Kravetz wrote: > On 04/12/23 14:57, Andrew Morton wrote: >> On Wed, 12 Apr 2023 11:13:50 -0700 Mike Kravetz wrote: >> >>> On 04/11/23 17:27, Liu Shixin wrote: >>>> Patch a873dfe1032a ("mm, hwpoison: try to recover from copy-on write faults") >>>> introduced a new copy_user_highpage_mc() function, and fix the kernel crash >>>> when the kernel is copying a normal page as the result of a copy-on-write >>>> fault and runs into an uncorrectable error. But it doesn't work for HugeTLB. >>> Andrew asked about user-visible effects. Perhaps, a better way of >>> stating this in the commit message might be: >>> >>> Commit a873dfe1032a ("mm, hwpoison: try to recover from copy-on write >>> faults") introduced the routine copy_user_highpage_mc() to gracefully >>> handle copying of user pages with uncorrectable errors. Previously, >>> such copies would result in a kernel crash. hugetlb has separate code >>> paths for copy-on-write and does not benefit from the changes made in >>> commit a873dfe1032a. > I was just going to suggest adding the line, > > Hence, copy-on-write of hugetlb user pages with uncorrectable errors > will result in a kernel crash as was the case with 'normal' pages before > commit a873dfe1032a. > > However, I'm guessing it might be more clear if we start with the > runtime effects. Something like: > > copy-on-write of hugetlb user pages with uncorrectable errors will result > in a kernel crash. This is because the copy is performed in kernel mode > and in general we can not handle accessing memory with such errors while > in kernel mode. Commit a873dfe1032a ("mm, hwpoison: try to recover from > copy-on write faults") introduced the routine copy_user_highpage_mc() to > gracefully handle copying of user pages with uncorrectable errors. However, > the separate hugetlb copy-on-write code paths were not modified as part > of commit a873dfe1032a. Thanks for your advice, I will add these explaination. > >>> Modify hugetlb copy-on-write code paths to use copy_mc_user_highpage() >>> so that they can also gracefully handle uncorrectable errors in user >>> pages. This involves changing the hugetlb specific routine >>> ?copy_user_folio()? from type void to int so that it can return an error. >>> Modify the hugetlb userfaultfd code in the same way so that it can return >>> -EHWPOISON if it encounters an uncorrectable error. >> Thanks, but... what are the runtime effects? What does hugetlb >> presently do when encountering these uncorrectable error?