From nobody Mon Nov 25 07:52:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1715380833; cv=none; d=zohomail.com; s=zohoarc; b=O5y5QiPGyN+DIT4WNu3HA4X7Z9C0cdeN/Ybz1CKV+/pJdSqoBTqZz6mFHi7T0iBbzU9wu5QHOgmAMTVFlBx48q87gJ2ewLrC/neAeykiDUXmGJ1ZqAzS13JTWmc9bM5InMBxLH3Mcz+zPyfJXBHaP/aGjZLraAFudgQWDizkgDg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715380833; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+3wFptMesC7scMbASW9uUHmAUxFS1IgS9Pg8ty+kfrw=; b=XjHrnoNTVKWXZQvb2/Vwis7+ZaOMTnfKl73qPJtlWR9yE3WlgEmeOuBQqHrX3IjEiZ7vnOB9wkArf2l614H9Y2yus5Ue58RiIqYNGk2u719ORIX5IwBiIl2clKhCpX46sSbxNnSGrXQZqX1ahY41rXAFhncommHNkdQzANlfpJ8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1715380833901851.1715713290915; Fri, 10 May 2024 15:40:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.720094.1123091 (Exim 4.92) (envelope-from ) id 1s5YuO-0008A2-22; Fri, 10 May 2024 22:40:08 +0000 Received: by outflank-mailman (output) from mailman id 720094.1123091; Fri, 10 May 2024 22:40:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s5YuN-00089K-UU; Fri, 10 May 2024 22:40:07 +0000 Received: by outflank-mailman (input) for mailman id 720094; Fri, 10 May 2024 22:40:07 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s5YuN-000872-BN for xen-devel@lists.xenproject.org; Fri, 10 May 2024 22:40:07 +0000 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [2a00:1450:4864:20::636]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 3f3a152e-0f1e-11ef-909d-e314d9c70b13; Sat, 11 May 2024 00:40:05 +0200 (CEST) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a59a8f0d941so604152466b.2 for ; Fri, 10 May 2024 15:40:05 -0700 (PDT) Received: from andrewcoop.citrite.net (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a1781cf60sm233915866b.14.2024.05.10.15.40.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 15:40:04 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3f3a152e-0f1e-11ef-909d-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1715380805; x=1715985605; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+3wFptMesC7scMbASW9uUHmAUxFS1IgS9Pg8ty+kfrw=; b=EpTAo49FsvSsODgxrPqrr9TrNKTloxjagvc3oiBngOaPPcakoQaQ9eM15/aGp3XLvI lURNMpM/bg0eElR/1juMUb8M+nvwc7+ecRglNqaWy6pwaaL2cSvY0z3IYTOTameYCRk1 Kst9OBeIcYid6LPIi9Kez30+hupCgQBxPqx0c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715380805; x=1715985605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+3wFptMesC7scMbASW9uUHmAUxFS1IgS9Pg8ty+kfrw=; b=od3iLsbvYRnPepxP5HMVC1wTer8cJND7pHsL/3/n25FWl5i0mRpmZou2oa9kdJQRTa ZXztr9XU1w1N8zQ8GBtQFIaE+gWbVufy2LoZryg27sHxFHs3t/VqVnkxOxKrkw1LuIsw LQEk3gQFlpx7FAX64tsnmEcL5oyoCu1NYQKGSbqJolJoZXgWzxVJG8UyYu0WAfV+L/mz lFuSr1jlMVRwPnn2YttkavI8OoeNYZKYN3FgOWQPoJLhSoMWUfYyBFfF0rk8m2M02Jli H2UFvchyyDakBWNnjrnWk0INCVYEoVtyCa6binhfhF5COKMOuDvUuZmQLujD0nugR8fx h5Zw== X-Gm-Message-State: AOJu0Yw6cLT3lcJapXexiLc8qfEzGY42oX86xx2O0PgZVlPfrU42E8T+ vtcVYP8O194xiaGMeyvMVbQPLCi93i1SieAOgdFzpIytw0n7M0tr08PZEuTsNDuWLtXhZlJaPRa u X-Google-Smtp-Source: AGHT+IH0oLMFKMzpEMCVInvb1E6s+F94kooOglSc0Ol6TYVo3iWnR3bdBI+xVyJPk4/L2nL4aRjWeA== X-Received: by 2002:a17:906:22cc:b0:a59:c319:f1e3 with SMTP id a640c23a62f3a-a5a2d53ae7emr246124866b.12.1715380805100; Fri, 10 May 2024 15:40:05 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 1/4] x86/gen-cpuid: Minor cleanup Date: Fri, 10 May 2024 23:39:59 +0100 Message-Id: <20240510224002.2324578-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240510224002.2324578-1-andrew.cooper3@citrix.com> References: <20240510224002.2324578-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1715380834700100001 Rename INIT_FEATURE_NAMES to INIT_FEATURE_NAME_TO_VAL as we're about to gai= n a inverse mapping of the same thing. Use dict.items() unconditionally. iteritems() is a marginal perf optimsiat= ion for Python2 only, and simply not worth the effort on a script this small. Signed-off-by: Andrew Cooper Reviewed-by: Roger Pau Monn=C3=A9 --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 v3: * New --- tools/libs/light/libxl_cpuid.c | 2 +- xen/arch/x86/cpu-policy.c | 2 +- xen/tools/gen-cpuid.py | 9 ++------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c index ce4f3c7095ba..063fe86eb72f 100644 --- a/tools/libs/light/libxl_cpuid.c +++ b/tools/libs/light/libxl_cpuid.c @@ -296,7 +296,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *p= olicy, const char* str) =20 {NULL, 0, NA, CPUID_REG_INV, 0, 0} }; - static const struct feature_name features[] =3D INIT_FEATURE_NAMES; + static const struct feature_name features[] =3D INIT_FEATURE_NAME_TO_V= AL; /* * NB: if we switch to using a cpu_policy derived object instead of a * libxl_cpuid_policy_list we could get rid of the featureset -> cpuid= leaf diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c index 99871b8e0e05..b96f4ee55cc4 100644 --- a/xen/arch/x86/cpu-policy.c +++ b/xen/arch/x86/cpu-policy.c @@ -43,7 +43,7 @@ static const uint32_t deep_features[] =3D INIT_DEEP_FEATU= RES; static const struct feature_name { const char *name; unsigned int bit; -} feature_names[] __initconstrel =3D INIT_FEATURE_NAMES; +} feature_names[] __initconstrel =3D INIT_FEATURE_NAME_TO_VAL; =20 /* * Parse a list of cpuid feature names -> bool, calling the callback for a= ny diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py index 380b9d973a67..79d7f5c8e1c9 100755 --- a/xen/tools/gen-cpuid.py +++ b/xen/tools/gen-cpuid.py @@ -459,15 +459,10 @@ def write_results(state): state.output.write( """} =20 -#define INIT_FEATURE_NAMES { \\ +#define INIT_FEATURE_NAME_TO_VAL { \\ """) =20 - try: - _tmp =3D state.values.iteritems() - except AttributeError: - _tmp =3D state.values.items() - - for name, bit in sorted(_tmp): + for name, bit in sorted(state.values.items()): state.output.write( ' { "%s", %sU },\\\n' % (name, bit) ) --=20 2.30.2