Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2331816rwd; Sun, 21 May 2023 18:50:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5H3OJPxmu+raY5iAuTOM6L1GukLf0LDx4J+/9Zc0hdmGfdTrIzJIWOprd2binL3kMl3HB4 X-Received: by 2002:a17:902:c944:b0:1ae:66cf:b90f with SMTP id i4-20020a170902c94400b001ae66cfb90fmr11751911pla.66.1684720208623; Sun, 21 May 2023 18:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684720208; cv=none; d=google.com; s=arc-20160816; b=04ViEq43CIg0dEKtPJ6vpmNOeyXkG9U1Rn/SlwDg4JnkmKcxuQMKyn/RtFtn3XvChF 4ZP6APAsmW6RFXXwHj+CZMA62fwdmRjRi6S6sEwnauZlolHdP9MvBjhhBzBumSwayP2i Mn8dIZyjQ16YeZ2Mem/PkMvWwe4QCsV0cLbDhHbwsSi1j1CiDzGGU1ifCeKa2FBwz6+L OyW4dXBDh9HWlubU2xXPy1s/dJbO7RZiKB5nSyNDh8plKwoFt4zwTdx257f9rJTZbGuN KwbiMXyfCrf8UGOqKDhvYlsTPH5LR3mN/e5TsaQIDRJq3AInqctKJPIUg9df2xamZ1Ly DhBA== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=ai2wuByr++Z/Up7fMpyNB1VFMgULX50f1dSZZazF4hM=; b=mezEUX6RRvQGnIi9K83GUVWIcT9AVsiImr9GhJjCjRrs+zmuxSJjWdsq2G6BY38wX0 thrBatXHS0poAJ5noV4DIfvgfZRmTy1e2ANun9RNwdURtkkZpKuWoBGHADuuCjvITvwc KEVDTmhi+tiNA1m4IXdcO1dHBtxNTfXuFXtoXfZmQpcaMxvevy65OoOjJI0r3ZLNmldF Z1RGoJN9ONdzkIm15ZiQ7ytGwRMOoYs0mmRJpCMNO7zITmnwZgWkUkUWuTvOgskuSWW4 NqLqq09AtV/IKaN1WU/WYTJI+3TxmqHgyCIjB+IEF2vSVovvwNAO8cafROIFUFx1kGKZ V5fA== 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 ju2-20020a170903428200b001ac61add6c0si640116plb.401.2023.05.21.18.49.55; Sun, 21 May 2023 18:50:07 -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 S230163AbjEVB04 (ORCPT + 99 others); Sun, 21 May 2023 21:26:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbjEVB0z (ORCPT ); Sun, 21 May 2023 21:26:55 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37991C1; Sun, 21 May 2023 18:26:54 -0700 (PDT) Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QPfs215rWzLmGq; Mon, 22 May 2023 09:25:26 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 22 May 2023 09:26:51 +0800 Message-ID: <75d8452c-695b-b22a-30d0-15302cd072ef@huawei.com> Date: Mon, 22 May 2023 09:26:50 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [PATCH] x86/mce: set MCE_IN_KERNEL_COPYIN for all MC-Safe Copy Content-Language: en-US To: "Luck, Tony" , Borislav Petkov , Naoya Horiguchi CC: Thomas Gleixner , Ingo Molnar , Dave Hansen , "x86@kernel.org" , Andrew Morton , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "chu, jane" References: <20230508022233.13890-1-wangkefeng.wang@huawei.com> From: Kefeng Wang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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/5/20 0:17, Luck, Tony wrote: >> For now, the MCE_IN_KERNEL_COPYIN flag is only set for EX_TYPE_COPY >> and EX_TYPE_UACCESS when copy from user, and corrupted page is >> isolated in this case, for MC-safe copy, memory_failure() is not >> always called, some places, like __wp_page_copy_user, copy_subpage, >> copy_user_gigantic_page and ksm_might_need_to_copy manually call >> memory_failure_queue() to cope with such unhandled error pages, >> recently coredump hwposion recovery support[1] is asked to do the >> same thing, and there are some other already existed MC-safe copy >> scenarios, eg, nvdimm, dm-writecache, dax, which has similar issue. >> >> The best way to fix them is set MCE_IN_KERNEL_COPYIN to MCE_SAFE >> exception, then kill_me_never() will be queued to call memory_failure() >> in do_machine_check() to isolate corrupted page, which avoid calling >> memory_failure_queue() after every MC-safe copy return. >> >> [1] https://lkml.kernel.org/r/20230417045323.11054-1-wangkefeng.wang@huawei.com > > Is this patch in addition to, or instead of, the earlier core dump patch? This is an addition, in previous coredump patch, manually call memory_failure_queue() to be asked to cope with corrupted page, and it is similar to your "Copy-on-write poison recovery"[1], but after some discussion, I think we could add MCE_IN_KERNEL_COPYIN to all MC-safe copy, which will cope with corrupted page in the core do_machine_check() instead of do it one-by-one. The related patch is normal page CoW [1] huge page CoW [2] coredump [3] ksm might copy [4] [1] d302c2398ba2 ("mm, hwpoison: when copy-on-write hits poison, take page offline") a873dfe1032a ("mm, hwpoison: try to recover from copy-on write faults") [2] 1cb9dc4b475c ("mm: hwpoison: support recovery from HugePage copy-on-write faults") [3] 245f09226893 ("mm: hwpoison: coredump: support recovery from dump_user_range()") [4] 6b970599e807 ("mm: hwpoison: support recovery from ksm_might_need_to_copy()") All of them are in v6.4-rc1. Thanks. Kefeng > > I'd like to run some tests. Can you point me a the precise set of patches > that I should apply please? > > -Tony >