Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp592432rwj; Fri, 23 Dec 2022 05:45:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXtvfK678xbZhpdKDi8eTuzhwCyoc6fMHtClJPZY+v66tV6dJCKuZL9kI5xMgETNE5xW4Dnw X-Received: by 2002:a17:902:e345:b0:188:dd4c:c315 with SMTP id p5-20020a170902e34500b00188dd4cc315mr9421052plc.45.1671803120995; Fri, 23 Dec 2022 05:45:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671803120; cv=none; d=google.com; s=arc-20160816; b=vCJv7U/Cug4rzewP1BNQ0kiXbRiuvqJj+YdkS7wOmZPhx6wXPDYLOaKi8Ftw1Cb5cY Uzq9ty2aobVa0iIU4jcLXGyjocKPZQs9SLFAx4Y4wQc0CUx47Iovhnjs/OFjmo+TqHfu M9Mmc4rPy0U/Ed6zg5oKFVAUdX6T78j6F+/4ft0Yj+PyjWciQWYzNh9t9NRMK0gGpDjd 5TcsuRKxTiGhumQY7Szuqh/I4150BMbKCm9WV5npE/N7mnA7pn7swWEcK8/0kkk2H7b1 2T05ZgPyBDfNotHEG71LKxxI39p9Zg30iiRVmSAnLvOBNugWiUSdf0WizGcSo3eWc0ZN f0fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=SSvDsZpTjzmrUNmjyZT5I2QHEjJaFSOc5HqeqmJ/KDs=; b=jfgfBs2cTOFard9BNewMbCYFrOe5uIDAcnGQkXAuHhPwe2yAofK199Y6K02KdeX94N +7ppZKF83xSoKOyFd3GyOrizxua4OfC9EaFD4JY28Ac4ut4Ml+l6PSUfC0Aite/Xcd6V x+oaAewxJSARzq2SopV/3822OMhQ7UfLiFXsj3FM/oA5imWUi1YBBi9sBYDo3FZBrB15 SoOUbjdVrCpJcAHS1+goRR290Jxqu8QwB098EKMhCwyHiv+BzrS7S9IIMKf8bLr3lgUC cw6VMPX3gSMibrFxl0UZTFQq0OF/+TdOh4MNgtKLaCFsBkIhJpb7ELFIP+1P5bjqYPwl POcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b="Z0k+/b49"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a170902ac8e00b00188ef2314acsi3297607plr.527.2022.12.23.05.45.11; Fri, 23 Dec 2022 05:45:20 -0800 (PST) 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; dkim=pass header.i=@alien8.de header.s=dkim header.b="Z0k+/b49"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235594AbiLWNX7 (ORCPT + 66 others); Fri, 23 Dec 2022 08:23:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236410AbiLWNXh (ORCPT ); Fri, 23 Dec 2022 08:23:37 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C5234AF22; Fri, 23 Dec 2022 05:23:12 -0800 (PST) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (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 9A2571EC0716; Fri, 23 Dec 2022 14:23:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1671801790; 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:in-reply-to:in-reply-to: references:references; bh=SSvDsZpTjzmrUNmjyZT5I2QHEjJaFSOc5HqeqmJ/KDs=; b=Z0k+/b49p2pLiHOwTv71cT+c0uqCQo5Qig6N/jS+AbXYF3yqw/F56MXVprdE/JJyFb3/xP QQE7sZDI1P7mqZb79CE1Jod8RC+pjzdn39GppUAMjE40wGM+UsVmmbfHQPOttStWVHKB3z jjfsLhFKBvBBN9YK3l9XykKzbS4Evpw= Date: Fri, 23 Dec 2022 14:23:05 +0100 From: Borislav Petkov To: Yazen Ghannam Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, tony.luck@intel.com, x86@kernel.org, Smita.KoralahalliChannabasappa@amd.com, Borislav Petkov Subject: Re: [PATCH v6 1/4] x86/mce: Cleanup bank processing on init Message-ID: References: <20221206173607.1185907-1-yazen.ghannam@amd.com> <20221206173607.1185907-2-yazen.ghannam@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221206173607.1185907-2-yazen.ghannam@amd.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Tue, Dec 06, 2022 at 11:36:04AM -0600, Yazen Ghannam wrote: > -static void __mcheck_cpu_init_clear_banks(void) > +static void __mcheck_cpu_init_prepare_banks(void) > { > struct mce_bank *mce_banks = this_cpu_ptr(mce_banks_array); > + mce_banks_t all_banks; > + u64 msrval; > int i; > > - for (i = 0; i < this_cpu_read(mce_num_banks); i++) { > - struct mce_bank *b = &mce_banks[i]; > - > - if (!b->init) > - continue; > - wrmsrl(mca_msr_reg(i, MCA_CTL), b->ctl); > - wrmsrl(mca_msr_reg(i, MCA_STATUS), 0); > + /* > + * Log the machine checks left over from the previous reset. Log them > + * only, do not start processing them. That will happen in mcheck_late_init() > + * when all consumers have been registered on the notifier chain. > + */ > + if (mca_cfg.bootlog) { > + bitmap_fill(all_banks, MAX_NR_BANKS); > + machine_check_poll(MCP_UC | MCP_QUEUE_LOG, &all_banks); > } Yeah, just a nit ontop - lemme move all_banks into the if branch so that it is closer and obvious: --- diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 5f406d135d32..a90d3eb6fcd8 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1755,7 +1755,6 @@ static void __mcheck_cpu_init_generic(void) static void __mcheck_cpu_init_prepare_banks(void) { struct mce_bank *mce_banks = this_cpu_ptr(mce_banks_array); - mce_banks_t all_banks; u64 msrval; int i; @@ -1765,6 +1764,8 @@ static void __mcheck_cpu_init_prepare_banks(void) * when all consumers have been registered on the notifier chain. */ if (mca_cfg.bootlog) { + mce_banks_t all_banks; + bitmap_fill(all_banks, MAX_NR_BANKS); machine_check_poll(MCP_UC | MCP_QUEUE_LOG, &all_banks); } -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette