Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4667338iob; Sun, 8 May 2022 21:15:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweens3vkJOVCD78WzG5TXlEyXHdgg0cVhd1sbaGkbpSwUrtTp2DSA6sl/R4VnMMkxG/OH+ X-Received: by 2002:a63:8143:0:b0:3ab:6bb5:8642 with SMTP id t64-20020a638143000000b003ab6bb58642mr11440363pgd.591.1652069701124; Sun, 08 May 2022 21:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652069701; cv=none; d=google.com; s=arc-20160816; b=pu9lNmwGIYzRxa5kMxh3/A50ukGyEQo9Ak6ksD//Drid4dn5caXxkMiLhbKucSD9Jg zma2dCHeZXlzxABZISdQYeB0Q5B1khPWND86MKYnB0kpQgCRFtegiJ1Wkvzq6/abstNO o3KsF//+LKG38cqIRV3vJxHu0hWryn6+7Hxf6ivi9hkqBt6A1teRsqAGhAdTr2YHgrRW OIQKtHztjUWhbZfNF7RRFbTsmHW79A74ysg2aNDbA+EZbyLFvZ0ohOuCEykoX0gvL+4M 3um7ySkEreonjVySEmYx21WFPzxnYqbdbaS877AmYC0jAT8XiO83zunVkxRE7trlIjMU CccA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=M/Qe/z4dXd8YXWi5AW5zZv05R22jtN5Azi9InvrwAyM=; b=XF6MhBMAwXS51YQv/G3mY4F1MSd73a1387FvOhgAIQ4ut4f3Bn9mI05ggg56iqFVrz lDDeMJSA3lFtaOOAQKDyqIqRXfx+G9Zq/D99f9PKQxcPe1EeAdhy/ZMOr9JDRg2DyXVi aSk3ENyTa9HMfM04tjVxpxLfcUNoT2J7OzToeNEcRC7NqUCPcATxjmzmwjJQiQ5ELhIq LRVxh1I0wQaTkH7+rHXSaVF0XO2pMpagXjotRlpqYIKwCxhcppVnER2CeLdYjGLsol05 dfMFq4nAFOAUwj2pBx1X2hU54fQDkMNnGEpByl382Lzry7CIMfFkg9oKAFPgAnu7y51x AHyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OHIlLlBB; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id r17-20020a632b11000000b003c253889c2bsi13046049pgr.706.2022.05.08.21.15.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 21:15:01 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OHIlLlBB; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E0502AFAE6; Sun, 8 May 2022 21:14:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381966AbiEERIU (ORCPT + 99 others); Thu, 5 May 2022 13:08:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240110AbiEERIS (ORCPT ); Thu, 5 May 2022 13:08:18 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19ECF101C5 for ; Thu, 5 May 2022 10:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651770279; x=1683306279; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=ppnTDlnUiSAwVHOZZyIHx8ErJ3z/pXNJDcAfk/v+Bes=; b=OHIlLlBBpXHmaGOyin5ENaP2MbcXy8jUjDe5CGbP7kMpDgMjh+wK/3O9 qgzOa6HWrXCGdS0Pre5kfWcRJA3XIDGNvkOju36+9w6AXB3lutplj8hzy AkHvmBGjtsnHbBnAqiacIkbr7ATWXVK96jkvTVA8zcHUDv2JjmaDxUEka milkU1/eQYwPRGGb6AnL1uw0T/cewNKxsVHD8apU1uk3EZ/4dhLLHZaXB Ji3K0Qn3oS9GdG0Wt9jNR4DdVgG825m+L+in819QJ2UmdktWXlxruf9DD dOrWvlBXQQWC6I2tuIDQ3dBgoCTw1xXheyni6R7xWN7DyFlG2Rup3xjiz A==; X-IronPort-AV: E=McAfee;i="6400,9594,10338"; a="248720967" X-IronPort-AV: E=Sophos;i="5.91,201,1647327600"; d="scan'208";a="248720967" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 10:04:38 -0700 X-IronPort-AV: E=Sophos;i="5.91,201,1647327600"; d="scan'208";a="694753447" Received: from evegaag-mobl1.amr.corp.intel.com (HELO [10.209.187.127]) ([10.209.187.127]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 10:04:35 -0700 Message-ID: <0b501f18-a6b8-1d9b-e72a-ea6cb33720a2@intel.com> Date: Thu, 5 May 2022 10:04:55 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v2 2/3] x86: Remove vendor checks from prefer_mwait_c1_over_halt Content-Language: en-US To: Wyes Karny , linux-kernel@vger.kernel.org Cc: Lewis.Carroll@amd.com, Mario.Limonciello@amd.com, gautham.shenoy@amd.com, Ananth.Narayan@amd.com, bharata@amd.com, len.brown@intel.com, x86@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, peterz@infradead.org, chang.seok.bae@intel.com, keescook@chromium.org, metze@samba.org, zhengqi.arch@bytedance.com, mark.rutland@arm.com, puwen@hygon.cn, rafael.j.wysocki@intel.com, andrew.cooper3@citrix.com, jing2.liu@intel.com, jmattson@google.com, pawan.kumar.gupta@linux.intel.com References: <20220505104856.452311-1-wyes.karny@amd.com> <20220505110140.453184-1-wyes.karny@amd.com> From: Dave Hansen In-Reply-To: <20220505110140.453184-1-wyes.karny@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 5/5/22 04:01, Wyes Karny wrote: > - if (c->x86_vendor != X86_VENDOR_INTEL) > + /* MWAIT is not supported on this platform. Fallback to HALT */ > + if (!cpu_has(c, X86_FEATURE_MWAIT)) > + return 0; > + > + /* Monitor has a bug. Fallback to HALT */ > + if (boot_cpu_has_bug(X86_BUG_MONITOR)) > return 0; > > - if (!cpu_has(c, X86_FEATURE_MWAIT) || boot_cpu_has_bug(X86_BUG_MONITOR)) > + if (c->cpuid_level < CPUID_MWAIT_LEAF) > return 0; First of all, thanks for all the detail in this new version of the patches! In arch/x86/kernel/cpu/common.c, we have: cpuid_dependent_features[] = { { X86_FEATURE_MWAIT, 0x00000005 }, ... Shouldn't that clear X86_FEATURE_MWAIT on all systems without CPUID_MWAIT_LEAF? That would make the c->cpuid_level check above unnecessary. > + /* > + * If ECX doesn't have extended info about MWAIT, > + * don't need to check substates. > + */ > + if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED)) > + return 1; Could you explain a bit more about this? I don't know this CPUID leaf off the top of my head and the line after this is checking EDX. It's not apparent from this comment why "!ECX_EXTENSIONS_SUPPORTED" means that MWAIT should be preferred. > + /* Check, whether at least 1 MWAIT C1 substate is present */ > + return (edx & MWAIT_C1_SUBSTATE_MASK);