Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4952941rwl; Wed, 28 Dec 2022 11:02:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXtKUaozOhPYCTa4sLgtgEmCB9Qd86B5QZpRswEadWS3MjNH4AYwXhZ4wce2w+PzLSDErIis X-Received: by 2002:a17:903:40d2:b0:191:19ed:d6b3 with SMTP id t18-20020a17090340d200b0019119edd6b3mr29594545pld.3.1672254130500; Wed, 28 Dec 2022 11:02:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672254130; cv=none; d=google.com; s=arc-20160816; b=E3+X17h1x93RdEvWwbM8n/x0L6Z7wGHv+zmdhbL+4Ij58Z2IVT6cb9F7cNa7CIFjOR 2qY9Fad+CrAObZ6E/Q2OLQmYV9qoRhBnl85Z4ErHG2vQQ/+cBW36aWMSOo1q1FDI5uIq JuhrCqdMdoo0KDlzMq7DFQ7HgT/PVDZA4Hb517qYD7HA+kkolA3NpzjkWi+SQuUjG1Jd UhIMdFEoWHnNz+jW0OyzYQLlQ40WTeuHQTDGVVCwQOUsfVgHsrSzmRNL/Y6fvzV+91GL gQwhsoXedsL9vsVW7Wl0r5AndqZdUV5T1tL/4uKf9LPDGKbi8RFNHUROUIe0Cf/RbKBM CVEg== 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=HaNhDAnQUnW3eGCf7lfZiCI/y+B7ggEGtDMUKhr9xVQ=; b=GJryhWeIkZ54x1vU7EGHa6CJ2toeWmt42uqR4u/H7bdaT1n2B/6JupFsI9FinoZr9F VfTor8XbCDA7vz4nhwLxRHRE3IUSI+5dB2cGgYMo6TqRzGbLAvbipDZobjpUneCwKY55 DH4d4JEg0VCHPRLQStV8dLFEH8mYDIWhPd9UNnbcIntmxLgHkvD4V4nDC6dRZmT3eZKa l07SWpr+xd1hDD0CfyQf9AAQ6eY0MPTGpMEm5DMrJVkSJIioSfFVLUvOuY6cN0Cmcs8T vfzTiIsSg06fEA06f8XKPqFqzDGQD3fIgajYtJ7Zc9bKx0aPcCN+v3tN0ycYeEE2PCog 55oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=T05EVPbn; 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 j5-20020a170902da8500b00189c982c29esi18461595plx.262.2022.12.28.11.01.59; Wed, 28 Dec 2022 11:02:10 -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=T05EVPbn; 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 S231183AbiL1Sxg (ORCPT + 64 others); Wed, 28 Dec 2022 13:53:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232111AbiL1Sxe (ORCPT ); Wed, 28 Dec 2022 13:53:34 -0500 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3E8515FED; Wed, 28 Dec 2022 10:53:31 -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 7B0D31EC04C1; Wed, 28 Dec 2022 19:53:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1672253610; 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=HaNhDAnQUnW3eGCf7lfZiCI/y+B7ggEGtDMUKhr9xVQ=; b=T05EVPbnaNkNsTblWXujvigaCb+4Gge3E72SFkNqyKL/gglICltLYh5LOA2lYgaCyyI8aQ 6BlrmV7l3QMGzgRxFhYkft6SaZsgXHXm3TC5Y60MkSIGTxaWCC9tPpjmwd23hhENglxLUX m/1d/fxBQv5hUMkXu3hoFHghcocvPxc= Date: Wed, 28 Dec 2022 19:53:25 +0100 From: Borislav Petkov To: Yazen Ghannam , tony.luck@intel.com Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, Smita.KoralahalliChannabasappa@amd.com Subject: Re: [PATCH v6 2/4] x86/mce: Remove __mcheck_cpu_init_early() Message-ID: References: <20221206173607.1185907-1-yazen.ghannam@amd.com> <20221206173607.1185907-3-yazen.ghannam@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221206173607.1185907-3-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:05AM -0600, Yazen Ghannam wrote: > + mce_flags.overflow_recov = !!cpu_has(c, X86_FEATURE_OVERFLOW_RECOV); > + mce_flags.succor = !!cpu_has(c, X86_FEATURE_SUCCOR); > + mce_flags.smca = !!cpu_has(c, X86_FEATURE_SMCA); > + mce_flags.amd_threshold = 1; > > for (bank = 0; bank < this_cpu_read(mce_num_banks); ++bank) { > if (mce_flags.smca) > diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c > index 5f406d135d32..9efd6d010e2d 100644 > --- a/arch/x86/kernel/cpu/mce/core.c > +++ b/arch/x86/kernel/cpu/mce/core.c > @@ -1906,19 +1906,6 @@ static int __mcheck_cpu_ancient_init(struct cpuinfo_x86 *c) > return 0; > } > > -/* > - * Init basic CPU features needed for early decoding of MCEs. > - */ > -static void __mcheck_cpu_init_early(struct cpuinfo_x86 *c) > -{ > - if (c->x86_vendor == X86_VENDOR_AMD || c->x86_vendor == X86_VENDOR_HYGON) { > - mce_flags.overflow_recov = !!cpu_has(c, X86_FEATURE_OVERFLOW_RECOV); > - mce_flags.succor = !!cpu_has(c, X86_FEATURE_SUCCOR); > - mce_flags.smca = !!cpu_has(c, X86_FEATURE_SMCA); > - mce_flags.amd_threshold = 1; > - } Yeah, looking at this, before and after the change, what we are and were doing here is silly. Those flags are global for the whole system but we do set them on each CPU - unnecessarily, ofc ;-\ - because we don't have a BSP MCE init call. That above happens on the mcheck_cpu_init() path which is per-CPU. However, if we had to be precise and correct, this flags setup should happen in a function called mcheck_bsp_init() or so which gets called at the end of identify_boot_cpu() and which does all the *once* actions there like allocate the gen pool, run the quirks which need to run only once on the BSP and so on. So that we don't have to do unnecessary work on every CPU. Tony, thoughts? I think we should start working towards this - doesn't have to be done immediately but I think a proper separation of what runs where - once on the BSP or on every CPU - is needed here. Unless I'm missing an important angle, which is entirely possible. Hmmm. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette