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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE39FEB64D7 for ; Mon, 26 Jun 2023 22:32:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229623AbjFZWco (ORCPT ); Mon, 26 Jun 2023 18:32:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjFZWcn (ORCPT ); Mon, 26 Jun 2023 18:32:43 -0400 Received: from lobo.ruivo.org (lobo.ruivo.org [173.14.175.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B28E5A for ; Mon, 26 Jun 2023 15:32:40 -0700 (PDT) Received: by lobo.ruivo.org (Postfix, from userid 1011) id 9395F53150; Mon, 26 Jun 2023 18:32:39 -0400 (EDT) Received: from jake.ruivo.org (bob.qemu.ruivo [192.168.72.19]) by lobo.ruivo.org (Postfix) with ESMTPA id 29601529A0; Mon, 26 Jun 2023 18:32:21 -0400 (EDT) Received: by jake.ruivo.org (Postfix, from userid 1000) id B22E7220039; Mon, 26 Jun 2023 18:32:20 -0400 (EDT) Date: Mon, 26 Jun 2023 18:32:20 -0400 From: Aristeu Rozanski To: Tony Luck Cc: linux-edac@vger.kernel.org, Borislav Petkov , aris@redhat.com Subject: Re: [PATCH v2] mce: prevent concurrent polling of MCE events Message-ID: <20230626223220.GX4090740@cathedrallabs.org> References: <20230626203712.GW4090740@cathedrallabs.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.2.9 (2022-11-12) Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org On Mon, Jun 26, 2023 at 02:01:09PM -0700, Tony Luck wrote: > It is already possible to associate a CPU with a package. The problem > here is knowing which CPUs are sharing which banks. Then this patch can be improved to have one lock per package instead one for the entire system. How do I know which package the current CPU belongs? > Is mce_timer_fn() used on AMD? I think it is (mcheck_cpu_init() calls > __mcheck_cpu_setup_timer() apparently unconditionally). So this code is > OK if CONFIG_X86_MCE_INTEL=n because that's an empty stub. But with > both CONFIG_X86_MCE_INTEL=y and CONFIG_X86_MCE_AMD=y you'll call this > function on AMD systems. > > Or is this OK because this will always return false on AMD? That was my intention. I could use a static to only call cmci_supported_hw() once (that in fact could be useful for users of cmci_supported() that actually just want cmci_supported_hw() but I didn't want to mix it with this change) if you prefer: +bool intel_cmci_poll_lock(void) { static bool supported = cmci_supported_hw(); if (!supported) return false; spin_lock(&cmci_poll_lock); return true; } Still a call and comparison for everyone (although it's likely intel_cmci_poll_{,un}lock() will be inlined). You prefer this or have a different idea? Thanks -- Aristeu