From patchwork Fri May 20 13:37:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12856846 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BACB1C433FE for ; Fri, 20 May 2022 13:38:33 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.334158.558153 (Exim 4.92) (envelope-from ) id 1ns2pc-0005N0-Fa; Fri, 20 May 2022 13:38:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 334158.558153; Fri, 20 May 2022 13:38:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ns2pc-0005Mr-Bx; Fri, 20 May 2022 13:38:16 +0000 Received: by outflank-mailman (input) for mailman id 334158; Fri, 20 May 2022 13:38:15 +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 1ns2pa-00056k-RB for xen-devel@lists.xenproject.org; Fri, 20 May 2022 13:38:15 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 162db06d-d842-11ec-bd2c-47488cf2e6aa; Fri, 20 May 2022 15:38:12 +0200 (CEST) Received: from mail-bn7nam10lp2105.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.105]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 20 May 2022 09:38:00 -0400 Received: from DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) by SA2PR03MB5755.namprd03.prod.outlook.com (2603:10b6:806:111::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.14; Fri, 20 May 2022 13:37:59 +0000 Received: from DS7PR03MB5608.namprd03.prod.outlook.com ([fe80::5df3:95ce:4dfd:134e]) by DS7PR03MB5608.namprd03.prod.outlook.com ([fe80::5df3:95ce:4dfd:134e%5]) with mapi id 15.20.5273.018; Fri, 20 May 2022 13:37:59 +0000 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: 162db06d-d842-11ec-bd2c-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1653053892; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=VYJh6n90s2Z2f/hoLcEnXwqvv8sM0GrhXmOREGpZMZU=; b=IWhnK4FXXQwAldDPRSem5oWpjEGTh3iOv9zXbHgodpDt+fEguJgduwbp FrQtzCONK68aPFgIfKVBpgR7OqCU/4Kw6R5nV2/wC6Xo9/I5j1KW0yaRG cauOBirdoGHTySlhfE0NF/YpI56RtwhFRT0Zb4Thixzah2oCjEsIReyQy g=; X-IronPort-RemoteIP: 104.47.70.105 X-IronPort-MID: 71798612 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAYED IronPort-Data: A9a23:vbAiuqnmbid3PJ4c44GMCEHo5gykJ0RdPkR7XQ2eYbSJt1+Wr1Gzt xJMCmCEOv6Ja2SmeI0iOoqxp04G6JbRy99nGQJt+3o0Q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NpeA86njNQTN1zX+0+VTbUkf4fHkCE+oemp5lpvuN 7Qoy04N8A20H/VdnHdm2qZ5yDQlBIVr1Pyw16RhnXu5ebjQighNsZHjYVFNjPE9ksJprhHoe 529lPck6ASIQLLnSz76dSNfQptjFCIrX0rlvNWp2BDULEZdKRaoeUkjQ5o+a87bWzHAb0cYa hT5Jm23ocXTbraVQGSgoBX+q3iYpxpdS32AXTruaSuokprdT5CvgklLfck7wg9HaIGOuV5Dt v/Q9pVfcl1P6krhIJGdZM8qJiMexvwqSylChPjHX3XUIc6Blnql7nbpJ0I2cDCQu168HJ1ou WLbG9l X-IronPort-AV: E=Sophos;i="5.91,239,1647316800"; d="scan'208";a="71798612" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=an+8CZ/RgZtkbOaReBB+a99Cr0AnHIDUqCSuFQ4J+OTAqGTBXYu97AVrPUOFFq3VuN2twMk9GZjFmSqbaDqGi4FWGI6AAZmBtoej4BiHrb6wAwLWMv6Mv7ej6Lrm/ErzC3Q3UWZagyzTqCrOH/Y/zMEJzj83CfVfIapBB45OM56DDfE0g5lvVSepWKMftOYlWhjf/uojNjyoki1gY2Wxv4eN5ssPsi1UJO02ROavQFPAhJsmtcuPr0T3RIupoF77j0tAloHMln02Hjzn1IhPvIvpELnQpJPQDnSkOsc1RfyGe92IkmusbZ9bWhv2H7ZLYqCY7LhA6AIzd7FhDsONgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1KcoChvovYQDsK3p29jg9hzF+dhhtG/SSZ4U6GNOE7U=; b=bLxWTbpGMJo8j154yQXOt/afBZIslcdsqzCkehZeNGELWQU7gC0VdrEBm946lwAnH0TKM9uWUGYlVDsdWVqxQGoc07M2EhtC9Ts2O698kuMvtHiencOp/zdkzSaif/pctpNlyZuh99rsTB5NCdAylfMjadrYQn/oo4lU3mmlK4dNzME1DJUEHZm+ZcyVyh/5Qgy9C4onueVXiiUWx9MwXehUC5mC+Gwax4T94PxAUjT5+JurrWSSqpxUO/YxOyXJiSQcQfo7dGssYJ1Y+UhNzgQvmE8s2wbIl9wUU0NnUpH2+IN65QLY/suwVR3wPn8MEu+xS3ZJu/vUcQ5DRKEl+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1KcoChvovYQDsK3p29jg9hzF+dhhtG/SSZ4U6GNOE7U=; b=NUmDotmnMGRSf6qPad11gRPYba58hRX6HzjqWITzl5Pn3GgaOfQOkFmHsGAGaSIOdUHPMsaHOwsUNX4IXiAz9jsfJO3WL+wmJCQLPu3d9WEM1z94S+lfXoeBdK8kuhx7+BM43JWUBh+LRhk5muAXF2zIuQTktPvt4SO6ikHg8ok= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper , Wei Liu , Jun Nakajima , Kevin Tian Subject: [PATCH 0/5] x86/lbr: handle lack of model-specific LBRs Date: Fri, 20 May 2022 15:37:41 +0200 Message-Id: <20220520133746.66142-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.36.0 X-ClientProxiedBy: LO4P123CA0528.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:2c5::10) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 12903cb0-6255-41e2-d171-08da3a65f424 X-MS-TrafficTypeDiagnostic: SA2PR03MB5755:EE_ X-LD-Processed: 335836de-42ef-43a2-b145-348c2ee9ca5b,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 60ImD7+KNxpWHcVoG3Bhv4IzSI+tfD5kaCTstihtXwsaXRZ7iRyNrt75UI+G0qgI/hYus80jxkP7F2dyCJzQaKWE99pQvlstJeHzCbm0XacPj1I5UfNnm5oF+ScJz0oj9MOyrpEmI+GdyPh/JIqUlAX26AzJVrlLn+aMGZfCDKfGo3fj6M4fMs5DrWS03KryH4iZXUBlIa8odWxCfMLUUSLmbw4ulJkmEMGZFTA0KlyutdIb8YSsmo4+xIOr845zy4Goz19gHgeMNZ3MoezCvxrSnOLJO8YxmDZScMm180+lAWMM2jnMl/CaOWxZKk6UzrieCzR0jXzOfE8mrBhW1FVavqAeRyEVQs/Zp7/2haVD76J5fRwaFakYXKBC5fGXY8X8ZbdsocHWRssZ5wbxdPKedweU/OvDQS865bo04KsTO3sOhPdFtzDjFMEp1dHDoZNW76nYS3VzPoUJWgtVkJt5K1amyu1u+vIB12X/T3jZ010c0SX/vDLhUy0lp3dhMGNErnnML9uzCtijjz7Awl9nVkkEYZbMNhXvyTPhPvHPL7TcBcAZb54VvTpq+LGIXNTakDCZcnQwJC2fUyeyyPlleJDRsHCpPfcFOV//Q+NDWnVgOFdJ2GzDTWfhqUUC8oLhA/q7/m4bN1YHbWmU2g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(54906003)(316002)(6916009)(86362001)(66556008)(66476007)(66946007)(8676002)(4326008)(6486002)(83380400001)(6512007)(26005)(2906002)(6506007)(508600001)(1076003)(38100700002)(2616005)(82960400001)(6666004)(36756003)(5660300002)(8936002)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?1AOYxXuhHjAXI3x6+T55tG/XBypU?= =?utf-8?q?znY3CTS2udCAaDkhk8DMc381sN1yvRXxTQGyZf+iTSQLddZgroJaFS39Un6nC2pXj?= =?utf-8?q?12qGU7/DXYAYKfnDtLy3gBRLVhRSPliLrvG09ofJNSlgZPeFa7LsIL2ZfKFBhaog5?= =?utf-8?q?3YB51YqpdhC8WxMB7H5bagPPOS9dBek7mYXLkHvbix7X3ImzARX1+X4M4uFg2za30?= =?utf-8?q?LdSN5hTwmAbtcPOKUwZtK5mop4Z7kyTLLknVk0J3C/VVFj6GTWn2vYDVc27AuppDy?= =?utf-8?q?6DQAjzWgGrvKhxZgta0OZG059OXj3uko05PKDPYbN9GdhDoV6s7H9mjlp69oOKL3Y?= =?utf-8?q?jJCjHi+FrbIREgVXndoCvAuow4usT/E80SBThvxYmPJS8IL7F8cFbBMic+bMRxHRe?= =?utf-8?q?+wLA0otdr1iV1vKxlG8JY2muIB2iO/FHbrY3BrukOGcfSHLJsRqFVJzTASwerSGpc?= =?utf-8?q?c8myQyfio3IxLGCkAMvg4HvAw0J7MxhAOkoOpCEivlOtElLwNeBHbL8wzGztiqahc?= =?utf-8?q?/pEyNfWXcFA9ZPIIchx5BdZH8fLopbke3kFtrcB6NGBrnAoglmxFrXXQhLbn8TKjv?= =?utf-8?q?bfGFdNy0TlHTBTfZEU38Mpm1y6ygBp5f1WI629TPmQLd+RZHO5yEAiQ/WqB6XPBDG?= =?utf-8?q?CqN9rmr4Nyw1RbEJ0KDFauFTroM0rxagksA1E5nAvVda9KnAe7j516u/XVT6MR7ku?= =?utf-8?q?UlO9tn5dhL4uMay+fRZFXDDCVuGQD+edKO1ZWJte2wwPL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jf0Rs9C3Dzdr4tJ4Yseyd?= =?utf-8?q?ss9wwuzh+pNwuRgE7ZcQo7/VyBHnsPj8a7repJKUv8pQvBfxduQmk=3D?= X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12903cb0-6255-41e2-d171-08da3a65f424 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2022 13:37:59.0538 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lccO8oTBS9mOEa+vCEijnWdJO/qaLyL/0/cZqrJwv7fToNXrKajZUdi+askh1C7kX+Xm0gWLbvX8N5MENruwPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR03MB5755 Hello, Intel Sapphire Rapids CPUs doesn't have model-specific MSRs, and hence only architectural LBRs are available. Firstly implement some changes so Xen knows how to enable arch LBRs so that the ler option can also work in such scenario (first two patches). The lack of model-specific LBRs also affects guests, as setting DEBUGCTLMSR.LBR is now ignored (value hardwired to 0, writes ignored) by the hardware due to the lack of model-specific LBRs. The LBR format reported in PERF_CAPABILITIES also need to be exposed, as that's a way for guests to detect lack of model-specific LBRs presence (patches 3 and 4). Patch 5 is an indentation fix that can be merged into patch 4: done separately to help readability of patch 4. Thanks, Roger. Roger Pau Monne (5): x86/ler: use feature flag to check if option is enabled x86/lbr: enable hypervisor LER with arch LBR x86/perf: expose LBR format in PERF_CAPABILITIES x86/vmx: handle no model-specific LBR presence x86/vmx: fix indentation of LBR xen/arch/x86/hvm/vmx/vmx.c | 59 ++++++++++++++------- xen/arch/x86/include/asm/msr-index.h | 18 +++++++ xen/arch/x86/msr.c | 9 ++++ xen/arch/x86/traps.c | 29 ++++++++-- xen/arch/x86/x86_64/traps.c | 2 +- xen/include/public/arch-x86/cpufeatureset.h | 3 +- 6 files changed, 97 insertions(+), 23 deletions(-)