From patchwork Thu Jan 5 15:59:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13090115 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 61A18C3DA7A for ; Thu, 5 Jan 2023 15:59:51 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.471987.732062 (Exim 4.92) (envelope-from ) id 1pDSeb-0000KC-Vf; Thu, 05 Jan 2023 15:59:41 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 471987.732062; Thu, 05 Jan 2023 15:59:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pDSeb-0000K3-Sx; Thu, 05 Jan 2023 15:59:41 +0000 Received: by outflank-mailman (input) for mailman id 471987; Thu, 05 Jan 2023 15:59:40 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pDSea-0000Ja-9G for xen-devel@lists.xenproject.org; Thu, 05 Jan 2023 15:59:40 +0000 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2061.outbound.protection.outlook.com [40.107.247.61]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f4cccead-8d11-11ed-b8d0-410ff93cb8f0; Thu, 05 Jan 2023 16:59:38 +0100 (CET) Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AS8PR04MB8498.eurprd04.prod.outlook.com (2603:10a6:20b:341::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 15:59:36 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2991:58a4:e308:4389]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2991:58a4:e308:4389%7]) with mapi id 15.20.5944.019; Thu, 5 Jan 2023 15:59:36 +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: f4cccead-8d11-11ed-b8d0-410ff93cb8f0 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oKo9nrP3Em0BVszABkaGrsSeWIlHIN9fKTE80L45UsjljkAUV7OPHNltFpikUE4zE0JxybWBtjOn+wwRPRmw0tBTTY5SDgH8kEw42RMAIt5mtH2FbErvtCxtb7SIGS2G7Qaj/RhkxL4pskKXE3TvNjbtlo0XVYQUAhR1LNCZhcDD8vzQ6pX+TYuh5CcGcvtmKG5YD6MlklZwrZcXP/flDi83PpjdKtibdqLYkGnkNmVXmv5G+MLIJ6xQ2Eq8V3IyBwe1TazEjuTHI4sLJOcJOEEU7cw7QDCFqt5sjJeBaciD4kssI2Fy01bRKBYJGOpOa0RmiPYzZqhxFzMAJpelmw== 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=ssTI6at9j+dmm0UVb4iktGaytHsP2Cy0qsceqf5wJgQ=; b=hn0DDszc2nBSsRuDm3v5cAL6I62a+2xk0rdW8rcNpdW4lUCKT/u62rNbHeWSLQKyKwga4pPk36HbkDTIHjhqUL+uQFW3o14rkxJj+TMKNUFrwRNbeSX2/lEx0W2Zc6LXe5b3z6/EwM0Hcaefm5uh3wWg26udhARbqN9nA58RsYKV9P7jA7xtExrVv+oPuCyGAqBVpODXPBsM4qv4LT8WTteGx7/18tosmtqMMVDlbYftKcZOzbWiggpDNS/lNdcSdsWmBhc5NBF9Xp3FGmZc+CvrdsUPh5Iq5TNohc48wS6tv6lJBDO41JvnhpXyDtMEkaI5YOB2hpYBW0KF+j292Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ssTI6at9j+dmm0UVb4iktGaytHsP2Cy0qsceqf5wJgQ=; b=2RBAg+xx8kgkN831po1jqJcIGZOcFlOsr5Ngz2uR5KO1Hz0ccHP46lMwbo2lzVk9W7BpzlDGfcbCSvbOgTEYUyXOoeeELal3nh1rCRhFhXno6m0eSUKesiGGV0t62mA1jh7ZRFKiu4AiGug1JIdfRqJ9gSh2356tCA6uvD/2PaKTuhD6JKHvXGmtlK5x0RgplTCpz/UzEuDJy/8tgxu7bLBnfQs0ZCMpx2WaPowhWqaO2+SQIxVc9kpGycx62kN1YY4XIi/iEkZ7ld6/BLJ4e9I92MvdF5GnBtMSTpKl9fY9sSwM2x7HDI+lrvyl53btvtWG5BLD6G0m6Mxt5iROLw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: Date: Thu, 5 Jan 2023 16:59:34 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: [PATCH 02/11] x86/shadow: convert sh_audit_flags()'es 1st parameter to domain Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Tim Deegan , George Dunlap References: <074dc3bb-6057-4f61-d516-d0fe3551165c@suse.com> In-Reply-To: <074dc3bb-6057-4f61-d516-d0fe3551165c@suse.com> X-ClientProxiedBy: FR3P281CA0046.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::12) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AS8PR04MB8498:EE_ X-MS-Office365-Filtering-Correlation-Id: 1beecf0d-43f8-45ed-1238-08daef35d7ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TCLgu6YBl5RO5kw9pDjgt7TEbbZx1slc1MN/kYGf4ExPPho0prgIVK8xGtOP012TIJqjJTpHZ54IuP/aTZf/21uZhFQc9uKI/qeYOiojFW2/JWCl4eD6Zf5N81iPHLf9f+h7Fv1XWv6G3qeg8e9SphlwaD84QFnKbAHv6ZgDkxiqjN7hWuOqL6EwAOjpqsDxxYBdVRk6pQbdv8RizYUmD1mvOWdmlkl+ogSTSN3Gd8ZHbayx21D965abWYNSFQ6o72vp0Witw7kOpvY5TjYKbye6qjnzsqPTpv7InVZ4n866JojRxmjCCjfOX/S8K+r0bXV8uR5/CWhcVQuKrCK290cgoZMVVYGdGm8jEaffdSftqQ/pVKY7MNaJYEKmo9Frf4fnesl44MG0g5ALijeAY7a0f3m+Xk44CldKLAxZDToYAUVRnyuxgjirY/1ACtamsMovVP3f1eFmaU5UCs+JmJX+j3HATt7THd5QKeYHHf86KVeIQX+jkuP9DtVPMnKk+d4QyC+cOxKLOnjbwqxVMkR50NOfz/XJTOriqxzpvSB0OBLeMko/Dii9a+on3g3sLzulqpmaqlIh18KCU5Ro4B4mXc/24PwcTFN3B0Q3f8LKcB1eWkF2IghSiHFvpEOL4fjohMSFyhYLCengpap9JkBVPqKtUe3jOkfzoR5pdFAO2IiOctPKNeRLtDpjE62WmLLb5EhYoFAeer8IJ7/xiCkJ5bej4317kGcXyJXRzdJL6UBV/5+eQHUOk7a8z1QRat0yMqBXGXnVpVOrS0mO2yA/i/cmiXw/y/A/D+RQGEacthmhrKnaE3pQvqblt/Ke X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6560.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(366004)(396003)(376002)(136003)(39860400002)(451199015)(38100700002)(41300700001)(36756003)(2906002)(8936002)(5660300002)(83380400001)(186003)(6512007)(26005)(478600001)(6486002)(31686004)(6506007)(316002)(66556008)(6916009)(66476007)(31696002)(86362001)(8676002)(54906003)(4326008)(66946007)(2616005)(45980500001)(43740500002)(414714003)(473944003)(357404004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?JzBazzGgHiD3SixhtaR8d5+rMFHB?= =?utf-8?q?W4Eq6MBaeKGxN8BgqHVaazUVPhlr+b7T7p5pCJkdNKW8JE6pN2Cfy2x6lH1HSpkcC?= =?utf-8?q?W3BR7GB/2UXTHvTvsyYCQMo+ZUy7y8UkfhJHhYf0uXMfIf1P+C88CWdSnu0RKLzSo?= =?utf-8?q?t0y0JwVgw698GfMzsDksU6VXpYChYU4Z6kAOUsCCne2SfAuFPiYKEFi0I+znwje9t?= =?utf-8?q?vzW92585Y4CXWSzcYQL0al64K8po0HO1r2aUBZXdAf6oqMdtHvoAjFMy+E9MNxfE6?= =?utf-8?q?o62hO2NnHafQ12D6FAXMkUaz8ATE3n544WmmpgFiGiGafS/JqUiFJqKDsEUOj3NiR?= =?utf-8?q?pK86I3Q8njt3XB9H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UBELwyL2fFl8ZtxZD0WBwbgIL/u?= =?utf-8?q?HMLbilQHcm7WB79TIyFeAN2wEKbqnQuFqMSluHN40KCan7bYYDfz47vlzuP0b7nTA?= =?utf-8?q?gfdydzkGpWaTWgxVFnT93HJ4D/a5AtfEm6SJALbmI5KBx6nNw+BkBLesqtiomsreV?= =?utf-8?q?XBYvUpeCykXBJN55i4oFVLUOgtNWzswZuOedMZIyq0pHDsUIm9o+L6ufz6O9ZRbti?= =?utf-8?q?lq7+jGnZy1Hl/uLhnMLbczc5gkaY8/KefSCK9tFqDFuHz0FNVu8Sr9/FykCNYn3h+?= =?utf-8?q?Mm2AEXmsQHZN?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1beecf0d-43f8-45ed-1238-08daef35d7ce X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 15:59:36.0508 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4metWACwmbaaQeyvmJyFj/QJ02e4TS3mtJkR00Uzs+7WPuBxm9GNKFMW+4vEjTVAzi8HKTSsw74kcczGaFmWYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8498 Nothing in there is vCPU-specific. With the introduction of the local variable in sh_audit_l1_table(), convert other uses of v->domain as well. Signed-off-by: Jan Beulich --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -3919,13 +3919,13 @@ static void cf_check sh_pagetable_dying( done = 1; \ } while (0) -static const char *sh_audit_flags(struct vcpu *v, int level, +static const char *sh_audit_flags(const struct domain *d, int level, int gflags, int sflags) /* Common code for auditing flag bits */ { if ( (sflags & _PAGE_PRESENT) && !(gflags & _PAGE_PRESENT) ) return "shadow is present but guest is not present"; - if ( (sflags & _PAGE_GLOBAL) && !is_hvm_vcpu(v) ) + if ( (sflags & _PAGE_GLOBAL) && !is_hvm_domain(d) ) return "global bit set in PV shadow"; if ( level == 2 && (sflags & _PAGE_PSE) ) return "PS bit set in shadow"; @@ -3948,6 +3948,7 @@ static const char *sh_audit_flags(struct int cf_check sh_audit_l1_table(struct vcpu *v, mfn_t sl1mfn, mfn_t x) { + struct domain *d = v->domain; guest_l1e_t *gl1e, *gp; shadow_l1e_t *sl1e; mfn_t mfn, gmfn, gl1mfn; @@ -3964,7 +3965,7 @@ int cf_check sh_audit_l1_table(struct vc /* Out-of-sync l1 shadows can contain anything: just check the OOS hash */ if ( page_is_out_of_sync(mfn_to_page(gl1mfn)) ) { - oos_audit_hash_is_present(v->domain, gl1mfn); + oos_audit_hash_is_present(d, gl1mfn); return 0; } #endif @@ -3994,7 +3995,7 @@ int cf_check sh_audit_l1_table(struct vc } else { - s = sh_audit_flags(v, 1, guest_l1e_get_flags(*gl1e), + s = sh_audit_flags(d, 1, guest_l1e_get_flags(*gl1e), shadow_l1e_get_flags(*sl1e)); if ( s ) AUDIT_FAIL(1, "%s", s); @@ -4002,7 +4003,7 @@ int cf_check sh_audit_l1_table(struct vc { gfn = guest_l1e_get_gfn(*gl1e); mfn = shadow_l1e_get_mfn(*sl1e); - gmfn = get_gfn_query_unlocked(v->domain, gfn_x(gfn), &p2mt); + gmfn = get_gfn_query_unlocked(d, gfn_x(gfn), &p2mt); if ( !p2m_is_grant(p2mt) && !mfn_eq(gmfn, mfn) ) AUDIT_FAIL(1, "bad translation: gfn %" SH_PRI_gfn " --> %" PRI_mfn " != mfn %" PRI_mfn, @@ -4064,8 +4065,8 @@ int cf_check sh_audit_l2_table(struct vc gl2e = gp = map_domain_page(gl2mfn); SHADOW_FOREACH_L2E(sl2mfn, sl2e, &gl2e, done, d, { - s = sh_audit_flags(v, 2, guest_l2e_get_flags(*gl2e), - shadow_l2e_get_flags(*sl2e)); + s = sh_audit_flags(d, 2, guest_l2e_get_flags(*gl2e), + shadow_l2e_get_flags(*sl2e)); if ( s ) AUDIT_FAIL(2, "%s", s); if ( SHADOW_AUDIT & SHADOW_AUDIT_ENTRIES_MFNS ) @@ -4116,8 +4117,8 @@ int cf_check sh_audit_l3_table(struct vc gl3e = gp = map_domain_page(gl3mfn); SHADOW_FOREACH_L3E(sl3mfn, sl3e, &gl3e, done, { - s = sh_audit_flags(v, 3, guest_l3e_get_flags(*gl3e), - shadow_l3e_get_flags(*sl3e)); + s = sh_audit_flags(d, 3, guest_l3e_get_flags(*gl3e), + shadow_l3e_get_flags(*sl3e)); if ( s ) AUDIT_FAIL(3, "%s", s); if ( SHADOW_AUDIT & SHADOW_AUDIT_ENTRIES_MFNS ) @@ -4164,8 +4165,8 @@ int cf_check sh_audit_l4_table(struct vc gl4e = gp = map_domain_page(gl4mfn); SHADOW_FOREACH_L4E(sl4mfn, sl4e, &gl4e, done, d, { - s = sh_audit_flags(v, 4, guest_l4e_get_flags(*gl4e), - shadow_l4e_get_flags(*sl4e)); + s = sh_audit_flags(d, 4, guest_l4e_get_flags(*gl4e), + shadow_l4e_get_flags(*sl4e)); if ( s ) AUDIT_FAIL(4, "%s", s); if ( SHADOW_AUDIT & SHADOW_AUDIT_ENTRIES_MFNS )