Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp47504lqh; Thu, 30 May 2024 13:35:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZV7Cww5Vj8XZ0JrZCrmXL/T/QWOBnRcAh8QNSf4olINlKdYuXAzVS81qq1rd3bPMDiL2P8LvXYsG9COOrNVUPAphNxjsYEU+lo0MPTg== X-Google-Smtp-Source: AGHT+IGzKqqc12mYyJypeZ8EhydnwGNcHcw7obj8TxDPiDwOaamRngqeKtzWO+22DGApRMniyz5I X-Received: by 2002:a17:906:22ca:b0:a63:582b:8ac1 with SMTP id a640c23a62f3a-a65e8e5081cmr182781466b.20.1717101315332; Thu, 30 May 2024 13:35:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717101315; cv=pass; d=google.com; s=arc-20160816; b=kr10brmnknJwERNE/fOVDKEsfVXZZ/pPe+8bRlGSEMq0TGP2NFXtv49YZqdXlo6jhb Ot5p0uIs4w/j683nC8drncp0DWwpHWoX4BSod6DKmHWTEb9ykYfXLzx0PkjjH6Cda+Dr /b2kouUvS/eV5KZqXiMsMEa6xLAVJFRAzkal1nZvebaS0VkooZUQSubIawmgAcRxg1Oc cl6Y/mUPAHgb8TWu16dpXbnA5ToE3pRawL7+w0mFEwPOKcQJ1rfZFRzd3Xzg8HvBMNxI 89dHChMKJhPDYIL6B33qg+G0CABVWf3GWNSt2h1tXm8bnTv0s0CWHTl0E9DmnH2sWLnS PcAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=I4Wr5pXMZK70txq9jLaovowbEjCZ2pDXTe6ECaMLgHQ=; fh=DWRNVZAG/xWnZiEERVjNX2xs334Sqj2HplfHxM6ebpQ=; b=LaE3E+4aGNVZnCwq+39aq6rMQhQ9Kqplm7VdKXM02ZGpAUzi5dwybiEl2ckitNNTP4 DIBWdVln2XhjFQgFhP9V7s62lp4IRYkQCmKn2I6DcoFVPYq4VmS5immCUVR6zIOqx7gd v3U3IoBE6uOIutBWEiKQoA9DqGGMiLyarBWSNXTRXaEi7gOQXJLYCvLcWUy35TcanE4o Nmjo5loetKqRdZDbqWWpN5Y+/yfVZd1VI76FK0fwLzaNxgwV5hxwMtTJ4VLyFLd5LBKU +rbQAOmlDfz+O4uX2hqywixH8xMm17YNYgNYP7mvN22ruh0a26y4xdAgABS38EunhzeF h+OQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EdXkL8O4; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-195890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195890-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a67e6f028a5si12713066b.109.2024.05.30.13.35.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 13:35:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EdXkL8O4; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-195890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195890-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AAFFF1F21C03 for ; Thu, 30 May 2024 20:35:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 728E884DE4; Thu, 30 May 2024 20:35:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EdXkL8O4" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E3D025634; Thu, 30 May 2024 20:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717101304; cv=none; b=B/2CGkBNgIVGb1eG32Rl7URoaTkNG5IrTE5Pw4LtzBK/uPtF55f0et3CpxdSTlaojiXBvH7Zt5nxXYXz51cHEXWKwDcwGM9zwtfW3xIsNp/U6oIAAqTTr+JyZ/zrW8wWtRZsPc1wsEp1+vaUCeQfgaQKbUf2eWVlCuTKySqmXlU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717101304; c=relaxed/simple; bh=kAKen4NyriQ88zKA+tglPnCd/Pr0Xbljz36Nbgay9Qo=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hZafJWQvSSG77GcdI4QAjSTXYw70UOGgDIhtTu0hX1g9ZPazaa6QeO6CyvQN5FezcJNrUhQAcdvCyZ2+qu/n4KhWfjG61WzhHG1xUTIMWLZlOxw6qxiSriELq9HHLVZuVlSZQHJLvCxpKSfBpnts4b7kg13bwRNwneCIG9y8mZg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=EdXkL8O4; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717101303; x=1748637303; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kAKen4NyriQ88zKA+tglPnCd/Pr0Xbljz36Nbgay9Qo=; b=EdXkL8O4rLGjVsPTioHQqVMZ2z/f1NLjtMAPvw6+Na1iyaoPUUa8KSit R8gstQM9NzQx99F0R4Kv6Sk08idCsLr5XoTLf8DWSPd7v7lu6xPatCt7I HnCPNBsTUiiJpsvaCImfkIsv+rxZ7Pm9bQSQK3DMMToVGN/ESXgOC4bfE 5h9w7loWD5lGAoeoKL7P/kTi1NveHmG11+tu2MxHA5wW08/y3KiJfqH+6 NfhPpMStoXYtZ4M9e4lICLwpReJQskObLjmaDS3+ePPFKnUYQabjV2odM lgqfFBRus2qjYS0ytH3zFKjDNrFV8umX81HWT1oEnay6wT/GUSRhT6e/B Q==; X-CSE-ConnectionGUID: NQqhdIpSRvSOrq/B2vdaLA== X-CSE-MsgGUID: Q0wEa24ARpqRrLBokVqjVQ== X-IronPort-AV: E=McAfee;i="6600,9927,11088"; a="13816728" X-IronPort-AV: E=Sophos;i="6.08,202,1712646000"; d="scan'208";a="13816728" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2024 13:35:02 -0700 X-CSE-ConnectionGUID: ZC/1h9rtQlaQZtkVvz9Niw== X-CSE-MsgGUID: CT6c8GOnSymlhdPdSxMcbA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,202,1712646000"; d="scan'208";a="40855571" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.54.39.125]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2024 13:35:02 -0700 Date: Thu, 30 May 2024 13:39:58 -0700 From: Jacob Pan To: "H. Peter Anvin" Cc: X86 Kernel , LKML , Thomas Gleixner , Dave Hansen , Ingo Molnar , Borislav Petkov , linux-perf-users@vger.kernel.org, Peter Zijlstra , Andi Kleen , Xin Li , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH 1/6] x86/irq: Add enumeration of NMI source reporting CPU feature Message-ID: <20240530133958.229975d1@jacob-builder> In-Reply-To: <20240530091916.54056820@jacob-builder> References: <20240529203325.3039243-1-jacob.jun.pan@linux.intel.com> <20240529203325.3039243-2-jacob.jun.pan@linux.intel.com> <9dabe435-7208-4aa8-886c-a3351ee11e80@zytor.com> <20240530091916.54056820@jacob-builder> Organization: OTC X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hi Jacob, On Thu, 30 May 2024 09:19:16 -0700, Jacob Pan wrote: > Hi Peter, > > On Wed, 29 May 2024 13:49:40 -0700, "H. Peter Anvin" > wrote: > > > On 5/29/24 13:33, Jacob Pan wrote: > > > diff --git a/arch/x86/kernel/cpu/cpuid-deps.c > > > b/arch/x86/kernel/cpu/cpuid-deps.c index b7d9f530ae16..3f1a1a1961fa > > > 100644 --- a/arch/x86/kernel/cpu/cpuid-deps.c > > > +++ b/arch/x86/kernel/cpu/cpuid-deps.c > > > @@ -84,6 +84,7 @@ static const struct cpuid_dep cpuid_deps[] = { > > > { X86_FEATURE_SHSTK, > > > X86_FEATURE_XSAVES }, { X86_FEATURE_FRED, > > > X86_FEATURE_LKGS }, { X86_FEATURE_FRED, > > > X86_FEATURE_WRMSRNS }, > > > + { X86_FEATURE_FRED, > > > X86_FEATURE_NMI_SOURCE}, {} > > > }; > > > > > > > This is incorrect. FRED does *not* inherently depend on NMI_SOURCE; the > > dependency is the reverse, but since it *also* depends on FRED being > > dynamically enabled, there is no need to add it to the static table; > > the dynamic test: > > > My misunderstanding of the dependency table, thanks for pointing it out. > Will remove. > > > > diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c > > > index 4fa0b17e5043..465f04e4a79f 100644 > > > --- a/arch/x86/kernel/traps.c > > > +++ b/arch/x86/kernel/traps.c > > > @@ -1427,8 +1427,10 @@ early_param("fred", fred_setup); > > > > > > void __init trap_init(void) > > > { > > > - if (cpu_feature_enabled(X86_FEATURE_FRED) && !enable_fred) > > > + if (cpu_feature_enabled(X86_FEATURE_FRED) && !enable_fred) { > > > setup_clear_cpu_cap(X86_FEATURE_FRED); > > > + setup_clear_cpu_cap(X86_FEATURE_NMI_SOURCE); > > > + } > > > > > > /* Init cpu_entry_area before IST entries are set up */ > > > setup_cpu_entry_areas(); > > > > ... suffices just fine on its own. > I am not following, do you mean checking for FRED is sufficient for NMI > source? I think it works since NMI source cannot be disabled if FRED is > on. Just want to use the architectural CPUID bits to the fullest. > Nevermind, I got it now, will keep the dynamic test. Thanks, Jacob