Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp482484ybl; Fri, 10 Jan 2020 01:52:33 -0800 (PST) X-Google-Smtp-Source: APXvYqwKSvhMKTqwIl5Q51tM2fqhR8ONhRCm6YpkFHcntQ22FXNyypMVDDZft5YyD4Qv6wg/lVhw X-Received: by 2002:a05:6830:2102:: with SMTP id i2mr1820636otc.123.1578649953900; Fri, 10 Jan 2020 01:52:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578649953; cv=none; d=google.com; s=arc-20160816; b=SSAxEpinlXmDQBxpWXe1+VyzFG1kasaEsVBEih3+gvtjwkMbA8+TNSQ6cmBdNEI9zW GPZxoscGSY9Ruor5jPuuBhJ07FUUteOtKrXnvrJ1vE1CzyIFcxLsTi3E9GKLu3Frkfn2 URbYQhXXeXj4B+v8GfI8eh2atv9xoXOyHLNqg5LfxMpIn5TfoozqtCz2asd7LW4ufJ3f eNNDVQDzI6jHbNCnuDyB3lpjBmXdqBxX0u+dQe5zwBfr1ipgyB2K1Ms3I5J+74XwHTIv D+V0+OfYSOyByNGV92WgCB82SPTMGtMKvc2RYmHiS/YHHGVuJMNNUTFWZfdU30w1/XZN DqLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mIT8Yx3kSe9Z9owbe2rOIZDAMgeLxHz7eh5yqOrcB8c=; b=BMYLc29Qrnr+xqNr4bvkm2wRQhfZ9zfQabtvBSNbuAMFybeFqhDVudbcGW39Gd/fGV gYTVcZ40o1WRhURfhKhViE74K0Xtu8DzQh7drWnsaoEZyBoxfban5WwwRE3uC9URSJDF Np+dQkP+f4dm1reyqXq6u9TUBdHeE7SG6Ie27FOGtAaaWRIA5wINxhoC+vu3nP/+OVMd eVAz91yaYuEsJfigN/ul2dKXPZCD+Fu5Brso8HYKlkch5MT+iIeNbHKtJ/WtNil9rNx/ TKZ6EVHef3NnhZL+4V7uvNN/o8j8+ziN6e9SgTGyKuytpSq8+Oji4Y6d5AaCzaUfZ5U8 hg7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=qUUU0Wfg; 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=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i17si878922ota.82.2020.01.10.01.52.22; Fri, 10 Jan 2020 01:52:33 -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=@alien8.de header.s=dkim header.b=qUUU0Wfg; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727392AbgAJJuO (ORCPT + 99 others); Fri, 10 Jan 2020 04:50:14 -0500 Received: from mail.skyhub.de ([5.9.137.197]:33464 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727219AbgAJJuO (ORCPT ); Fri, 10 Jan 2020 04:50:14 -0500 Received: from zn.tnic (p200300EC2F0ACA0024F85FB92EE88C9E.dip0.t-ipconnect.de [IPv6:2003:ec:2f0a:ca00:24f8:5fb9:2ee8:8c9e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id B03FC1EC0CAD; Fri, 10 Jan 2020 10:50:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1578649811; 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=mIT8Yx3kSe9Z9owbe2rOIZDAMgeLxHz7eh5yqOrcB8c=; b=qUUU0WfgA+wqfA4yZuR/kqZ2+GUNSzj06F1JaEfPdEfkhMx5cVJv/fsNKW9A2z1Z3/M+Vq C8E/7L2aeciYr41PhPYN0Fq44RdRUcTs6ssmFdJd5i9LEI9azk3zLu2Jbe9y+iSIBgrgfk Y4EL+MxBXyNBWYa++tVpZpdRuxFix90= Date: Fri, 10 Jan 2020 10:50:04 +0100 From: Borislav Petkov To: Jan =?utf-8?Q?H=2E_Sch=C3=B6nherr?= , Yazen Ghannam , Tony Luck Cc: linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org Subject: Re: [PATCH v2 1/6] x86/mce: Take action on UCNA/Deferred errors again Message-ID: <20200110095004.GD19453@zn.tnic> References: <20200103150722.20313-1-jschoenh@amazon.de> <20200103150722.20313-2-jschoenh@amazon.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200103150722.20313-2-jschoenh@amazon.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 03, 2020 at 04:07:17PM +0100, Jan H. Schönherr wrote: > Commit fa92c5869426 ("x86, mce: Support memory error recovery for both > UCNA and Deferred error in machine_check_poll") added handling of UCNA > and Deferred errors by adding them to the ring for SRAO errors. > > Later, commit fd4cf79fcc4b ("x86/mce: Remove the MCE ring for Action > Optional errors") switched storage from the SRAO ring to the unified > pool that is still in use today. In order to only act on the intended > errors, a filter for MCE_AO_SEVERITY is used -- effectively removing > handling of UCNA/Deferred errors again. > > Extend the severity filter to include UCNA/Deferred errors again. > Also, generalize the naming of the notifier from SRAO to UC to capture > the extended scope. > > Note, that this change may cause a message like the following to appear, > as the same address may be reported as SRAO and as UCNA: > > Memory failure: 0x5fe3284: already hardware poisoned > > Technically, this is a return to previous behavior. > > Fixes: fd4cf79fcc4b ("x86/mce: Remove the MCE ring for Action Optional errors") > Signed-off-by: Jan H. Schönherr Tony, ACK? Also, do you want it in stable@ so that it gets backported? > diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c > index 8994fe7751a4..16134ce587fd 100644 > --- a/arch/x86/kernel/cpu/mce/core.c > +++ b/arch/x86/kernel/cpu/mce/core.c > @@ -156,10 +156,8 @@ void mce_log(struct mce *m) > } > EXPORT_SYMBOL_GPL(mce_log); > > -static struct notifier_block mce_srao_nb; > - > /* > - * We run the default notifier if we have only the SRAO, the first and the > + * We run the default notifier if we have only the UC, the first and the > * default notifier registered. I.e., the mandatory NUM_DEFAULT_NOTIFIERS > * notifiers registered on the chain. > */ > @@ -580,26 +578,29 @@ static struct notifier_block first_nb = { > .priority = MCE_PRIO_FIRST, > }; > > -static int srao_decode_notifier(struct notifier_block *nb, unsigned long val, > - void *data) > +static int uc_decode_notifier(struct notifier_block *nb, unsigned long val, > + void *data) > { > struct mce *mce = (struct mce *)data; > unsigned long pfn; > > - if (!mce) > + if (!mce || !mce_usable_address(mce)) > return NOTIFY_DONE; > > - if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) { > - pfn = mce->addr >> PAGE_SHIFT; > - if (!memory_failure(pfn, 0)) > - set_mce_nospec(pfn); > - } > + if (mce->severity != MCE_AO_SEVERITY && > + mce->severity != MCE_DEFERRED_SEVERITY) > + return NOTIFY_DONE; > + > + pfn = mce->addr >> PAGE_SHIFT; > + if (!memory_failure(pfn, 0)) > + set_mce_nospec(pfn); I'm wondering if in the memory_failure error() case, we should hand it down to the remaining notifiers. Which also begs the question in light of this clumsy notifier counting: How about we have the default notifier *unconditionally* print the MCE? I.e., if the error has reached it, it would print it. If not and some other notifier consumed it, it will get handled differently. This way we won't need any special counting of notifiers and special reg/unreg of notifiers etc. IOW, the logic would be: If something consumes the error, then it doesn't get printed. Notifier does NOTIFY_STOP. If nothing consumes it or something looks at it and decides that it should still get printed, then the last catch-all notifier callback does that. Thoughts? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette