From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5933C43334 for ; Wed, 15 Jun 2022 08:21:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D29C6B0071; Wed, 15 Jun 2022 04:21:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 282846B0072; Wed, 15 Jun 2022 04:21:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1233D6B0073; Wed, 15 Jun 2022 04:21:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 023776B0071 for ; Wed, 15 Jun 2022 04:21:13 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id D391C120178 for ; Wed, 15 Jun 2022 08:21:13 +0000 (UTC) X-FDA: 79579775226.02.72945FE Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf22.hostedemail.com (Postfix) with ESMTP id 73CCFC009D for ; Wed, 15 Jun 2022 08:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655281273; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=81h1Uc0DDfOP7V1sbgrcsSnTyG++26Urw3Gv8Z70W2M=; b=BZn0bu4VBF5HRzQW9DW+x5ZLq5K6guFcnml3t2hOvfb+yO6hgn8uYoKLh+nDwBK1MwYE1h lWB8+8QlffRvapTrVEPA1mF39/YkCspUbGmDK5EqC/AoLBPXVIvA3mUETnkK7BIzZpZBhw nSFFSoTo++qCiZb93EWilSCJXLpoe18= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-29-qwjmi6K9PgKag6URRy1a0w-1; Wed, 15 Jun 2022 04:21:11 -0400 X-MC-Unique: qwjmi6K9PgKag6URRy1a0w-1 Received: by mail-wm1-f69.google.com with SMTP id j31-20020a05600c1c1f00b0039c481c4664so4784696wms.7 for ; Wed, 15 Jun 2022 01:21:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=81h1Uc0DDfOP7V1sbgrcsSnTyG++26Urw3Gv8Z70W2M=; b=T4R2B78vWIaIv+oIeJIfRQY60nc47yeHvPgc+Qol1UJckgCJ5bywz3dkcS/yu0kulP pthiJmxbOeh9n3UAGqu4kpEjbtVVLhaEEsv+/6aqbibm3+cjpGlUSN0ibuJPTFOnwjwa tqm1ynhZ82bm/VOH0jGJ8NcTHRm83kSbUQ9mK6qGTE569U+X2EHR+eE45BPZlBSGOVv4 b9jzUE+J8pbTzGfzH7tpn4xWV+jNsbbfCtveoi/HFql3yKRkjqnOzyY+/xR4eYRo6GJB 0BFrrm512/Pod8cvWl0t98JWNTSGNiAg3lsDTjciLgHJfJ7UdTL8M4GlowFbkZrfZQ+h i7JA== X-Gm-Message-State: AOAM533QJQtp7CNyjsOK0iObR13zQgvSJhATS8AV9ehTzJ//eyHCip/z P9pmjsp7n3Yy2s1V0YWVpG7997XjOdQAgE3fuq1mH27zJuh7XCJN+3smhuUD5ytTenyPzm99hRk ub7zOCgWvTfc= X-Received: by 2002:a7b:c1d4:0:b0:39c:4176:6a16 with SMTP id a20-20020a7bc1d4000000b0039c41766a16mr8620507wmj.8.1655281270585; Wed, 15 Jun 2022 01:21:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiAHKZyyHKCcb/92H2dDkxhfvHYpAh2o2kpsFcIcKAsR4XkO0uaAo1YCVuBIicAlN7G2glFQ== X-Received: by 2002:a7b:c1d4:0:b0:39c:4176:6a16 with SMTP id a20-20020a7bc1d4000000b0039c41766a16mr8620483wmj.8.1655281270305; Wed, 15 Jun 2022 01:21:10 -0700 (PDT) Received: from ?IPV6:2003:cb:c70a:2700:1d28:26c3:b272:fcc6? (p200300cbc70a27001d2826c3b272fcc6.dip0.t-ipconnect.de. [2003:cb:c70a:2700:1d28:26c3:b272:fcc6]) by smtp.gmail.com with ESMTPSA id m5-20020a056000008500b00213d75491b0sm13817986wrx.48.2022.06.15.01.21.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Jun 2022 01:21:09 -0700 (PDT) Message-ID: <425e44e9-6ec3-9a87-3441-78881f561a06@redhat.com> Date: Wed, 15 Jun 2022 10:21:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v5 1/1] mm/memory-failure: disable unpoison once hw error happens To: =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , zhenwei pi Cc: "akpm@linux-foundation.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "linmiaohe@huawei.com" , "gregkh@linuxfoundation.org" References: <20220615020005.246295-1-pizhenwei@bytedance.com> <20220615020005.246295-2-pizhenwei@bytedance.com> <20220615081521.GB1663556@hori.linux.bs1.fc.nec.co.jp> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220615081521.GB1663556@hori.linux.bs1.fc.nec.co.jp> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BZn0bu4V; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf22.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655281273; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=81h1Uc0DDfOP7V1sbgrcsSnTyG++26Urw3Gv8Z70W2M=; b=yQKbRU9xOPNjWXrN7TtZBCubfi3VCkIEIo9VimNowl2B2hBi7FCLZrAhchl/BEaCpRkgT+ cl/ybmbb1OBWPaA7fTniTCY8y9dBtCl/K+NsUa1d3Lrw2L0ZgxOAPhUC+NDA0xD8E2tH9N 4dt7qIezBrKhNBfyuNeOxjX4YC6nynE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655281273; a=rsa-sha256; cv=none; b=gTUlWb1nGSjVqehkp13yVeap/1ApQ1Z78ADXeo8pEQDEXTUSVtrbTCDi5hV4jNOp9dNlBr tAYCqiNKtgLwBHv8/2VwRugusM1xhIMP8anApTTcV/tpywRBP4U9fHstzGw9BU/rF6vboM rT0YbHG7S+4gEKMSJkiaaop8+hPOJjs= X-Stat-Signature: mfbsmw3dgnbaj4yu5p4pby6dbhznr8q6 X-Rspamd-Queue-Id: 73CCFC009D X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BZn0bu4V; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf22.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com X-Rspamd-Server: rspam10 X-HE-Tag: 1655281273-21291 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 15.06.22 10:15, HORIGUCHI NAOYA(堀口 直也) wrote: > On Wed, Jun 15, 2022 at 10:00:05AM +0800, zhenwei pi wrote: >> Currently unpoison_memory(unsigned long pfn) is designed for soft >> poison(hwpoison-inject) only. Since 17fae1294ad9d, the KPTE gets >> cleared on a x86 platform once hardware memory corrupts. >> >> Unpoisoning a hardware corrupted page puts page back buddy only, >> the kernel has a chance to access the page with *NOT PRESENT* KPTE. >> This leads BUG during accessing on the corrupted KPTE. >> >> Suggested by David&Naoya, disable unpoison mechanism when a real HW error >> happens to avoid BUG like this: > ... > >> >> Fixes: 847ce401df392 ("HWPOISON: Add unpoisoning support") >> Fixes: 17fae1294ad9d ("x86/{mce,mm}: Unmap the entire page if the whole page is affected and poisoned") >> Cc: Naoya Horiguchi >> Cc: David Hildenbrand >> Signed-off-by: zhenwei pi > > Cc to stable? > I think that the current approach seems predictable to me than earlier versions, > so I can agree with sending this to stable a little more confidently. > >> --- >> Documentation/vm/hwpoison.rst | 3 ++- >> drivers/base/memory.c | 2 +- >> include/linux/mm.h | 1 + >> mm/hwpoison-inject.c | 2 +- >> mm/madvise.c | 2 +- >> mm/memory-failure.c | 12 ++++++++++++ >> 6 files changed, 18 insertions(+), 4 deletions(-) >> > > ... > >> diff --git a/mm/memory-failure.c b/mm/memory-failure.c >> index b85661cbdc4a..385b5e99bfc1 100644 >> --- a/mm/memory-failure.c >> +++ b/mm/memory-failure.c >> @@ -69,6 +69,8 @@ int sysctl_memory_failure_recovery __read_mostly = 1; >> >> atomic_long_t num_poisoned_pages __read_mostly = ATOMIC_LONG_INIT(0); >> >> +static bool hw_memory_failure; > > Could you set the initial value explicitly? Using a default value is good, > but doing as the surrounding code do is better for consistency. And this > variable can be updated only once, so adding __read_mostly macro is also fine. No strong opinion. __read_mostly makes sense, but I assume we don't really care about performance that much when dealing with HW errors. With or without changes around this initialization Acked-by: David Hildenbrand -- Thanks, David / dhildenb