From nobody Fri Nov 29 16:29:13 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=2; a=rsa-sha256; t=1632208627; cv=pass; d=zohomail.com; s=zohoarc; b=asXl/+zWsjjetTQ8FNqptboTBECQrFBoPkYu2LR2VS2IeoCHaYNSfCNa3CbhLAM612ZUzzohKcCfg9tDeIfpMTLxEZEx1pMzPkHO8aya8MuTaZFRhVBNqKmRN+6sOKiSoDb3e2PYYguIg615gUOH0b88TQvswGQ7UyvaV0DWuOE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632208627; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4Vo4Dkwt5tDPO7OINdISKIs97Cf1OIMtewg4ko0cXdk=; b=IPTydFbMqFJGBpA0gGXnm91KlfoY46sg/8++/Buxhx9ycnJ+DwUuQwhuGBY0qQm5HTC1jMWUXvDKsKIPR5EjTA3JpWGFg0BpMNLbUxQHzaENGLYGxdQUbs8fBLp5NiPCQTCAYoOHNiSx0iuIyB7Q/Ut9SVBnsBvjufoErQg+sSY= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632208627600227.2613947228848; Tue, 21 Sep 2021 00:17:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.191394.341405 (Exim 4.92) (envelope-from ) id 1mSa1M-0002fH-HR; Tue, 21 Sep 2021 07:16:52 +0000 Received: by outflank-mailman (output) from mailman id 191394.341405; Tue, 21 Sep 2021 07:16:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa1M-0002f6-CF; Tue, 21 Sep 2021 07:16:52 +0000 Received: by outflank-mailman (input) for mailman id 191394; Tue, 21 Sep 2021 07:16:50 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa1K-0002Od-D3 for xen-devel@lists.xenproject.org; Tue, 21 Sep 2021 07:16:50 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.111.102]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e28fbe3e-1aab-11ec-b89f-12813bfff9fa; Tue, 21 Sep 2021 07:16:49 +0000 (UTC) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02lp2055.outbound.protection.outlook.com [104.47.5.55]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-34-phiF_01_OguB7cRVDHqGJA-1; Tue, 21 Sep 2021 09:16:47 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR0402MB3389.eurprd04.prod.outlook.com (2603:10a6:803:b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Tue, 21 Sep 2021 07:16:45 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4523.018; Tue, 21 Sep 2021 07:16:45 +0000 Received: from [10.156.60.236] (37.24.206.209) by FR0P281CA0057.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Tue, 21 Sep 2021 07:16:45 +0000 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: e28fbe3e-1aab-11ec-b89f-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1632208608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4Vo4Dkwt5tDPO7OINdISKIs97Cf1OIMtewg4ko0cXdk=; b=YLAmMJql+qviZW2w0sm47awS0gK6CbF53dEHYt5tZAwGVP3guQ4xiK8BN+nAtRKOrpyYxX 07MT292TFUwmr3p+X9bzeBLSSZ1oJ25mcXJO1LOx+1Hc9f7hFMTm8cuvFpsOJZkvolRn+s oMnxRu+pmb+49nKmikMYK6yYogbRs4Y= X-MC-Unique: phiF_01_OguB7cRVDHqGJA-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NQgFmurlxHLmi94LsZ8bEGJ7Ek0Pib+n055OwWt5ZFrNeep1aGnFLPcaqLl4u3EvOKoT6Q/+OO05Kte9sXPgziaqbu5dajxisVdILiUEoAGsTpRyGy1PkURQekqIdESU6THCf2Pz3mIopKyozCT23ruxLfG6otD9HAzmAZSGSVe8iSB9bo/TJfsgKcEp/QNfc6Lu8VvtV+5IEGMD8sTMI4ZlZj4r/4NzrAIGkzQaY3npNG8ub+9LvweRgfhiqjQmt0J2Lx4LU8XmTm7nTS8BSVkTBDQLzZZQ1wpw64lfCFzPdpVinXZeb2bqrqy8zBHbU2bjdl044DEFwbd8A5Chyg== 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; bh=4Vo4Dkwt5tDPO7OINdISKIs97Cf1OIMtewg4ko0cXdk=; b=c2yTQrNPMpRuTq6SdKe6cOk5q7FGljzNqbvgLWIpJ9t5eON8icAfUDpbrF2vt/qzc1Q890t9uGVj3awpgDaGl9SOkkw3DZDIAIxxoN7fBSC5fBREi3VFd1URZnes2cCT0JNaNbZNGWymymNC6cGm30PUdHBN1o3uiB0n5yMYRZqM9o08XFLlfSs32Gk3VFCUuhf+iJZiN5HwMj/ENvVD8xe9u7/Y2i7ZNpmhRMF+pXyKkhGfQYAsZ4oFaxEyAGs1NYjl7IPYTuN4SNU7jnAyeWqKWZeq0qbB2tVOPjgOD/GHLu3VTPi0SPAawwtdBk9+NRAOzj4+DscgWRr6ASeTrA== 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 Authentication-Results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com; Subject: [PATCH v3 1/9] x86/PVH: improve Dom0 memory size calculation From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <562a9ee5-102e-ee25-e4cd-721e44b7409a@suse.com> Date: Tue, 21 Sep 2021 09:16:44 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR0P281CA0057.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::14) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c4d41e5e-993e-4b71-1358-08d97ccfc503 X-MS-TrafficTypeDiagnostic: VI1PR0402MB3389: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yf6NHN4kfoXQ01MwY35MpmQYsPfONxiyB/+OG0nf3x5frssgcHSO8zvp48//ght2cHYywtALvtBZj+PPm/U8YIZbL4K/uFov2XKc6HvSQ+MpfcHq8+fEUUQPujC+tx7Tha7mD76nRpUcOcg2NShaDg0cKI8ssT6nG7XpDF0do54+1qldebmypfUCo7AsgbcUH7RLKKyY7m44yUEAOuLNFyiGYI1ZSHGBRiT83OiKBHq0vI0DNLbV+n/cS5YFtqomEhJYepv1GiBm1KUpOm8sHUubw418MQ50eS5n1mn0FK7OHX35v+IMQinNQJ7da4JMwR3kSLvEFHEomi1wZ8sqI6u1A+OdkT5TUpGLumc/ljPZiO1ec4Gpm4b1z5Z+77toW11Pya8XyF0iMVh6OodGzMoIc4f2cBp9WiADxU/cVQQib86ZIrq3961L/FupPPo6gJjnFSoPRrKT+ABN70ujus20hJSSTx1L3edMq+rC9lCbIIA97Nq9FSA2TUaCDb216XbcqfUCZZIuN2kil/zTYxV7cVfyn6EQFuHxNYqSEjHujmj75pyHLGmJiv9iYvwe7Nh/barK2pOV5l3s8gXHvY4d1zuP/xFZ4bwA1kghMt85C5/tRWJOjsSJKSakRr2gYq1EfDoMD8lnNurMNIWYPB0D6GdTBhzJgVcMaMuAh+IWyy9myWZKxrQcG779ezds2oWK870c2fzqhSE3dDwSworNrgPZbeQxPefOr+kOcPVvEwZwN/iKvyJ0kki9cLqpqqY7hPrfAXtarJuWzU0k8A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(54906003)(6916009)(2616005)(4326008)(956004)(38100700002)(31686004)(508600001)(36756003)(86362001)(66556008)(6486002)(66946007)(66476007)(83380400001)(316002)(16576012)(5660300002)(8676002)(31696002)(2906002)(186003)(8936002)(26005)(25903002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UFBpWi9PYmQycHV0VXhhVzBDZWh1Uzhlb3U4S2srMXRvNzBVbWRuS280V0dx?= =?utf-8?B?aXRxN2FWam0yaFRVc2IxR3BaWWtDQW4yWnVNdmwzeEtmZDQ3bzZSTHBLOTVw?= =?utf-8?B?V2syT0xXcEh5blh1enRwNFZXWlpGN0xMaWMxK3RTektMRmVOQTNnU2U1NHJT?= =?utf-8?B?M3VPUkY2Z3p0UnZNUTBQa1hNNHJIdm42UExveXRiSS9qQ3BTMTQ5VzdEVzFq?= =?utf-8?B?NlZ4QmxDWFVjZlJEOE1IQldwNFB5aE8wSERLcDM3S29Kb2VxUnkrWG5jNGRz?= =?utf-8?B?ejR3UGg5NFlma1pSeGxTdmlTaFR2cklSVFlmRWVGRy8xVjFhd0pCekdhNFBn?= =?utf-8?B?aFlUR0dhVmo2U2t6SklQakIwN2FldWN5WXJHSnNuTUplRjlxWmFraUp6N255?= =?utf-8?B?ZUR6UkNpTWFGaXdzeEpiUVQ0aEk5SVFxNnhCYWJKV1lmMXFtVGwwSHVCenB1?= =?utf-8?B?cnFCUEhOQX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8?B?Sm03ZFY4aHMrMWFMUFRXYjhuMFpEYTZRZWhIOSs3VU5YQWdtMmszeDBva3Nl?= =?utf-8?B?M3BvNnlYWkN6d2tMTFMvWFo2czI3SGNuTS90ZldzQzdPZXNoOUZ0bmJRcEFQ?= =?utf-8?B?UFo1UUs0QmJWaHJ3QXpBY2lWUm5LV3hRdDR3R204aC9aVUJiK3dGM2s3QnVt?= =?utf-8?B?bFFtbHF5ZUFuU2grZFZQMXZaL3pkbUhmZmZIRTAxdGdDc1ZJbjFMbnZuNjZU?= =?utf-8?B?N0FhWkpRUjFRbzBLQnA1cTlxUWZ6bUFwUDJWRTNZb29rRUN2RDZ4ZHEvTFJB?= =?utf-8?B?eVUvbGNvUUExK0sxOHpTZ1A2UFBmL0RLKzFCd3pOMk1IcG9ZUFg4ZHBFZmFr?= =?utf-8?Q?PfBfyfbZ6jOLdnarADD3Ny3aKQNxx/bpBRFj6zQ?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4d41e5e-993e-4b71-1358-08d97ccfc503 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 07:16:45.6312 (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: YntyIQd1iNOYuPWSIaiqG8+4bSQuZKrR9zUKfLEBuSP1svBKhAIk+7aZYY0u7RhSTcacDa9fXkNHJXGpljr8bg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3389 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1632208628830100001 Content-Type: text/plain; charset="utf-8" Assuming that the accounting for IOMMU page tables will also take care of the P2M needs was wrong: dom0_paging_pages() can determine a far higher value, high enough for the system to run out of memory while setting up Dom0. Hence in the case of shared page tables the larger of the two values needs to be used (without shared page tables the sum of both continues to be applicable). While there also account for two further aspects in the PV case: With "iommu=3Ddom0-passthrough" no IOMMU page tables would get allocated, so none need accounting for. And if shadow mode is to be enabled, setting aside a suitable amount for the P2M pool to get populated is also necessary (i.e. similar to the non-shared-page-tables case of PVH). Signed-off-by: Jan Beulich --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -318,7 +318,7 @@ unsigned long __init dom0_compute_nr_pag struct domain *d, struct elf_dom_parms *parms, unsigned long initrd_le= n) { nodeid_t node; - unsigned long avail =3D 0, nr_pages, min_pages, max_pages; + unsigned long avail =3D 0, nr_pages, min_pages, max_pages, iommu_pages= =3D 0; bool need_paging; =20 /* The ordering of operands is to work around a clang5 issue. */ @@ -337,18 +337,23 @@ unsigned long __init dom0_compute_nr_pag avail -=3D d->max_vcpus - 1; =20 /* Reserve memory for iommu_dom0_init() (rough estimate). */ - if ( is_iommu_enabled(d) ) + if ( is_iommu_enabled(d) && !iommu_hwdom_passthrough ) { unsigned int s; =20 for ( s =3D 9; s < BITS_PER_LONG; s +=3D 9 ) - avail -=3D max_pdx >> s; + iommu_pages +=3D max_pdx >> s; + + avail -=3D iommu_pages; } =20 - need_paging =3D is_hvm_domain(d) && - (!iommu_use_hap_pt(d) || !paging_mode_hap(d)); + need_paging =3D is_hvm_domain(d) + ? !iommu_use_hap_pt(d) || !paging_mode_hap(d) + : opt_dom0_shadow; for ( ; ; need_paging =3D false ) { + unsigned long paging_pages; + nr_pages =3D get_memsize(&dom0_size, avail); min_pages =3D get_memsize(&dom0_min_size, avail); max_pages =3D get_memsize(&dom0_max_size, avail); @@ -377,11 +382,20 @@ unsigned long __init dom0_compute_nr_pag nr_pages =3D min(nr_pages, max_pages); nr_pages =3D min(nr_pages, avail); =20 - if ( !need_paging ) - break; + paging_pages =3D paging_mode_enabled(d) || need_paging + ? dom0_paging_pages(d, nr_pages) : 0; =20 /* Reserve memory for shadow or HAP. */ - avail -=3D dom0_paging_pages(d, nr_pages); + if ( !need_paging ) + { + if ( paging_pages <=3D iommu_pages ) + break; + + avail -=3D paging_pages - iommu_pages; + } + else + avail -=3D paging_pages; + iommu_pages =3D paging_pages; } =20 if ( is_pv_domain(d) && From nobody Fri Nov 29 16:29:13 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=2; a=rsa-sha256; t=1632208655; cv=pass; d=zohomail.com; s=zohoarc; b=Eh0pWncu/MTvnDE3o1xzu/DPx6WNl7hm38pJUppmq5+U0C4FOLMPKl9VnEdXPJEqIYf4Flz3gHgn4s/gI1SS+xx5/48bip0V5Be0IbHIRX18juvw0ahSlD7Je8WMQ024NBwU1eQuWCXV6+f4FOL0NwuQW+oJQiS628PYOSH7XU8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632208655; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MFNiMXoiKa06wTzVJFs8SMvmLCcjsyrCF6I15nLpdgY=; b=Xs3qDXcLXRF7DHrWOayYLByB2z8g2quGjYOAXmXX13cLbjJCLjBeCvMV3/Q9sP9NuyJi+YrF6c4HXUXoACT6KpKCbBnYszfwJReJeGd9mO7+lkIGFt9QD9bzx65y5N4VNA70Ua4//lpLnTW/xi7JG5ZhFU/A5mrXQVxnElUGn5M= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632208655921741.2757323491383; Tue, 21 Sep 2021 00:17:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.191405.341415 (Exim 4.92) (envelope-from ) id 1mSa1o-0003gy-Oa; Tue, 21 Sep 2021 07:17:20 +0000 Received: by outflank-mailman (output) from mailman id 191405.341415; Tue, 21 Sep 2021 07:17:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa1o-0003gr-Le; Tue, 21 Sep 2021 07:17:20 +0000 Received: by outflank-mailman (input) for mailman id 191405; Tue, 21 Sep 2021 07:17:20 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa1o-0003gY-3q for xen-devel@lists.xenproject.org; Tue, 21 Sep 2021 07:17:20 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.109.102]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d06a7d7c-9448-43b7-917e-8e7aa29e0d04; Tue, 21 Sep 2021 07:17:19 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2171.outbound.protection.outlook.com [104.47.17.171]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-35-3s8Ti9AIMfarizSjot36hg-1; Tue, 21 Sep 2021 09:17:17 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR04MB3293.eurprd04.prod.outlook.com (2603:10a6:802:11::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Tue, 21 Sep 2021 07:17:16 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4523.018; Tue, 21 Sep 2021 07:17:16 +0000 Received: from [10.156.60.236] (37.24.206.209) by FR0P281CA0059.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.6 via Frontend Transport; Tue, 21 Sep 2021 07:17:15 +0000 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: d06a7d7c-9448-43b7-917e-8e7aa29e0d04 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1632208638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MFNiMXoiKa06wTzVJFs8SMvmLCcjsyrCF6I15nLpdgY=; b=T8G82C8rBXnrXx4dNUCfLqoFZgVfOZ34RFARepyjE9AYal5RVlIpojY8yE3dsRijT1U7lx QmBaBFzzoY/tGjs4BiGUEftoEkoJxWOpBCvH9RBAfd7F8dpCrFVoGvSDzAkGMS6rAh/qz9 C8qiLYncYnec74vggrc4qr/kcIQl5Xc= X-MC-Unique: 3s8Ti9AIMfarizSjot36hg-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S0pYYLv5LZzVYX05b16L7+HauN2z3XNp7O1xn0TLbo1Wby8DTpgRvZrw4KLuPs1uq98Mun/YJrZBQ2WWXuSJYWNRnxWNka4ICRkdmOxNWrp+Mv9UmJE0DbyxoKwPnYgZq5KbLzfrPzyNVSQ91cqSUiFJdnkR8VB2856ASiJovltcWztKi673ry5W5f7FPsLbgqavLEb8KJoklsiogOhh7AAHiIwRLTeiHS8mintk35CvOyj0O6H9WYnUWaavURpezkV59mA5wg/lzEo/qvkxUXbY/86h4+3aVRFu3IlOT6r8OzJtze2tvWGbiGUJl7eBMwn3shmDCPiFFy9u7Ql9Ew== 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; bh=MFNiMXoiKa06wTzVJFs8SMvmLCcjsyrCF6I15nLpdgY=; b=AHXntWIYCVqrxmvAEZmvpYPPCdZC6BrqTI3wc6Sqj5TbGEdtsFrAoBG/xOT3e3dVhneAUBWcaqsam0fNxVevcRypQc6dadj0pPOxfH53Ey4vWMBKf5znIGPE5A6+o9NWqb0cjkRDHEJ4xkr7eDctQ5GaLVsR1yDXw33Vaz0a8OA5abV0hQEl6Jgh+8jFnS6LAI7kOxrjFGa6b2yUWuzkUM96oo4EnjiHAeVOH9alUp5GgWPI399J/2cvMUA+rzghceLz2CzBx3ycFpK8Y49+4js6dtf902vKaR4mU2rOQdauiowiPEMV/7TPhk+U6G2He6smGHQEzumKIHPcR6Cx4w== 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 Authentication-Results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com; Subject: [PATCH v3 2/9] x86/PV: properly set shadow allocation for Dom0 From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Tim Deegan References: Message-ID: <25958e72-40b9-30ef-a348-6ac9ef02b261@suse.com> Date: Tue, 21 Sep 2021 09:17:15 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR0P281CA0059.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::7) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b117088e-0409-41d4-e185-08d97ccfd73a X-MS-TrafficTypeDiagnostic: VI1PR04MB3293: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VV4IQ4OoTE21WTgek+id9N1AX6i11nUc/sdCJYlQ4Vv++TSyN5VNDFYCFuV9kB5j2GnpmJK4DQyjLz9k+3QxTl5cUpGOvo1w85S6K4IN2Jgrq6CUDraiu0eZ3yAZ5aeiitZuWXUHDprDtAyPkh8X+fvCm2Eak3ZV+wmuEwyAHGL8SIUqwj4hBLtC/VEJT8YKS+mFuVsrTY6I1/4beV5m5kZEpkvseo0CWzLABoxAfNr2mUbI5FuzrM1j8Y4fJaxLIxu7lx7EgXgDTTc7PrmvS005a+uN9eqUWnmLWbtZVm3/rT7AcDoWah4crSfsnMDP6IPS0inXaih6Ydw17MrfPQi9jGBr2uc/UIbbKqUJmnSTCV4sfgD0CM8er54a8/B+HSqxrgXnvGCSmh0OOV2kLcRIK01Ib99pd6WlSVu4AgG4c6SdVGzxUjClY8eSj1T/TXIzUcFuwW+XGmb9dfmZ53FiS+/683gHYUhAqrdpXAVVY/dkl9uJYZN6AKcLA3wYSgjrNL9U+vacVZ09+3pD3XeeSe4USMoU96NblXnZXfXtDnNLoMhj2G4ooyf0qJ1XWo7Ks2YJfjFFHWqpDCL36OdXcdwIiWwDMYFaNC6W4fyURyZmDG6lAGOnaPdB+shTWlu1/SDo/aIolUaslxTR+SD3VLjtdSiOxDqWnB2ZW+AFKUTtjBntNZFhgmHb/yp7jBVsFGw8SkRF0gYb1yuHFpfjTitWUm1UtYLhrKpRQWw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(16576012)(316002)(83380400001)(31696002)(8936002)(956004)(36756003)(2906002)(86362001)(54906003)(31686004)(6486002)(508600001)(66946007)(2616005)(26005)(4326008)(38100700002)(8676002)(66556008)(66476007)(186003)(6916009)(5660300002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YS9mUk9pTjhGRUp1R2FOcWxVbHA5eTRyZDdaNnpES2pvbHhtRVlRNlliZFJE?= =?utf-8?B?VHhvMjlCeXVuZlU4cVVKeTdUeG9BMEVIWU42TEhQSmt2VTJEeDFYT1I3SXc4?= =?utf-8?B?VEdGdkVzRGF3MlFVTFIwajlVSzh6RDRQZU1DMWU4dWY2SzB1MmJ2TlRFVHdT?= =?utf-8?B?YkY1SDlPS2NrUFVGVWxZcGNWajg4WWRIdGJVVnpWZjM3WkQ3TFFCdWkyVGdz?= =?utf-8?B?TGhpb3ZtNTV4VWs1NU9aZ3RlU3kyVUNxLzA0RFR3SXorTUpyYUpzM2lKMXpl?= =?utf-8?B?UlJkTkpCR0FqYlcyKzVFdTNpb2EwRGdPVnVGbHhNYWxlbTM0STVCcWd1dFhT?= =?utf-8?B?QXFCRnpSMTUv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zZXTkNieGI5Rk9oRVB3bUg1NWg2K0lOcWhtdnFnMWV3TTdqZ2lUNEdU?= =?utf-8?B?Mkg3WWxLSHNXQVBXVEpTUnJaTXdaRElGeE0vSlFub1IxRE0rOWp0ek5BQm9B?= =?utf-8?B?bXlOOXNRSUxnNGRnV3o1bHhBbGI0MmhGVmxuajl1Y3I4b296M3JpNjU0NVd0?= =?utf-8?B?c1pUVFFLcnN0WFdvV001S2Nlck1obHJRSWJrdWZSTCtyOHFlS2xrVXR6aHlD?= =?utf-8?B?REMvWnozT2pTLzZNdGdsUk9tbHc4MXB1Y2w3cytQS2NXV0JBZmNkKzVZZXZl?= =?utf-8?B?NGlBQnhzczFzVWsybmpESXpOOXFUSVNSMENxU0tGYWJHYXk3WVdKdHdkTE9K?= =?utf-8?B?NHUvTThxZlpMUDY0RUp5cVNCaGhWVURsN1c1aEd0TThSbU12T093UWp0OHoy?= =?utf-8?B?L1B2dkZ1akVWUjN5Qk55WmxhWWhFeGNvYmhnYzl3RGRWcU9xSmtrcGo1NjVu?= =?utf-8?Q?E1HbRgthSY5SC+WqWMCV6rFXOkxGi5FblTPclpm?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: b117088e-0409-41d4-e185-08d97ccfd73a X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 07:17:16.1969 (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: JZ3n+cYOVUDjh4563IapgqOAZe7RFOXUImThO7pp29Y4ksrd56iE9GMzOXgm9lDW9f4tTIDR4kHhGcFfam5mBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3293 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1632208656394100001 Content-Type: text/plain; charset="utf-8" Leaving shadow setup just to the L1TF tasklet means running Dom0 on a minimally acceptable shadow memory pool, rather than what normally would be used (also, for example, for PVH). Populate the pool before triggering the tasklet, on a best effort basis (again like done for PVH). Signed-off-by: Jan Beulich Acked-by: Tim Deegan Reviewed-by: Roger Pau Monn=C3=A9 --- v2: Latch dom0_paging_pages() result. --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -1298,7 +1298,7 @@ int shadow_set_allocation(struct domain { struct page_info *sp; =20 - ASSERT(paging_locked_by_me(d)); + ASSERT(paging_locked_by_me(d) || system_state < SYS_STATE_active); =20 if ( pages > 0 ) { --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -21,6 +21,7 @@ #include #include #include +#include =20 /* Allow ring-3 access in long mode as guest cannot use ring 1 ... */ #define BASE_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER) @@ -933,7 +934,18 @@ int __init dom0_construct_pv(struct doma #ifdef CONFIG_SHADOW_PAGING if ( opt_dom0_shadow ) { + bool preempted; + printk("Switching dom0 to using shadow paging\n"); + + nr_pt_pages =3D dom0_paging_pages(d, nr_pages); + + do { + preempted =3D false; + shadow_set_allocation(d, nr_pt_pages, &preempted); + process_pending_softirqs(); + } while ( preempted ); + tasklet_schedule(&d->arch.paging.shadow.pv_l1tf_tasklet); } #endif From nobody Fri Nov 29 16:29:13 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=2; a=rsa-sha256; t=1632208676; cv=pass; d=zohomail.com; s=zohoarc; b=PxEmnfMoNuuUihomb8cLnBqkvvyAIa2WTBk18I6DhGEe0KFgJ4eEK4EMsREHGln+/AqWTTraPWX0+B/O2alWFwoR40mF9T6G+18d/RkkFWNM/HlIPdZu48Bu0YSaT5b4ZG1to2VrPh0+RJiU7Q7F6mFbhTI7Mvw7dDZPCwDtXSc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632208676; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Le5BJdNW9ne/Xmuzk0IFXev47snchE6r7a8FNfwFXaI=; b=B7zcMz/syQXx6XFME9NvoSBbcsBRI+xWNcOSKcYUFMzdytKqJlYg5HtzlcMTpjMKJUVwrw0evbulH/REzhXi9Vskd5HDU2XSbq3Jjq7GK/BSswo6JIawwBHeJuZuWDvB4O02YwSA3UKmVXKqUhaky8rLSRly2tSwF8SSv704lOQ= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632208676086677.5492615028269; Tue, 21 Sep 2021 00:17:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.191410.341427 (Exim 4.92) (envelope-from ) id 1mSa2B-0004Gd-2u; Tue, 21 Sep 2021 07:17:43 +0000 Received: by outflank-mailman (output) from mailman id 191410.341427; Tue, 21 Sep 2021 07:17:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa2A-0004GW-WC; Tue, 21 Sep 2021 07:17:42 +0000 Received: by outflank-mailman (input) for mailman id 191410; Tue, 21 Sep 2021 07:17:41 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa29-0004GC-QM for xen-devel@lists.xenproject.org; Tue, 21 Sep 2021 07:17:41 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.109.102]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 325a3e8e-9eaf-40a0-a08c-a5a859c2f989; Tue, 21 Sep 2021 07:17:41 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-5-eChuMQnbM9OtR8qRh1PPBw-1; Tue, 21 Sep 2021 09:17:38 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR04MB3293.eurprd04.prod.outlook.com (2603:10a6:802:11::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Tue, 21 Sep 2021 07:17:38 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4523.018; Tue, 21 Sep 2021 07:17:37 +0000 Received: from [10.156.60.236] (37.24.206.209) by AM0PR02CA0154.eurprd02.prod.outlook.com (2603:10a6:20b:28d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Tue, 21 Sep 2021 07:17:37 +0000 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: 325a3e8e-9eaf-40a0-a08c-a5a859c2f989 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1632208660; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Le5BJdNW9ne/Xmuzk0IFXev47snchE6r7a8FNfwFXaI=; b=A9l1GU7mXI5buJf81fafDwrA5TGWj8njefwNhc8hQlqQAx+o8dGt+TreZYsXJvk2H1+3TP F3t3i6i870w+0pTqSpCQNYCkcS9UClGqfbt4vnRT9fh21jtYoI+8jrBeK+sS6iqqdJDtou 5vxy44IXrhqODou+c97BLSCUIV5qSE8= X-MC-Unique: eChuMQnbM9OtR8qRh1PPBw-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cnlVwtVClkmwJ1yacAro2yUcn1YX3AJVFXaPTI3uISPRttF5md3bt4bzgLbfdHxlYn0ru8z6CbFbRyN+XBab0h5J4/vQx/REo4UeeOHOJdCcv5/cpASccUUFK6U8Exe3Q4Qn1Xa+BB5F/PB36dsy2ZypYZbDUePYmFC/tpK/7leFlDE/UIsYGew0392kRqXxZnjuNCDpnc6jO28SSJW3b58iZB2OlLKXYRs2ZnpKVYQxJ5PyPUzs6MfBoJxGQGGxcZHhV0px0wEZ9BzimigxlI6IVeyPqhoEWA2JimjO/j61F7zFcTM6ZS1vf6h1QqbnblSHmKfGbBQdNlbmzR0clA== 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; bh=Le5BJdNW9ne/Xmuzk0IFXev47snchE6r7a8FNfwFXaI=; b=nd1gnSPL/TPVYL3hiOj9OPt6AS2yi4U1Jk75RsVCfkJuFKdkFFMobWI7k70J/bpR7tGWHnDF48QZe8BVAS0XZ3XtWuBucPVCnwuV8BcZp0m6KGRdqKiP2SsgcDoYY0ar5NM16HAWELPt1hIDsRbqXf+6TNn2SdlWuocZa61xnjr3RNs7ITXvlU/UdilnZTTmiKdR7Spzl4U3aoTXTNeL4sf8UtOzApvnQlux/9CeizTdCf64OPWaghof0bo9bp7Gox0+SjOc5BG+de55y0czOzY9d2iifv4wmSLMlwq1c0Ap3+7HAOvtv1xqfuRZYaqSrh4Kxs7YJb61+HsiIqvAQw== 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 Authentication-Results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com; Subject: [PATCH v3 3/9] x86/PVH: permit more physdevop-s to be used by Dom0 From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <78c84053-3d79-b36d-be03-08b3b3a3d26c@suse.com> Date: Tue, 21 Sep 2021 09:17:37 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR02CA0154.eurprd02.prod.outlook.com (2603:10a6:20b:28d::21) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97c6805a-0f31-471f-e4ea-08d97ccfe42c X-MS-TrafficTypeDiagnostic: VI1PR04MB3293: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sJ9tMjWXdmprCrWK98SbUGnUwiMblG0eEeciQSt6Dk0DTN056yNhOWYk0U5l//h/q6Nict1ck6qW1ml0QtbChX0wZxE5nmbZwDDHI1LAfqlZZguq5xMwNutb1iA0xC9/mjHxd+ctRiAlvAZMmgXMRdjuUxXaKvr56Qgl+7D7Cy+41zPHA+xvYmjk7soyNDKIaq0s0KmPd6twrqVhNl3kI1GFLfkynR2rCRFzTlBgb9kLwqD3JNVvwsgKr/WFSLY4lQPY0x/T7v17kS2lUVFVtLCbrNImIzhDC2H9hgu50lpXVsyS9dAPCSN1jwJ6fpNloeG0Iu2oo9aTHHLd5x6rRiMN8EzGcawO54rw1WREmYXvUm0w5e9UuSO3zmNVDnk6X85EivlSoTw9HQApWGx/lBS4DuoJb+YtNun46ZDIAPNpQazpbwQNkj8yaynZCVK5kBDqPwqR1ucKC28mdDf7zqQ4O9c6pEsNwpOK9AjgqaYFcAoS+hAvLqaiKAULSbBKQ52GqbyLZJoA+fpcxC4iERHm4BmiqyvRbVO8QT2BsjYblY7bNeoZf0D07hWKS8OOpGAo48WwVgc9Jg557VrbCtwRh3jwOP7U34esEpP0+nUuIYMr4jXuDk5z1WT/hkV2ahjh5IPZUd5M8vTZYwIplUh5Q+ZcKuXZuDvz/O9U7uHXxf0mEAEvHAC6Cp60LE/TIfB4i/Frqephz097CDmEQPNnTIsYreK2FUl2damey+U= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(16576012)(316002)(83380400001)(31696002)(8936002)(956004)(36756003)(2906002)(86362001)(54906003)(31686004)(6486002)(508600001)(66946007)(2616005)(26005)(4326008)(38100700002)(8676002)(66556008)(66476007)(186003)(6916009)(5660300002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZW5FWG90clhZZzc1VjFEa1lXaUxMdUR1OUJEY2E0cDFhRUtKMWxtTkZUOHhU?= =?utf-8?B?Uzg1anZ0Qzcvby9wL00xSVJJclZIamNweGI2ZUZia3RGdGUwZGFVWTZXamhQ?= =?utf-8?B?OE0yS1FXZnRnWXRlV0xFalREbU5SUXFrNkpsVWN3NmVEUCs1VnM2cGFUZC9U?= =?utf-8?B?d281akVYc0pQM2NSblFyNjRyZWhhcVdybi9sdjRGclZTbnJKdzhJKy9NUWoy?= =?utf-8?B?M2lsTkVmbWhqbHlMbzVGaGNMY1BoOXFXTUREUkJDd0R1ajVRNnNvaTBEYXRo?= =?utf-8?B?cEgzRTRpT3RQTFhEODN6RnJiVENDVUJKcG1scCtWVXJ5ZURYQU5OeDZUWmZS?= =?utf-8?B?M0J5NkpLdGs3c3B5Ym5TWjRubWJ3Wk5ZalhyT2ZmZi8vWC9mcUZFQjg0M2Nh?= =?utf-8?B?S3Q5R3AwYkRPY1lyTVlJR0N3S1U0M1QwY2E2amhadnBVUTVkWXo4M2lLcG5D?= =?utf-8?B?b3F1ckNoRDBEMmRXNCszeFhPQXA3TjNldTE0MTVXd0lSdEluVFZiQ0h2L3hr?= =?utf-8?B?ekJtTW16eFNGTkR1eXBRVkFJNE01VFh4d0taWkViZHQ2dFF5TFByTUpxaFZn?= =?utf-8?B?UUtjK0xsOGNKYTFZcnpzYmt3Z1IyZnpRdmdlRG1XT0QxQS83SC9PNFA4Wm1O?= =?utf-8?B?ei9KVzdBVWFlMTQvVUhvNnh1ZHBmMjFhSnE3eVlaWUdnczFDREFubG1zZHZs?= =?utf-8?B?bXNERjlLRVNZS3hyaUhDcXpZT210dENW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VvRmpPRXpZZ0RmY01IVUt5RUM4V2xlMkJic253a3pMTWVzUDNi?= =?utf-8?B?YnkrRVNwQXg3a0VxUkhoelpDUnU5cFR6YUNHa3J0bE9nSnFmb0taUnE5TEdz?= =?utf-8?Q?cOu8c3PLYnK9OEtkDsVLkMAlwwFKBQJZ1MXIF5w?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97c6805a-0f31-471f-e4ea-08d97ccfe42c X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 07:17:37.9216 (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: 1SOn0nmxyIpiNa4GGLBTPAAscpU9iU2OImNjof6+o3lAirSvzjUDaO4WZOudbiZwDYqLt+hU/W9DsdgJK/JxaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3293 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1632208678084100001 Content-Type: text/plain; charset="utf-8" Certain notifications of Dom0 to Xen are independent of the mode Dom0 is running in. Permit further PCI related ones (only their modern forms). Also include the USB2 debug port operation at this occasion. Signed-off-by: Jan Beulich --- I'm uncertain about the has_vpci() part of the check: I would think is_hardware_domain() is both sufficient and concise. Without vPCI a PVH Dom0 won't see any PCI devices in the first place (and hence would effectively be non-functioning). Dropping this would in particular make PHYSDEVOP_dbgp_op better fit in the mix. --- v3: New. --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -94,6 +94,12 @@ static long hvm_physdev_op(int cmd, XEN_ break; =20 case PHYSDEVOP_pci_mmcfg_reserved: + case PHYSDEVOP_pci_device_add: + case PHYSDEVOP_pci_device_remove: + case PHYSDEVOP_restore_msi_ext: + case PHYSDEVOP_dbgp_op: + case PHYSDEVOP_prepare_msix: + case PHYSDEVOP_release_msix: if ( !has_vpci(currd) || !is_hardware_domain(currd) ) return -ENOSYS; break; From nobody Fri Nov 29 16:29:13 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=2; a=rsa-sha256; t=1632208708; cv=pass; d=zohomail.com; s=zohoarc; b=ah8sQjTtYAFMVjmSQMmrFS0PyOUAQNxgnnEVC7yJPDjjFFqLKikUC9q5Eq30tei6affzqAZT5I0qa2e+fAtoFaYhR2sPiW7s1tj8EK/BCUULVvbaT+XInfUKKCm5/xSsek5lOsue+YpGS3Xdbic9rRVUD0gFU9dgTSgLRY8//DY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632208708; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=52koP07e3NaHR5tP62Xc53aym67B0vZJLqdc3ZgaWY8=; b=J4FXImoakhl+la4uPK/+i5opAFnEKOM03aqDh2jfhowZv539sypSPq9b5KggmXBWePwVFPPFkKPJS5uhFyKSZioCnP1q9/m8AbEs1aEjz34EXfzHMPgV97tsZ/TYhLWtU2FFez+x0ZAaVKHguwfEHvGKK7wsn5oNXyN9iDbtHts= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632208708492429.6333356951727; Tue, 21 Sep 2021 00:18:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.191421.341438 (Exim 4.92) (envelope-from ) id 1mSa2e-0004yu-ET; Tue, 21 Sep 2021 07:18:12 +0000 Received: by outflank-mailman (output) from mailman id 191421.341438; Tue, 21 Sep 2021 07:18:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa2e-0004yl-BE; Tue, 21 Sep 2021 07:18:12 +0000 Received: by outflank-mailman (input) for mailman id 191421; Tue, 21 Sep 2021 07:18:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa2c-0004y8-Fl for xen-devel@lists.xenproject.org; Tue, 21 Sep 2021 07:18:10 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.111.102]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c7599eb2-73d9-48c5-b499-691ebcd457a6; Tue, 21 Sep 2021 07:18:09 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2174.outbound.protection.outlook.com [104.47.17.174]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-24-_46qPZCjNa6EFG6pHLvE1w-1; Tue, 21 Sep 2021 09:18:07 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR04MB3293.eurprd04.prod.outlook.com (2603:10a6:802:11::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Tue, 21 Sep 2021 07:18:06 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4523.018; Tue, 21 Sep 2021 07:18:06 +0000 Received: from [10.156.60.236] (37.24.206.209) by AM0P190CA0029.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16 via Frontend Transport; Tue, 21 Sep 2021 07:18:06 +0000 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: c7599eb2-73d9-48c5-b499-691ebcd457a6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1632208688; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=52koP07e3NaHR5tP62Xc53aym67B0vZJLqdc3ZgaWY8=; b=RPd46UMZtmtMZ4jckRbW6fZf6vxV68eutVjz09cPyOPaZse1TdVVafVjfWQyPhL+Xm6hbT +YL3zAqUKp6mXkXXKiWtgrl1nSo/8fVuWXkAVdUQ61IuoSHo+85p7IagztGFVS7tUeaBSc PptyrfMpu2CDMETLS5LVtFXbXPkN58c= X-MC-Unique: _46qPZCjNa6EFG6pHLvE1w-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UbRThvdDBVayNVbt2MvjeYXE6UYWlef5lu8TZc1+dNew7bOh1UkT8SSjkVbYlK9XlCrkVYE5BofDBUxzA8pnvxRk/SYBvE3QOg4OF46ADy7IVv+Tx4eiZ0xG7HCRUpJ6om0xooIshtMNNJJZUNOZ22B46loPw93laOfb0PgV+t9Rf8nUFL1WCmnR8U7iamDw6mHdaIEOchD9hbLoYVBODhBo3nHalJiuUx0ow2GAfC3uCJTxD5EBJN/4gnL2AfEniJ/f88w58qi9TyWKY1BPZpfPJKf/JUY7C+3eEtvxbsmAQqQrSGYW7hzBJLHGqhZwVCq4CR11/Y/g/5O5G1X9eA== 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; bh=52koP07e3NaHR5tP62Xc53aym67B0vZJLqdc3ZgaWY8=; b=RvAM4xaN7snbVlZnp8LCn9br8VBxGwnzEGaZkyLLQsNqHk3lutxVSK1Jpif64ApGcsO0dfuqiZnsNtXseOmTlOocgo+2CZKAjq3bwBT1j8gUsmOHA7q127kD0vXWvtmem7GFDql3Sputr4XYts2ijciGyv2wDRGPGquHV22388Htsl3uaa13qHtXl2rzvFj+tkI52J1Ed26fnpVvLVy6jBNUbcpMHJBxd7xMqzUFCJHSnKFS7DmDBA9SDXfndqVJaz3NAboJlVdDLC3mU9cUcysaMS76ohEV83Ppp8/uJ75MHxJnVLnss5WMzy3cHxCelb9C9vDircJawsNQsnZXRg== 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 Authentication-Results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com; Subject: [PATCH v3 4/9] x86/PVH: provide VGA console info to Dom0 From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <215e2ea4-cb49-7d94-7f97-c6b81e522a60@suse.com> Date: Tue, 21 Sep 2021 09:18:05 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0P190CA0029.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::39) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dc55bae7-f929-421c-52d3-08d97ccff532 X-MS-TrafficTypeDiagnostic: VI1PR04MB3293: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 82q5LXkChGB0DZawfOcqS7gbPxNFrD2ouq7+J/Xv+MiqcYUBMpOABgLxl+WQSGwHwG+n38WVrtiQOxG8lAdycMO96kpjbbSgCQufz0b+9DjFfe5vMF7VjMytFse22FTHzgdD++zNVRTcNlziIxuxS04LCVfdDIzmA4shboTvBAinlktxNY+45iqxuRlmLGdbZhcCOxMdWmgigH/pPm+5T8cJ6O9xJ0hVnRqprle2BQpilqFpj7jFkPank3GW/U7qPdBYy0+iLflLCTfweV6id05CI29VB5tB9jSyPMBEKiFXF0Wygbml5dlBlRyASR8ZdEV6UMlNQZb+LMBMtnd/Ha4oGbxl3s86CGIRFdeNfsIa3repJ8cQ0vTqyIHpJSJMaX49cl9MrsaTv9gnHixD+JNyprT3iFSMBpJhBVIRu0GHi72BPPWF8fnZrT4HAHEd78wILyCqZ+trDkbo+rE3RFoG74iVkbPFoDafep8d5ED3mEd0i0Tun8bcjF4II4BvkHZ0EUmv19vNfE4IYtY1D26abXH4Lx7HaINLxRUkUke6c5bcWfgNEtpWlpFXqZ4TEjYQgVk6qMU5gnCjnxDEdjve1RdaZork2zUd4pxzvN8QmBAF9BOsRW5EI4mYC2FZ63wdX0J22bJSwYZPJ2JsQTX48cpx/uuSH/XrA/akz6rxCi15l6lnMqThQ9ZaVs5WpJyK4pXsmUn2URRdT4k70mvoF6r8iybUjPnV/Je1VOq8sCo8RXOxlU3z1TvJpXCO X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(16576012)(316002)(83380400001)(31696002)(8936002)(956004)(36756003)(2906002)(86362001)(54906003)(31686004)(6486002)(508600001)(66946007)(2616005)(26005)(4326008)(38100700002)(8676002)(66556008)(66476007)(186003)(6916009)(5660300002)(21314003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bVVuUExkQmMyNFdoR1JJNTVxcDY3YnE0UDllOEtQVzE3WDQ1U0lkSWNFWDkw?= =?utf-8?B?OVZ2Y3U4VmdqditiMlluNm9tZXdOdkZNTjRkSkc5TGlVMlNXSGNJaVh4TWhk?= =?utf-8?B?dVV3TDEwTE9lZTVhWmxGVEFmVXkzYVdhYTNqVnhoNkN0eEJyYndNQnZKZ0Js?= =?utf-8?B?a3c5Q1Fvc1kzaWFWQ1BlRzFyaUgxSXU4L2FRSDBQL3BLL3FmTUw2alQxWWF3?= =?utf-8?B?S0kvSkZOZmpuaU5CSjM3KzlBMkNxeTY4RjF1d3F1cTVVS3JuTDhDMTR5b1Rk?= =?utf-8?B?djJObjh4T0liZ2FCZkhtNkZhVEUzYjNqckU0OW10elB2U0ZnOW4wck80eFZv?= =?utf-8?B?MVArUWdVMWVrU1RsK0I1cHdsZWhaU0I2L1NINVhobHJaWFZYMlNVenZuUjh3?= =?utf-8?B?ZmdEa3E3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zJC?= =?utf-8?B?Ym9ZMEFOVnZPbDNsRHBVUHcyWG5LU0tWYlJVU0Z3dG0vTlpuMTZWZ0NhMkZo?= =?utf-8?B?K2FtdXE2NEcwQmk0RDJGUzVaVGRJMGZ1Rlk0YUdaRDhSdnQwaVdyWm1BUkNa?= =?utf-8?B?SjgyWGdZRmozcnI0Uy93TU9sTnc5OXY3ZkVtd05ZSkdCdEZMY1BnWlptVHM2?= =?utf-8?B?WEluTWt0TG4ycFJZZDdhY2tOV1g2blk1ZG1sUEp3TGZmUUJjWXdnandIQ1hF?= =?utf-8?B?MHdxSXpEbURyR1BzdWsreThLT1kyc3pZMmUvVmZIV2VWWU1haUVTdGpMTHFr?= =?utf-8?B?bEJQMWR5Vlp4b3V6N3ROTkdLZ2s1VDFLZkY5R3V5b3hPZHpCTFNaT0t3Yjdr?= =?utf-8?B?aWtyL2R4empwWjFQa2ZLMVFIUjFZcDErZVBPR1dkdlkySk9YUkxMcFVvdE8x?= =?utf-8?Q?ZyFouIQ+G7Y0BCKrvZGbRu65TloD5Xl9Qom198M?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc55bae7-f929-421c-52d3-08d97ccff532 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 07:18:06.4805 (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: Obme7KzxnDdnISlUP0hQRyt6iuxFFL+Ica5tJ9PqiaE9bpD5/ev5GvEcGKpJaXf74BYAuVrH/66574w6xM3WDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3293 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1632208710396100001 Content-Type: text/plain; charset="utf-8" Like PV Dom0 in order to use the console if in a mode other than text 80x25 the kernel needs to be provided information about this mode. Bump HVM start info's "current" version to 2 and use a previously reserved 32-bit field to provide struct dom0_vga_console_info's position and size. Signed-off-by: Jan Beulich --- v3: New. --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -19,6 +19,7 @@ */ =20 #include +#include #include #include #include @@ -549,6 +550,11 @@ static int __init pvh_load_kernel(struct paddr_t last_addr; struct hvm_start_info start_info =3D { 0 }; struct hvm_modlist_entry mod =3D { 0 }; +#ifdef CONFIG_VIDEO + struct dom0_vga_console_info vga_info =3D { 0 }; +#else + struct {} __maybe_unused vga_info; +#endif struct vcpu *v =3D d->vcpu[0]; int rc; =20 @@ -598,7 +604,7 @@ static int __init pvh_load_kernel(struct * split into smaller allocations, done as a single region in order to * simplify it. */ - last_addr =3D find_memory(d, &elf, sizeof(start_info) + + last_addr =3D find_memory(d, &elf, sizeof(start_info) + sizeof(vga_inf= o) + (initrd ? ROUNDUP(initrd->mod_end, PAGE_SIZE) + sizeof(mod) : 0) + @@ -672,6 +678,22 @@ static int __init pvh_load_kernel(struct last_addr +=3D sizeof(mod); } =20 +#ifdef CONFIG_VIDEO + if ( fill_console_start_info(&vga_info) ) + { + rc =3D hvm_copy_to_guest_phys(last_addr + sizeof(start_info), + &vga_info, sizeof(vga_info), v); + if ( !rc ) + { + start_info.version =3D 2; + start_info.vga_info.offset =3D sizeof(start_info); + start_info.vga_info.size =3D sizeof(vga_info); + } + else + printk("Unable to copy VGA info to guest\n"); + } +#endif + start_info.magic =3D XEN_HVM_START_MAGIC_VALUE; start_info.flags =3D SIF_PRIVILEGED | SIF_INITDOMAIN; rc =3D hvm_copy_to_guest_phys(last_addr, &start_info, sizeof(start_inf= o), v); --- a/xen/include/public/arch-x86/hvm/start_info.h +++ b/xen/include/public/arch-x86/hvm/start_info.h @@ -33,7 +33,7 @@ * | magic | Contains the magic value XEN_HVM_START_MAGIC_VALUE * | | ("xEn3" with the 0x80 bit of the "E" set). * 4 +----------------+ - * | version | Version of this structure. Current version is 1. = New + * | version | Version of this structure. Current version is 2. = New * | | versions are guaranteed to be backwards-compatibl= e. * 8 +----------------+ * | flags | SIF_xxx flags. @@ -55,7 +55,15 @@ * | | if there is no memory map being provided. Only * | | present in version 1 and newer of the structure. * 52 +----------------+ - * | reserved | Version 1 and newer only. + * | vga_info.offset| Offset of struct dom0_vga_console_info from base = of + * | | struct hvm_start_info. Optional and only present = in + * | | version 2 and newer of the structure when + * | | SIF_INITDOMAIN is set; zero if absent. + * 54 +----------------+ + * | vga_info.size | Size of present parts of struct dom0_vga_console_= info. + * | | Optional and only present in version 2 and newer = of + * | | the structure when SIF_INITDOMAIN is set; zero if + * | | absent. * 56 +----------------+ * * The layout of each entry in the module structure is the following: @@ -139,7 +147,15 @@ struct hvm_start_info { uint32_t memmap_entries; /* Number of entries in the memmap table. = */ /* Value will be zero if there is no memor= y */ /* map being provided. = */ - uint32_t reserved; /* Must be zero. = */ + /* + * The following sub-structure is only present in version 2 and newer + * when SIF_INITDOMAIN is set. It is reserved in version 1 or when + * SIF_INITDOMAIN is clear, and absent in version 0. + */ + struct { /* Coord-s of struct dom0_vga_console_info= . */ + uint16_t offset; /* ... from base of struct hvm_start_info.= */ + uint16_t size; /* ... of present parts of the struct. = */ + } vga_info; }; =20 struct hvm_modlist_entry { From nobody Fri Nov 29 16:29:13 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=2; a=rsa-sha256; t=1632208770; cv=pass; d=zohomail.com; s=zohoarc; b=WDjey+ioVxlRqDayjlt3WbZdJbsN+jTlCYQ00/GE5d2ARHeGYbIykslBMEFSZap9zzH/1eY845LDCOnk42SlPunN6u2yFtcW8oYZf8Ixm0rVN+tXF3L6SVLKYfaE0bNShaRMYbbCtqDPjsMgwcXnlAIC1AuEfRPXO0G649/j1aQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632208770; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kOHPUdSszd1R6FGaIvuWyobel0/L1w9ZbdVwz40lrjw=; b=MumQOPyL42eh9YLZKWeEz0kDU0njJigBoRU2FsIGq3ObW2GrWnAOuw7aUWXkSILpxQd7V7LzYZv+6r5imJsl7km1zTONgXQrRZU+n5tdwdxs5ML9RcbRCd2FodBjFtt2+MOOpRiUpUhsMkXw4XUxbylvgxzGZg/46tqYj+pDcIc= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632208770382924.7438729378807; Tue, 21 Sep 2021 00:19:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.191428.341449 (Exim 4.92) (envelope-from ) id 1mSa3e-0005hB-Oo; Tue, 21 Sep 2021 07:19:14 +0000 Received: by outflank-mailman (output) from mailman id 191428.341449; Tue, 21 Sep 2021 07:19:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa3e-0005h4-LT; Tue, 21 Sep 2021 07:19:14 +0000 Received: by outflank-mailman (input) for mailman id 191428; Tue, 21 Sep 2021 07:19:12 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa3c-0005gl-QK for xen-devel@lists.xenproject.org; Tue, 21 Sep 2021 07:19:12 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.109.102]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3ee276b3-60c2-434f-88e2-2188a7c33695; Tue, 21 Sep 2021 07:19:11 +0000 (UTC) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03lp2055.outbound.protection.outlook.com [104.47.9.55]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-19-IqfAnf8hMJiXfa4CvRlazA-1; Tue, 21 Sep 2021 09:19:09 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR04MB4190.eurprd04.prod.outlook.com (2603:10a6:803:4b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.15; Tue, 21 Sep 2021 07:19:07 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4523.018; Tue, 21 Sep 2021 07:19:07 +0000 Received: from [10.156.60.236] (37.24.206.209) by FR3P281CA0056.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Tue, 21 Sep 2021 07:19:07 +0000 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: 3ee276b3-60c2-434f-88e2-2188a7c33695 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1632208750; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kOHPUdSszd1R6FGaIvuWyobel0/L1w9ZbdVwz40lrjw=; b=Pj8RS6sueAeoZuysgJQ6xuwCOBzOoGmloV3D4sfJPAdkxhiRULGGlN0+lfJqf90B7x2ppm 1gWrlF9bhBH7pvL72bxq7orDFQqSC4SAUmrRgOlqnPjXUwI+wf5/oZ9NqCPNWdQBmrQfDf KkMOOMUTRSgcLOB+IGvvG9NWNx8OR2A= X-MC-Unique: IqfAnf8hMJiXfa4CvRlazA-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YQsC5t1qnE4ToYU8KWXjKGb6ULOHbYu1/J4LvakQPdtBR3ecLi09fMTFwp+cVCRhJ6fefLvhoONDwIdaUJhSKX4mcrFgf7Vu06hO5XPTCrhCoAf/4bLcI9iB/DgBdPd+tHd4YBTSqtaKIJd1uC37kvnj0itfGj5WaTSsfat4xdhNacUCc4M62DQA9w9gpgI+ju8KRQJwgEfWU97lYe2aYy2g6BURSwxXfU3nyk5DPsaz1j8woHIFkETEkHCL0fEoR4RH1fbydU35EUfoyitAEGITXgVToHsRp14kDattxHfb5qyAqhoAp7/vOirm+ANafJRTDW8lKqe2l7aaefrT3Q== 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; bh=kOHPUdSszd1R6FGaIvuWyobel0/L1w9ZbdVwz40lrjw=; b=BeUyHrsCvxNJVgi5tRdNxILXpJChThXQX55vbv4socxfSiALYJT+g9OMflrxdzHTuKh4OAAs9MwILSK/FXMIW2J6C3aoPvxdi777040g9nJm9fPWR5IHgauQA7ci1bnD5qk44L3T8dZgmauyvjm2y0SQ6u7uGamPi0uxacnDF23FqoyMjOle1dOkYgOz2qa/H43uFBTv/Lg2dzckGpYOHrmtjK4WItltjvxZQaKnloaQ/FxERzQLHOUbwX3u140R58Ofu1PX2u1QXqo3Yta/dx+LqPcn4HYt5f0vy0EWu1Crhy65TGP4+Y8rZ9Z2FI/VfP6gR2v39QGQTyV7WugzvQ== 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 Authentication-Results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com; Subject: [PATCH v3 5/9] x86/PVH: actually show Dom0's register state from debug key '0' From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <4ae1a7ef-d6e8-75db-ddf5-987f10175196@suse.com> Date: Tue, 21 Sep 2021 09:19:06 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR3P281CA0056.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4b::6) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 28c134b1-4b59-425d-1804-08d97cd01987 X-MS-TrafficTypeDiagnostic: VI1PR04MB4190: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cn1h9ducNgRNq3NeT/9DLNgN8VLEtbmdddDU+eS84S5DQ26p7/kO2uoaUH1X84odJ1L81H4cgJrGK6xKIUYOkyuE5yctANU93ulOc/YCxcAcnht6l9uX0wAnlYSmi+teyekYE7UoImlLhCLoZJRbHZKtmLy87AlqlxKitdJRzH2TA2vQ8TfgKRdRwqfUZFFL1c2djsBq1rmREc+uv43i/Ez17R4NJ8uRFe0pM2rKfIChtBBlJ2KJHQHtQHj3CS1S6HgXBPXdKaHUWlIq4anQLS95X+Am+qPPMMIPhHF4cjrr0wUDWykYeNiMRDA3VyxT1K6d/3FbnAldNxnbASXj4G0pOHvWU3eOQ0HDwWK7qqEDUE0TuTquQu3S27XEi2vItmgm9mcfOBSCxYGqTzLXozPMzfu4cMFGkRpMihlHOOKxugXor5Ore8zI0lN+8bp++1Bab+5ai1XODvulZHnX8gOQlDAQGlrAppFfM1URhoyKENsl50wXudPlN0rh9efrA2VLWv6ItcOIP4qLOfT7JTIhVQJvNnnsARi8hgUs5+GQ5FG4H9iibVfJtuftaePafdL+8afDLL0GtSJXICqkNnLtl0huBDhVbzxjU7oCPwSmnpfworPKBksx/2ha3+0COTdkDt+xfdfdb+q908bjWchd0bC9dJiIVTnBR33Ws4FfLO03jxc6pvIG1Q1p0rcvTe5xD3ebDECgCsUD0q3BWQHnTA3Vj9oGVI5O0fEAt7E= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(2906002)(26005)(8676002)(186003)(36756003)(86362001)(66946007)(66476007)(16576012)(6486002)(66556008)(38100700002)(8936002)(5660300002)(508600001)(956004)(31696002)(31686004)(4326008)(54906003)(83380400001)(2616005)(316002)(6916009)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eVlCZnRyMVp1NjhjTS9RcHNLL3BPOW1aRFhGd1I1bFJWOS9MUlpyYmhLOUUw?= =?utf-8?B?R1BDckt3ZUxIM1MxVmcwUWZ6R2NqYU5rUGYwYWJRcWRqbWN1Vjk5ZDEvajM2?= =?utf-8?B?eTVZRTZnOHY1ZFBmelNJSkpBZk1BT2k5cDFFRmtSQ3VyRjZobnRja2ZpTUUx?= =?utf-8?B?Y255aDFMbUFzMFp0aGFQSWRJOEUwMFRkL0I0Zmsxem9yWk9tT2R4NDM3Slo0?= =?utf-8?B?b3Q0WGZVTE5wUTRka0dQWHhjdnVmUCttMWpqa2FpTmxacUYvTjdybnpQTTlF?= =?utf-8?B?OGp5R3JHUnlqN2p1bmhHUzZPTFozWEl2Q296OFRVa1FTWkVBNHlwSlVrWWEy?= =?utf-8?B?QWNudEdxY2xVbnBVVW5WcklFSWVWcHhpTUdNZlphOFE1Z2czL2hUajQ3Mm1n?= =?utf-8?B?SFUrRmhweEdKWExlZm1HcDFaSTBjWlVFWUFjM1Q0c1BCV0QySldmSTNUdVl4?= =?utf-8?B?R1N0Sk1ENldEd1hhbUZpeU9neVQ5cVFYeWVzNElocGFRZHhwa0plZVJGREly?= =?utf-8?B?R00xRDJYNEN3TUNTUlpnM0tjU3hMVWQxSjJxNERSSVpBcGVLK1IveUlhelhv?= =?utf-8?B?Wmt6c2syV3NGdm82Ym1KM2gvN0NKR0F3SCtoano4clEyZVZRZVdsZi9kaW55?= =?utf-8?B?WW1hR015dFZHejRsc3lCRU56RXZwQXNPdzZDUnJKUVlDUHRuSU43NFBieGNL?= =?utf-8?B?MU1vN0xlcUhTVjdyekVtOHhQRnM1enU1NVBmajJyeVd5WmhlVFp4dUJrd0VE?= =?utf-8?B?K0o5V0RSSStERzNYbThranJvQXduS1Q3bHVS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QxcC9FTkphSDhvNWJyalhSdnpwS2JVU3NOeloreXkw?= =?utf-8?Q?RAJM8uteG/mLXMwPWgliTZLTIAgD4SOdU7Kdysj?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28c134b1-4b59-425d-1804-08d97cd01987 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 07:19:07.4200 (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: niCjkYQ3aKdW4oQpO0dESCxLK60zKsFooAqyUCZwDg61+IXks1lCXKIik02e1cZNs3sEyTy/QCzeLTBe5gyLcg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4190 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1632208771475100001 Content-Type: text/plain; charset="utf-8" vcpu_show_registers() didn't do anything for HVM so far. Note though that some extra hackery is needed for VMX - see the code comment. Note further that the show_guest_stack() invocation is left alone here: While strictly speaking guest_kernel_mode() should be predicated by a PV / !HVM check, show_guest_stack() itself will bail immediately for HVM. While there and despite not being PVH-specific, take the opportunity and filter offline vCPU-s: There's not really any register state associated with them, so avoid spamming the log with useless information while still leaving an indication of the fact. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- I was pondering whether to also have the VMCS/VMCB dumped for every vCPU, to present full state. The downside is that for larger systems this would be a lot of output. --- v2: New. --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -631,6 +631,12 @@ void vcpu_show_execution_state(struct vc { unsigned long flags; =20 + if ( test_bit(_VPF_down, &v->pause_flags) ) + { + printk("*** %pv is offline ***\n", v); + return; + } + printk("*** Dumping Dom%d vcpu#%d state: ***\n", v->domain->domain_id, v->vcpu_id); =20 @@ -642,6 +648,21 @@ void vcpu_show_execution_state(struct vc =20 vcpu_pause(v); /* acceptably dangerous */ =20 +#ifdef CONFIG_HVM + /* + * For VMX special care is needed: Reading some of the register state = will + * require VMCS accesses. Engaging foreign VMCSes involves acquiring o= f a + * lock, which check_lock() would object to when done from an IRQs-dis= abled + * region. Despite this being a layering violation, engage the VMCS ri= ght + * here. This then also avoids doing so several times in close success= ion. + */ + if ( cpu_has_vmx && is_hvm_vcpu(v) ) + { + ASSERT(!in_irq()); + vmx_vmcs_enter(v); + } +#endif + /* Prevent interleaving of output. */ flags =3D console_lock_recursive_irqsave(); =20 @@ -651,6 +672,11 @@ void vcpu_show_execution_state(struct vc =20 console_unlock_recursive_irqrestore(flags); =20 +#ifdef CONFIG_HVM + if ( cpu_has_vmx && is_hvm_vcpu(v) ) + vmx_vmcs_exit(v); +#endif + vcpu_unpause(v); } =20 --- a/xen/arch/x86/x86_64/traps.c +++ b/xen/arch/x86/x86_64/traps.c @@ -49,6 +49,39 @@ static void read_registers(struct cpu_us crs[7] =3D read_gs_shadow(); } =20 +static void get_hvm_registers(struct vcpu *v, struct cpu_user_regs *regs, + unsigned long crs[8]) +{ + struct segment_register sreg; + + crs[0] =3D v->arch.hvm.guest_cr[0]; + crs[2] =3D v->arch.hvm.guest_cr[2]; + crs[3] =3D v->arch.hvm.guest_cr[3]; + crs[4] =3D v->arch.hvm.guest_cr[4]; + + hvm_get_segment_register(v, x86_seg_cs, &sreg); + regs->cs =3D sreg.sel; + + hvm_get_segment_register(v, x86_seg_ds, &sreg); + regs->ds =3D sreg.sel; + + hvm_get_segment_register(v, x86_seg_es, &sreg); + regs->es =3D sreg.sel; + + hvm_get_segment_register(v, x86_seg_fs, &sreg); + regs->fs =3D sreg.sel; + crs[5] =3D sreg.base; + + hvm_get_segment_register(v, x86_seg_gs, &sreg); + regs->gs =3D sreg.sel; + crs[6] =3D sreg.base; + + hvm_get_segment_register(v, x86_seg_ss, &sreg); + regs->ss =3D sreg.sel; + + crs[7] =3D hvm_get_shadow_gs_base(v); +} + static void _show_registers( const struct cpu_user_regs *regs, unsigned long crs[8], enum context context, const struct vcpu *v) @@ -99,27 +132,8 @@ void show_registers(const struct cpu_use =20 if ( guest_mode(regs) && is_hvm_vcpu(v) ) { - struct segment_register sreg; + get_hvm_registers(v, &fault_regs, fault_crs); context =3D CTXT_hvm_guest; - fault_crs[0] =3D v->arch.hvm.guest_cr[0]; - fault_crs[2] =3D v->arch.hvm.guest_cr[2]; - fault_crs[3] =3D v->arch.hvm.guest_cr[3]; - fault_crs[4] =3D v->arch.hvm.guest_cr[4]; - hvm_get_segment_register(v, x86_seg_cs, &sreg); - fault_regs.cs =3D sreg.sel; - hvm_get_segment_register(v, x86_seg_ds, &sreg); - fault_regs.ds =3D sreg.sel; - hvm_get_segment_register(v, x86_seg_es, &sreg); - fault_regs.es =3D sreg.sel; - hvm_get_segment_register(v, x86_seg_fs, &sreg); - fault_regs.fs =3D sreg.sel; - fault_crs[5] =3D sreg.base; - hvm_get_segment_register(v, x86_seg_gs, &sreg); - fault_regs.gs =3D sreg.sel; - fault_crs[6] =3D sreg.base; - hvm_get_segment_register(v, x86_seg_ss, &sreg); - fault_regs.ss =3D sreg.sel; - fault_crs[7] =3D hvm_get_shadow_gs_base(v); } else { @@ -159,24 +173,35 @@ void show_registers(const struct cpu_use void vcpu_show_registers(const struct vcpu *v) { const struct cpu_user_regs *regs =3D &v->arch.user_regs; - bool kernel =3D guest_kernel_mode(v, regs); + struct cpu_user_regs aux_regs; + enum context context; unsigned long crs[8]; =20 - /* Only handle PV guests for now */ - if ( !is_pv_vcpu(v) ) - return; - - crs[0] =3D v->arch.pv.ctrlreg[0]; - crs[2] =3D arch_get_cr2(v); - crs[3] =3D pagetable_get_paddr(kernel ? - v->arch.guest_table : - v->arch.guest_table_user); - crs[4] =3D v->arch.pv.ctrlreg[4]; - crs[5] =3D v->arch.pv.fs_base; - crs[6 + !kernel] =3D v->arch.pv.gs_base_kernel; - crs[7 - !kernel] =3D v->arch.pv.gs_base_user; + if ( is_hvm_vcpu(v) ) + { + aux_regs =3D *regs; + get_hvm_registers(v->domain->vcpu[v->vcpu_id], &aux_regs, crs); + regs =3D &aux_regs; + context =3D CTXT_hvm_guest; + } + else + { + bool kernel =3D guest_kernel_mode(v, regs); + + crs[0] =3D v->arch.pv.ctrlreg[0]; + crs[2] =3D arch_get_cr2(v); + crs[3] =3D pagetable_get_paddr(kernel ? + v->arch.guest_table : + v->arch.guest_table_user); + crs[4] =3D v->arch.pv.ctrlreg[4]; + crs[5] =3D v->arch.pv.fs_base; + crs[6 + !kernel] =3D v->arch.pv.gs_base_kernel; + crs[7 - !kernel] =3D v->arch.pv.gs_base_user; + + context =3D CTXT_pv_guest; + } =20 - _show_registers(regs, crs, CTXT_pv_guest, v); + _show_registers(regs, crs, context, v); } =20 void show_page_walk(unsigned long addr) From nobody Fri Nov 29 16:29:13 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=2; a=rsa-sha256; t=1632208799; cv=pass; d=zohomail.com; s=zohoarc; b=Lr6K2FUlm2Mz5iXsSQg6ZpjHOiuh/wh4VLX4jorcnqHzjZ9Z7WC5DwyI7SpuOUd3Uk091J8t/kQtLqZ5WRgbk7JvUFcX7cmKj4+eJyROPLe6F3TtYrE+fVeDaS/oQcSanIqqpiyH+a5gn1PCVlweZljIGQ/F4SWhC/RUxq8bHfc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632208799; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=R/fFnczmCtwlapERXxOX/XNhHEnAVEjvjTgMNNwr6tw=; b=OyQBaKDnaS8Jd9Mtb0xePJzCMxS8yOJkycKzX2UcbeExF/8upbTBJUYr0gTQpE0+L3bT1spmb6F0tWKs0zZyGyilDyucHg5scIOQiBGMgg83Tu+ESp4jp8r31hhfkbi8NDCwNgV74G4gJ3A+Nesly95a8Wj0UIYl0PCVv7e2Mko= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632208799005200.98777642474124; Tue, 21 Sep 2021 00:19:59 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.191432.341460 (Exim 4.92) (envelope-from ) id 1mSa48-0006GY-25; Tue, 21 Sep 2021 07:19:44 +0000 Received: by outflank-mailman (output) from mailman id 191432.341460; Tue, 21 Sep 2021 07:19:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa47-0006GP-Ux; Tue, 21 Sep 2021 07:19:43 +0000 Received: by outflank-mailman (input) for mailman id 191432; Tue, 21 Sep 2021 07:19:43 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa47-0006G8-3S for xen-devel@lists.xenproject.org; Tue, 21 Sep 2021 07:19:43 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.111.102]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 49b1ca9e-1aac-11ec-b89f-12813bfff9fa; Tue, 21 Sep 2021 07:19:42 +0000 (UTC) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01lp2054.outbound.protection.outlook.com [104.47.2.54]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-8-o06BvGRINnOqe1Or22CsTQ-1; Tue, 21 Sep 2021 09:19:40 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR0401MB2606.eurprd04.prod.outlook.com (2603:10a6:800:51::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Tue, 21 Sep 2021 07:19:38 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4523.018; Tue, 21 Sep 2021 07:19:38 +0000 Received: from [10.156.60.236] (37.24.206.209) by FR3P281CA0064.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.6 via Frontend Transport; Tue, 21 Sep 2021 07:19:37 +0000 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: 49b1ca9e-1aac-11ec-b89f-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1632208781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R/fFnczmCtwlapERXxOX/XNhHEnAVEjvjTgMNNwr6tw=; b=d8hxIQ3+Zjs9V0ufk1WdwDW13lp3CSuRyeVi4v+7Sfe9SAbtz71Q4LHm2KdBh7NeWTTVAy ocevN2A6/LvLA3GTPj1+BaBGK7no2a5ZEZEW1KdOiT9BaxNoU+6e2nKMgkBfvO4uVk4AZS hqPSBnCB2C2yWymoGYgKs5GjGbdd0gM= X-MC-Unique: o06BvGRINnOqe1Or22CsTQ-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vw0PD9v0hk/jRxeWzor461xYslltKuCVvmUzNIEgkwGAaEWQuQYTd+zjflwge69YRjZSPzPqfTArWCLE09YZyF+Sjt6v0MR0ukdPQ5Jjj7WEDgd5kXG6qrndCg6Riotfhrc/ZMkcLg50XC0hphVwC7VUPJrp2MtB1/vaU5BEl5XhphwBP+GVFz2EIl8iaKboeOdU62HvFfij8Z+toX49ovF8YQpo6ZPLMkUcx44Nn/NqIvSSsc8y/gHj9iqhPoQJhL2fHpWsBCSZaYS15AYzVcOpEuSduNRmLz8mqm2Lfqmfx4ZOBfgjBsf2Rd19I/LXR1T1dsp+dYjIZVBoaFt6ow== 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; bh=R/fFnczmCtwlapERXxOX/XNhHEnAVEjvjTgMNNwr6tw=; b=PScBIewm7KpmAyqZSfiMHy9k2LWhGe6dIBpaXajAa4/yVbYp14spCbLbVuS2TDTUiAg5ZnvSOczCYhWjcT8MfYAaAxskKwg21ZC5I1bD02Oti5xfpAZTOyZKhAztCpHM8hlIlJFqYke87rGGPlM6s+XVP+JzVdXFOM4r4dut9HgHMlW+UWRTVZgBK1mfKlHmdj0NilGBwZ16hLlJ5RYlXlzwi2iFgFp9JatSrgsot+5sIWUhXW2IuyKvawJK7+HG9E103qOnFxfEc3loC6z1YrIwTTZo0sYRRi1VK3ZeC9GKTw/AOl4jfRGKvaIVgP1DDbQsARyt3b5W4JAwXPoB8g== 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 Authentication-Results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com; Subject: [PATCH v3 6/9] x86/HVM: convert hvm_virtual_to_linear_addr() to be remote-capable From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <3397b5ea-bc21-5a2c-ba5d-afc974a92df4@suse.com> Date: Tue, 21 Sep 2021 09:19:37 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR3P281CA0064.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4b::12) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 72fb8069-fc20-4153-7ac5-08d97cd02bee X-MS-TrafficTypeDiagnostic: VI1PR0401MB2606: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TJaB1RuJ1J1TQQJVuAIWYy1Lstkt45BXC8DsTjD1KvItYVmqDHMaGVe9XhXNCDzqX4l7qDFm2Q9qxb0qWhd8wCGTeqPp6SRV0ty7bbwZGUE8nLotJ0Vs/foJQvVJXIVeFR4yYQRDdtlXKP1r0czwN+g5L3lpDmXXSm+y3xTgyEt8R+y2ycJjcswjF75kmxP18I9fRiVShgpcFARQ6d8FACbA+07mRQB+ZkdHWJg7K5uv8ExhAqj0KmgQ46aRaQ2sEoWPCK+fwz9YFKehHyoXGqj92WgqwDHyYsMVrngmJo+HP45GIg6PEnsi/PBaIOeOKd589ly5pVdTRcV7ok/3/ai2hjerGraB809PdYUIILZyV+fhkxaxlPpcKBwMDyzc1iFjtqtlnmKSrpWKzyLWAose+e+4gCgHbEzXO/pE24sLDwNV+knG6yJjk5E/q0b6ebnzP1PhCj2eDWlces5ZTCz37hipjj9q45qt2RRHw5nRRj9VRPn8VI4nGvXIl4eSvNatDkRTD9d2epVU4gsmo3MqrtBWgwqIGOSQ+0dNgla/mTWUr3/nkf2dIA6F7UyoBpv2hPny0NB5a4hqEHIfoAVkzlI3aIK1b3RnkTFJ+asIm0nsJGT8i5DjsKe8cAeKmmqidAvr2i8QlrM86LE4I0OHOnzMRCZQM45feq9g+y5VKNMy0gARvsmDzjiTRu24WQm2TEvjQvPYC+uzI6BAd5KGeXe0XEPeyhE8egt0a38= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(36756003)(31696002)(508600001)(6916009)(38100700002)(2616005)(4326008)(83380400001)(66556008)(66476007)(316002)(5660300002)(16576012)(26005)(54906003)(86362001)(8676002)(31686004)(956004)(8936002)(186003)(2906002)(66946007)(6486002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VTZDZ1JSOEwySEwxZVhNY0FxelNBVW1wMUEyc1ZJbmZSRWRvc2IrbTJidHZj?= =?utf-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fb8069-fc20-4153-7ac5-08d97cd02bee X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 07:19:38.2846 (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: fpgVTVTSozs3rU/tqjja6EY4bOmQ/8bVed01uRMqnAGv7w4Px6N0MICPRM1KaCQzTzwZC8/c2+At0QdMUFcgdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2606 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1632208800334100001 Content-Type: text/plain; charset="utf-8" While all present callers want to act on "current", stack dumping for HVM vCPU-s will require the function to be able to act on a remote vCPU. To avoid touching all present callers, convert the existing function to an inline wrapper around the extend new one. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- Alternatively the actual dumping patch could avoid using this more elaborate function and, ignoring access checks, simply add in the SS segment base itself (if needed in the first place). --- v3: New. --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -2526,7 +2526,8 @@ int hvm_set_cr4(unsigned long value, boo return X86EMUL_OKAY; } =20 -bool_t hvm_virtual_to_linear_addr( +bool hvm_vcpu_virtual_to_linear( + struct vcpu *v, enum x86_segment seg, const struct segment_register *reg, unsigned long offset, @@ -2535,8 +2536,9 @@ bool_t hvm_virtual_to_linear_addr( const struct segment_register *active_cs, unsigned long *linear_addr) { - const struct vcpu *curr =3D current; unsigned long addr =3D offset, last_byte; + const struct cpu_user_regs *regs =3D v =3D=3D current ? guest_cpu_user= _regs() + : &v->arch.user_regs; bool_t okay =3D 0; =20 /* @@ -2547,7 +2549,7 @@ bool_t hvm_virtual_to_linear_addr( */ ASSERT(seg < x86_seg_none); =20 - if ( !(curr->arch.hvm.guest_cr[0] & X86_CR0_PE) ) + if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_PE) ) { /* * REAL MODE: Don't bother with segment access checks. @@ -2555,7 +2557,7 @@ bool_t hvm_virtual_to_linear_addr( */ addr =3D (uint32_t)(addr + reg->base); } - else if ( (guest_cpu_user_regs()->eflags & X86_EFLAGS_VM) && + else if ( (regs->eflags & X86_EFLAGS_VM) && is_x86_user_segment(seg) ) { /* VM86 MODE: Fixed 64k limits on all user segments. */ @@ -2564,7 +2566,7 @@ bool_t hvm_virtual_to_linear_addr( if ( max(offset, last_byte) >> 16 ) goto out; } - else if ( hvm_long_mode_active(curr) && + else if ( hvm_long_mode_active(v) && (is_x86_system_segment(seg) || active_cs->l) ) { /* @@ -2636,7 +2638,7 @@ bool_t hvm_virtual_to_linear_addr( else if ( last_byte > reg->limit ) goto out; /* last byte is beyond limit */ else if ( last_byte < offset && - curr->domain->arch.cpuid->x86_vendor =3D=3D X86_VENDOR_A= MD ) + v->domain->arch.cpuid->x86_vendor =3D=3D X86_VENDOR_AMD ) goto out; /* access wraps */ } =20 --- a/xen/include/asm-x86/hvm/hvm.h +++ b/xen/include/asm-x86/hvm/hvm.h @@ -314,7 +314,9 @@ enum hvm_access_type { hvm_access_read, hvm_access_write }; -bool_t hvm_virtual_to_linear_addr( + +bool hvm_vcpu_virtual_to_linear( + struct vcpu *v, enum x86_segment seg, const struct segment_register *reg, unsigned long offset, @@ -323,6 +325,19 @@ bool_t hvm_virtual_to_linear_addr( const struct segment_register *active_cs, unsigned long *linear_addr); =20 +static inline bool hvm_virtual_to_linear_addr( + enum x86_segment seg, + const struct segment_register *reg, + unsigned long offset, + unsigned int bytes, + enum hvm_access_type access_type, + const struct segment_register *active_cs, + unsigned long *linear) +{ + return hvm_vcpu_virtual_to_linear(current, seg, reg, offset, bytes, + access_type, active_cs, linear); +} + void *hvm_map_guest_frame_rw(unsigned long gfn, bool_t permanent, bool_t *writable); void *hvm_map_guest_frame_ro(unsigned long gfn, bool_t permanent); From nobody Fri Nov 29 16:29:13 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=2; a=rsa-sha256; t=1632208824; cv=pass; d=zohomail.com; s=zohoarc; b=TT0E+PsFYJrGQek1WTDSMf1qjWSmJU/+kQNSRMaWetImmUNBEXOYUm+YCSscvLiwzXX0Klmv/0TnUXjYhm87J0k37i73RaOXONOJKtw4HtnPsqp8XgDU8At8zI5xxKZpZKJ/JfoTQHIJ6EnS9IHypeg113+1Arct1uQeq4OPccM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632208824; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MZzQEVSwMvpFC6oSCiycTUs10fXX3566gSFd9Uc4olw=; b=bpONgA73J67xlyAMKPrs1nFN9zQzQgvWe1HFsJrWCKjyPyIdKT4Q8tm7uBfR6n7v71nKL3eGOWD6y+KkNdWugJVljkNkvOaz9YxJRsZRW82iTmEp5AhT9ctDUBjWFruRQxqnMeMND4fgjXhs7DYzZJeW6sxVjOq+5NLX62a9KYg= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632208824884931.2324137294935; Tue, 21 Sep 2021 00:20:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.191441.341471 (Exim 4.92) (envelope-from ) id 1mSa4W-0007cJ-Em; Tue, 21 Sep 2021 07:20:08 +0000 Received: by outflank-mailman (output) from mailman id 191441.341471; Tue, 21 Sep 2021 07:20: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 1mSa4W-0007cC-B0; Tue, 21 Sep 2021 07:20:08 +0000 Received: by outflank-mailman (input) for mailman id 191441; Tue, 21 Sep 2021 07:20:06 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa4U-0006mE-T7 for xen-devel@lists.xenproject.org; Tue, 21 Sep 2021 07:20:06 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.109.102]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ea372172-ccdb-4c2f-90ab-494e8ddfb4fd; Tue, 21 Sep 2021 07:20:05 +0000 (UTC) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04lp2059.outbound.protection.outlook.com [104.47.14.59]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-37--c95hKXTPcSNhYd3da-yQQ-1; Tue, 21 Sep 2021 09:20:03 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VE1PR04MB6671.eurprd04.prod.outlook.com (2603:10a6:803:11f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Tue, 21 Sep 2021 07:20:01 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4523.018; Tue, 21 Sep 2021 07:20:01 +0000 Received: from [10.156.60.236] (37.24.206.209) by FR0P281CA0085.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.6 via Frontend Transport; Tue, 21 Sep 2021 07:20:01 +0000 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: ea372172-ccdb-4c2f-90ab-494e8ddfb4fd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1632208804; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MZzQEVSwMvpFC6oSCiycTUs10fXX3566gSFd9Uc4olw=; b=JXP0PggS2U3EhnABGu1I2a2qo5wFco509ahINW49DEFxO594EwdSbfIjw62jI7CJBshKLt HJiWUjwu3bMdVEMCA6FPYPHKbFEqldpB2zfqsHPBNcG+gLt0Sq4X1jLXOZ035bVCeMpp4F 4Sj78WSLK/4hHT6phu4Uj9xnDgdrPtY= X-MC-Unique: -c95hKXTPcSNhYd3da-yQQ-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m+wLz7rUWazxE3ro99PvPgrXKeZg+rN2omAHPbRjJ1TNh0fU4BpYmBQBFvsbnSBvgF07flbm+kRHW8u4U8gpxqyD0qrvFHgv6u9Zx4kBMkakvTiqvBExuf5rwEjFgIqBY6ZXOSU1QUIId1FyZLHGT9KDYrAXULO84/2pVq6jY32WbBKrieh3pg2Rbg6EiFe+fznTa6igeEskY3zlI8/0apqv6aVZZViVovqKIkoS+mt5COOWukCvXCFn/f9RQiqu2WAIgUQSJ6sfsSEUD+XSwUgAGvvnkJ+94t+AoeWk0ZnUGOnDP1YkUxV0l/P2YQyKWbI629nAxhTA9m/LeDZPjA== 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; bh=MZzQEVSwMvpFC6oSCiycTUs10fXX3566gSFd9Uc4olw=; b=K3y5uFsuNLVTcVxz8jQOixhnLy6nrnqZLhAsbdWRnVdaaIN2fz+sWSy7p6Yc4IZH3gAQUMzcj6GplTjbfk44sFgfJOromeZIDKmMufd1Z44w9sae38df8MC4ietFPPXzN3HjvoXtekk4DlAJ9cP17hQzLbWkjgDxIk9G8IFpAbx/K6s74Vh1k6WoXTHNYNkOsLjUXZgV3Vxadk6AfL+odkWkiKQR1SeycLc63Yku9ogPDh4yc9GrkHSlWsMobsei1bFe6S6tfW8k6Wz7bBJZT4Ec5i+q3ThyI6yxVDGC+aqpXU/6fR28S2oeoRMmp8c+B87VgB+1NyAwpvHk9+Hycw== 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 Authentication-Results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com; Subject: [PATCH v3 7/9] x86/PVH: actually show Dom0's stacks from debug key '0' From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: Date: Tue, 21 Sep 2021 09:20:00 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR0P281CA0085.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1e::9) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 70b068cf-b07a-4023-e6c1-08d97cd039a6 X-MS-TrafficTypeDiagnostic: VE1PR04MB6671: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ypZOEBrTsAT+Duv6+keWmuQFg/TsTMyfj7JJSuAvmLeKnZXxIsjHwPqRsrqt1+38Hu13BqX4I9F4fSIPmdE8pAVHA/qNGbaGl9o4+m5c56zSLIhdYE2vqIFbWl8x8pgOYM8lMsIcV9nk71H4guHg6cQzIQmwugOixAtVGVHgpRNufNEdhD+wzR8kwk5Er+UgdpwMVbXwmjMKQnnzqqLcH2GHcReUWfsU3RIQ/HH+5RihhzqpvP4wT+qtUHRO52PGiraa6ogXY9bTpUfI24kSoUiSczPCufOFk+RQfjvk1u+7rAU1q7CIImcJ9ijin2xM9d/pI1prkB2NfIM5Ub7VyiVtlJ3DNxwZ1NS7++mtU/h9s4XZoC5jeLpHReDW4Itcoa8jtjNCjxFf2bzUdS5m1YVtXHJ7JRq0d+2fUZJ5ww/CnGbgF+GMnhezRPLsqtitbLyvz5QYw/yeFt+EKdMukNns0KzP4x4EvEWR3jdTXJaOSoaDe9t9bkBaPt65HhJtpkbVwOJq8hor+FVhpOBHjpbaRc/BGY+FGmsV07t4658vKbBettuDndbjV0u2TYmsMKBLjbptE/5rJE5WsJcuSkKDcnLbu5O905bsEydC6nv3uzYtcplV/S/2zg26PKpDEkZrUOv3qlOS0oE3pQ+VzdkyEqZxJq033G2YpiM3aP8rGgdsjZIwomlnniAJur0pMIqIpmS/q5XZWhVmiqSs1nMWa3BhO0bzWISCjFK0vYc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(16576012)(5660300002)(36756003)(54906003)(4326008)(8936002)(956004)(31686004)(83380400001)(8676002)(2906002)(6486002)(2616005)(26005)(316002)(38100700002)(186003)(31696002)(508600001)(66476007)(66556008)(86362001)(6916009)(66946007)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?M1VMbVh2eldHTlZicUtjNG91T0hLKytwTGkvRkZ5ZzRjUXQ1L1g5QVBSQzdN?= =?utf-8?B?RzNwcFJieWJnTHNYNnpSQVMyaHlNejUyeGZ3V2owTjBZVi9VVkJDSlF4a0dJ?= =?utf-8?B?VVV2T2hiNXRwY3ZrdmFOTXh3blBvT1FlWU1saTdjZGNoNy9wVS80cDFtWWIz?= =?utf-8?B?Y08vanZPSm1UdFl0eGxER3laSENGT1VJUldWQ3JvY3JPYmhrbWJGVC9TVmJM?= =?utf-8?B?UWNhaUxNckhrVDFTVHhxcjFBWlRVQmY1M3YxQndKZEQ4QjhYQUlxYVBkQTBt?= =?utf-8?B?WE1qRWtFK3R4djR0bDA5T2RXNmEybU93TGFCK2NGdVE3RTl1UFphTGZkOUdU?= =?utf-8?B?bkNOTVpuNnhKRU9NaVVBRjRWbXp6RG5PRVBZSkNPelE4R0diZ01Rc21EbHIy?= =?utf-8?B?UjhMallrdkRIeWJtdUpRZFUvM3pZUTBIem9pOFA5WDRna3ExZEdlbmovcmx6?= =?utf-8?B?QlVzUHEzbU1Hc2NVQ2NJNjlYK3JhMnhWRlBJeDk3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YVQvQVVPWWx0UTZySmNkSWRER3ZxeHlQ?= =?utf-8?B?Mld3RzZTdW9ZUms5R0R5NkE3Q3NZTVl4TTZKaGRlc29OZTVkajBkbDZKUXMx?= =?utf-8?B?Yk9UcDM2M01NMHZnbTYyMit0UkZNdGs2Z09YNmNXTk1FRlBWaERNUTNWRUVD?= =?utf-8?B?SUE0VkNkUnVMc0ZZZnIyK093SXhqc2NzNll0OXNPeDhzODZiOVJyV0g0QTRm?= =?utf-8?B?MjM0R0t6NHJQVkJIb1YrQ2k4YkZBTWtpUVdQYitYOHVDRGlOS21vRjJRUzA1?= =?utf-8?B?b1A1eWNzM1RMSVNnbnJhaDdlVGV3OEs4bHF3L3cxdXZMZzM3bU4yUXlNQTZS?= =?utf-8?Q?pIq+z1F3D8qju8Zs/YtURyeAL4pQ8xK5QtSSEAm?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 70b068cf-b07a-4023-e6c1-08d97cd039a6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 07:20:01.3126 (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: hL/QSQ+Zpz0CjVJwdWTX2QIwh5ASu6sMr8v45kLAsiVJlOH4Uyju4S/xSCTE6SXYttuSJjGRKMa+cWg4lG/hog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6671 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1632208826834100001 Content-Type: text/plain; charset="utf-8" show_guest_stack() does nothing for HVM. Introduce a HVM-specific dumping function, paralleling the 64- and 32-bit PV ones. We don't know the real stack size, so only dump up to the next page boundary. Rather than adding a vcpu parameter to hvm_copy_from_guest_linear(), introduce hvm_copy_from_vcpu_linear() which - for now at least - in return won't need a "pfinfo" parameter. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- TBD: The bypassing of the output interleaving avoidance isn't nice, but I've not been able to think of an alternative. Avoiding the call to hvm_vcpu_virtual_to_linear() would be in principle possible (adding in the SS base directly), but one way or another we need to access guest memory and hence can't sensibly avoid using the P2M layer. However, commit 0996e0f38540 ("x86/traps: prevent interleaving of concurrent cpu state dumps") introduced this logic here while really only talking about show_execution_state(). vcpu_show_execution_state() is imo much less prone to interleaving of its output: It's uses from the keyhandler are sequential already anyway, and the only other use is from hvm_triple_fault(). Instead of making the locking conditional, it may therefore be an option to drop it again altogether. TBD: For now this dumps also user mode stacks. We may want to restrict this. TBD: An alternative to putting this next to {,compat_}show_guest_stack() is to put it in hvm.c, eliminating the need to introduce hvm_copy_from_vcpu_linear(), but then requiring extra parameters to be passed. TBD: Technically this makes unnecessary the earlier added entering/ leaving if the VMCS. Yet to avoid a series of non-trivial enter/exit pairs, I think leaving that in is still beneficial. In which case here perhaps merely the associate comment may want tweaking. --- v3: New. --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3408,6 +3408,15 @@ enum hvm_translation_result hvm_copy_fro PFEC_page_present | pfec, pfinfo); } =20 +enum hvm_translation_result hvm_copy_from_vcpu_linear( + void *buf, unsigned long addr, unsigned int size, struct vcpu *v, + unsigned int pfec) +{ + return __hvm_copy(buf, addr, size, v, + HVMCOPY_from_guest | HVMCOPY_linear, + PFEC_page_present | pfec, NULL); +} + unsigned int copy_to_user_hvm(void *to, const void *from, unsigned int len) { int rc; --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -364,6 +364,71 @@ static void show_guest_stack(struct vcpu printk("\n"); } =20 +static void show_hvm_stack(struct vcpu *v, const struct cpu_user_regs *reg= s) +{ +#ifdef CONFIG_HVM + unsigned long sp =3D regs->rsp, addr; + unsigned int i, bytes, words_per_line, pfec =3D PFEC_page_present; + struct segment_register ss, cs; + + hvm_get_segment_register(v, x86_seg_ss, &ss); + hvm_get_segment_register(v, x86_seg_cs, &cs); + + if ( hvm_long_mode_active(v) && cs.l ) + i =3D 16, bytes =3D 8; + else + { + sp =3D ss.db ? (uint32_t)sp : (uint16_t)sp; + i =3D ss.db ? 8 : 4; + bytes =3D cs.db ? 4 : 2; + } + + if ( bytes =3D=3D 8 || (ss.db && !ss.base) ) + printk("Guest stack trace from sp=3D%0*lx:", i, sp); + else + printk("Guest stack trace from ss:sp=3D%04x:%0*lx:", ss.sel, i, sp= ); + + if ( !hvm_vcpu_virtual_to_linear(v, x86_seg_ss, &ss, sp, bytes, + hvm_access_read, &cs, &addr) ) + { + printk(" Guest-inaccessible memory\n"); + return; + } + + if ( ss.dpl =3D=3D 3 ) + pfec |=3D PFEC_user_mode; + + words_per_line =3D stack_words_per_line * (sizeof(void *) / bytes); + for ( i =3D 0; i < debug_stack_lines * words_per_line; ) + { + unsigned long val =3D 0; + + if ( (addr ^ (addr + bytes - 1)) & PAGE_SIZE ) + break; + + if ( !(i++ % words_per_line) ) + printk("\n "); + + if ( hvm_copy_from_vcpu_linear(&val, addr, bytes, v, + pfec) !=3D HVMTRANS_okay ) + { + printk(" Fault while accessing guest memory."); + break; + } + + printk(" %0*lx", 2 * bytes, val); + + addr +=3D bytes; + if ( !(addr & (PAGE_SIZE - 1)) ) + break; + } + + if ( !i ) + printk(" Stack empty."); + printk("\n"); +#endif +} + /* * Notes for get_{stack,shstk}*_bottom() helpers * @@ -629,7 +694,7 @@ void show_execution_state(const struct c =20 void vcpu_show_execution_state(struct vcpu *v) { - unsigned long flags; + unsigned long flags =3D 0; =20 if ( test_bit(_VPF_down, &v->pause_flags) ) { @@ -663,14 +728,22 @@ void vcpu_show_execution_state(struct vc } #endif =20 - /* Prevent interleaving of output. */ - flags =3D console_lock_recursive_irqsave(); + /* + * Prevent interleaving of output if possible. For HVM we can't do so,= as + * the necessary P2M lookups involve locking, which has to occur with = IRQs + * enabled. + */ + if ( !is_hvm_vcpu(v) ) + flags =3D console_lock_recursive_irqsave(); =20 vcpu_show_registers(v); - if ( guest_kernel_mode(v, &v->arch.user_regs) ) + if ( is_hvm_vcpu(v) ) + show_hvm_stack(v, &v->arch.user_regs); + else if ( guest_kernel_mode(v, &v->arch.user_regs) ) show_guest_stack(v, &v->arch.user_regs); =20 - console_unlock_recursive_irqrestore(flags); + if ( !is_hvm_vcpu(v) ) + console_unlock_recursive_irqrestore(flags); =20 #ifdef CONFIG_HVM if ( cpu_has_vmx && is_hvm_vcpu(v) ) --- a/xen/include/asm-x86/hvm/support.h +++ b/xen/include/asm-x86/hvm/support.h @@ -101,6 +101,9 @@ enum hvm_translation_result hvm_copy_to_ enum hvm_translation_result hvm_copy_from_guest_linear( void *buf, unsigned long addr, unsigned int size, uint32_t pfec, pagefault_info_t *pfinfo); +enum hvm_translation_result hvm_copy_from_vcpu_linear( + void *buf, unsigned long addr, unsigned int size, struct vcpu *v, + unsigned int pfec); =20 /* * Get a reference on the page under an HVM physical or linear address. If From nobody Fri Nov 29 16:29:13 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=2; a=rsa-sha256; t=1632208865; cv=pass; d=zohomail.com; s=zohoarc; b=VRVC4T9yUUv4bv4Ix5jau3OhY5L9SAgoCp4h8JeVQR25RUiHCs850LKCKdHP8bx+67UO37a66bHuu9h603rSKfKRCZg1sM/wCpq0AftwvhhBcjQWIB9tuIhH7lJP1o/n6DOXaiCauiN3fv59GAoBhfR+mJ4aB80p0ZTv4fzp+oU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632208865; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CbSaBreuvDjQILv0E6xjB0s8ZsBQ3dj8qUpxvESe3zI=; b=lZIRRzRjuRPQ60jBK35eJ485qoKA3XkCkdc27q21oUbyt3hZnwJlTf6SMguWHYxIV4kBR/ghGGRfy42qI6qVERdyRnsSktBvHceE6NRfgGJS/sTKkr4kjoB5KL3zgkcWefOJ89fNSvUwsOSQejCfN/ecFHrMXvwm4k4ADA1rk/w= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632208865215548.1767052923086; Tue, 21 Sep 2021 00:21:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.191448.341481 (Exim 4.92) (envelope-from ) id 1mSa55-0008Eh-MO; Tue, 21 Sep 2021 07:20:43 +0000 Received: by outflank-mailman (output) from mailman id 191448.341481; Tue, 21 Sep 2021 07:20:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa55-0008Ea-JQ; Tue, 21 Sep 2021 07:20:43 +0000 Received: by outflank-mailman (input) for mailman id 191448; Tue, 21 Sep 2021 07:20:42 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa54-0008Cx-9A for xen-devel@lists.xenproject.org; Tue, 21 Sep 2021 07:20:42 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.111.102]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f0407dc2-183f-450a-b795-8acad6bbd819; Tue, 21 Sep 2021 07:20:36 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2110.outbound.protection.outlook.com [104.47.17.110]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-34-YjvEN7OzPWibYAIKPIA3Ig-1; Tue, 21 Sep 2021 09:20:34 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VE1PR04MB6671.eurprd04.prod.outlook.com (2603:10a6:803:11f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Tue, 21 Sep 2021 07:20:33 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4523.018; Tue, 21 Sep 2021 07:20:33 +0000 Received: from [10.156.60.236] (37.24.206.209) by FR3P281CA0037.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.7 via Frontend Transport; Tue, 21 Sep 2021 07:20:32 +0000 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: f0407dc2-183f-450a-b795-8acad6bbd819 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1632208835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CbSaBreuvDjQILv0E6xjB0s8ZsBQ3dj8qUpxvESe3zI=; b=jPvUgl3iBo76LX2XzOrKWskJdjShK5UQYY4OcrOnztuhXqloEpItzsGulgPMJ9F/MQqWcT I6CIZogN73IY1ZYwIUVL9fxfE2WFvRu4pqMVVw2vxawXklT4MnmBQbNityreOcEd0MWMLb ZS1LayiELZk1CoxFFTrPbSOgTFho/jM= X-MC-Unique: YjvEN7OzPWibYAIKPIA3Ig-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B2LUX0fRf98D5C0FwNwL9PbS7MLydFyLc2nBVrxWhqNeWhyMcotO4TF5BCnrHIn1tQMdOf7ThpICfDeoKJu0/WFA7j0ux2dmw/MvSlDpg/cZbGoYnB2bdXym+xYbUURDnc84ycAvJv+S3B3PWcvTPkOEyWem/+jdOVegbm35JnOo6FAlJ2z/PSFMbchyamF7rFq+fUpSBCBXa+bqBffP1JXFR7+bl2wCPsBNsSL8DbK0z0Pov6UViUT4aOq+pOyXgXJd34gg/A+69qqJP8ftO8S6P41xChozLhegmSvONpKJt23FtrxNXYO79obOdSiwTispji0a8fQrfAT9U96w0w== 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; bh=CbSaBreuvDjQILv0E6xjB0s8ZsBQ3dj8qUpxvESe3zI=; b=IkEnAcKI3UGrNqS9FrEQ3+KQroOdo4HZHmxOSqhPlqPIFEKd/hK0kRv+mMPPA1rky+dq9nD7MzLD23xOjsLQ4a7OpuBMN1Joo8OHA5woI1wX2asxkGsVbomgY8RYdT//RU/hWNheCkU1GsOmBbUs76PKEfuIxc3e5DbAZEDbDfdoT8KK/D5WHSin1453/ZvhAR1J+xVLRfT1rl9j5YzH/uznRObi8+Gx0rapo4AnAIucujWvH5ic1qbbjod+q1mdZrt4wHjxT74k0lXu+lH7A6fVW1eKrdDUycFZVx34DLt88GDG6bDFIm8gbKNvFMO5PPCtcPe1HK7hvSS8j0MDFQ== 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 Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=suse.com; Subject: [PATCH v3 8/9] x86/HVM: skip offline vCPU-s when dumping VMCBs/VMCSes From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Kevin Tian , Jun Nakajima References: Message-ID: <5cc8f7e0-399e-f6a5-bc84-823a6160a3f1@suse.com> Date: Tue, 21 Sep 2021 09:20:32 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR3P281CA0037.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::21) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9ecc65e8-c135-4a84-0244-08d97cd04ca8 X-MS-TrafficTypeDiagnostic: VE1PR04MB6671: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:457; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PspKtaJDObcgXZuFO5ezZYYAMCqnCQ2LFc39jrxaWC9NbppUQE3K97BNrjXFFkCH3xEvrLuwfKpX81wNVBHAE+EDmUrk5oEp2IPRUfYjjJQBQCSLyIb3YtaX4DhEtGxsaMYRCaMJsFUN4sSm3a95FiSSpsUX7eVlIwWuJve8N+lOrMBCCUtbvJRc34kBdISL9vvq5dz7GqyS60MULdD4QRLSJWiF6T7rSAV3OB2Ii+8L38nJjE7tlK3qa3JmgBU+eMRaadh9DkNiL4Hrdn31mP8haTOyW+U7C4UU/sTGEI6BCL0Gq/9DEKbEs+NLPTfZf9P2iFuc9G+BVQKZ3dQ/PhFHVqbuwZxks9XSyca06bsHIiTSMDkFMq2JZkzMs6NnpIsDJWd6UZkIPqi8DlM5e5TXthuKfjikguRYAhOLWUjxhoYybnXzEAZSVkO+5Q3ppQcJ/Rg+J12znDfnH/6Yiiuwbb6R2qp270TqSbOUUnemp61SU7eAvwfjWMpiPaLiqE9cu+d0bUHMe0gYZpradihz6Sd9mZVBI2YPaTw/uIY6xEFmcegqQhR8qiE6Vj5gO1mgqKRA8SeSLMJDL4I0LJKxRdYp0WNDImfysap5ODgAHQ/URUty8P0i5B4e7nBgOEa1/kRxCSKakfcIA+N2JmAeNHblRNjQSrOi7qjDmf//Q1PhY7XmNuqIL1A+t1KE7SvSBkro196sfYcAAnjfddjSQ9xJFfnr36W0Z5iabB0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(16576012)(5660300002)(36756003)(54906003)(4326008)(8936002)(956004)(31686004)(8676002)(2906002)(6486002)(2616005)(26005)(316002)(38100700002)(186003)(31696002)(508600001)(66476007)(66556008)(86362001)(6916009)(66946007)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NGVYaENLcnJEbUVnRUszN3Bvb0htNnNheXQ5eGMxZnI2TWIvWUNTMDJvNDcw?= =?utf-8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MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 07:20:33.2615 (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: RgPfGZOkr2v98P9Xz74vU+6aCkg3Sz0TnOE1pZwNrNFjEX2/aWGdX4f0P8Whuu+Sxypi3guUlsgznY+azludWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6671 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1632208865691100001 Content-Type: text/plain; charset="utf-8" There's not really any register state associated with offline vCPU-s, so avoid spamming the log with largely useless information while still leaving an indication of the fact. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- v2: New. --- a/xen/arch/x86/hvm/svm/vmcb.c +++ b/xen/arch/x86/hvm/svm/vmcb.c @@ -242,6 +242,11 @@ static void vmcb_dump(unsigned char ch) printk("\n>>> Domain %d <<<\n", d->domain_id); for_each_vcpu ( d, v ) { + if ( test_bit(_VPF_down, &v->pause_flags) ) + { + printk("\tVCPU %u: offline\n", v->vcpu_id); + continue; + } printk("\tVCPU %d\n", v->vcpu_id); svm_vmcb_dump("key_handler", v->arch.hvm.svm.vmcb); } --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -2133,6 +2133,11 @@ static void vmcs_dump(unsigned char ch) printk("\n>>> Domain %d <<<\n", d->domain_id); for_each_vcpu ( d, v ) { + if ( test_bit(_VPF_down, &v->pause_flags) ) + { + printk("\tVCPU %u: offline\n", v->vcpu_id); + continue; + } printk("\tVCPU %d\n", v->vcpu_id); vmcs_dump_vcpu(v); } From nobody Fri Nov 29 16:29:13 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=2; a=rsa-sha256; t=1632208891; cv=pass; d=zohomail.com; s=zohoarc; b=UOzfGJR+G/5XLnx688WoEPWnLfNo99jrmNIPmJYUYr++6Z+LKg65LJtdv42j66w5gkqDVy+hGq4vLEx2Lk78ejZbtdBVqZb7lvwmZD0bGx5CGSdyu1znqRSEjFuWImxrnb+DicCS7GLxMJBpiXqHVZhj4XPBxMQjV6/2knQrPes= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632208891; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=289UvYu1z6hhybJctb/uHf8lFebZQ7uBwKVUfRIW7tA=; b=kdQnrXSu/7YeZRRQbF/V5/6HWlGJ+Z+ba5/pZB9gNO5hG8Qe8/Kq6g1EiBI9pszAgec8ndKGr+wCaaVx4QQplTvfaXBDwrYW66LyUjcGWfNjh7Ak427JeIADg+bLtCLJxoZq+Sv4O/0NN2XJhzMkWEpXNBHMTl3MztdSIsNK/j0= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632208891346761.4991494043945; Tue, 21 Sep 2021 00:21:31 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.191453.341493 (Exim 4.92) (envelope-from ) id 1mSa5d-0000Pz-WD; Tue, 21 Sep 2021 07:21:18 +0000 Received: by outflank-mailman (output) from mailman id 191453.341493; Tue, 21 Sep 2021 07:21:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa5d-0000Ps-SZ; Tue, 21 Sep 2021 07:21:17 +0000 Received: by outflank-mailman (input) for mailman id 191453; Tue, 21 Sep 2021 07:21:16 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSa5c-0000Pc-LR for xen-devel@lists.xenproject.org; Tue, 21 Sep 2021 07:21:16 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.109.102]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 818cb834-1aac-11ec-b89f-12813bfff9fa; Tue, 21 Sep 2021 07:21:15 +0000 (UTC) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01lp2054.outbound.protection.outlook.com [104.47.2.54]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-17-NZpMd9o3NHGFH53cbEF2jQ-1; Tue, 21 Sep 2021 09:21:13 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR0401MB2606.eurprd04.prod.outlook.com (2603:10a6:800:51::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Tue, 21 Sep 2021 07:21:12 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4523.018; Tue, 21 Sep 2021 07:21:12 +0000 Received: from [10.156.60.236] (37.24.206.209) by AM8P251CA0011.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:21b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Tue, 21 Sep 2021 07:21:12 +0000 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: 818cb834-1aac-11ec-b89f-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1632208875; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=289UvYu1z6hhybJctb/uHf8lFebZQ7uBwKVUfRIW7tA=; b=afw0ncX6rYa7tvfD5HOD2sPq3eF6QDjKjAvIGuFNjgIDwarx+2I952rScdokzWMfVzD8ml UNqpJ5Ar89JQa1q6A2AsOjdPk9pZwnadCJTugo25XP/8Ux1jVidjTO9XQoI6oOFoSR73zL c0ouiekY0rFJSavIDHU0aCo0UIpsOvw= X-MC-Unique: NZpMd9o3NHGFH53cbEF2jQ-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P7aoENOHdv05H6wD0zheCMqSW1MX2nF+sHjcYjtaB3EO4dC2O/19CrQ4Et6uI19rpH7WXN3O6kmEZZIRRDbPfYTKEk9r+RV7PCxCw/MWIHX9fiF7FZbV6CVCnUCSEMf+bx1duV5xGu2hfPdPIDf6F6cwhjdZ8WoXJB1+XxJaJdjMwNMTnyahWN/eyi+uKBY6UAt7x0f5unB3ien31m7xdWaM9oCZBU8rpMCaDuwmdExK3dwJOiK8/dMkR2xCIfJd0vi7vVpvBG32Z06QJAPw5qRmCqZGGFWEKEbL9YJwttlhuz+m0DOXurVdbCTFUF3Py+L3cNJ3uDJKgq669MJ3iA== 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; bh=289UvYu1z6hhybJctb/uHf8lFebZQ7uBwKVUfRIW7tA=; b=AOF75uADfuJNL8vrXQcOnddp+d/kjjIjs5X6zBymE1miaFCm91NlLXeGcqm+Ols9oV7K2FioYGZPgkHp+2uumS0cFm2sPt5gVfSClWMFvALYDtPR6vFxjw4fqXNA8ip3jTC/OAdxrCuepjICpTPYPjYaepfxpW6xC8pnRdBFlh1aIVkVHWStDidfAWwTxEjr5zCtaGK8IGrgfAY1uFoUluxerUtTvjXapxh2eHOyVxAx9g6xlyEbp17zMGVE+j50gHlsG6ih7LsAam+9PJIVoz1JMyL3zyghKRK3Uoq7KLl+jTdHOOkdZ027uRU09Q2uZFnyGAcnzGtDo0jj3xznlg== 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 Authentication-Results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com; Subject: [PATCH v3 9/9] x86/P2M: relax permissions of PVH Dom0's MMIO entries From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , George Dunlap References: Message-ID: Date: Tue, 21 Sep 2021 09:21:11 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM8P251CA0011.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:21b::16) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7988f48-3e17-4028-d6bf-08d97cd06436 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2606: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GEQpZvVC4gjo4LApWhDyUqClHh7Tc+bAnChVMDRBSrkRpWXHc7wfDKhk9y/owPSexYzIPvKD6GURW9j7/4m3w0b4OuvTVAdq0boRma29bJmBCV2bsA8AWt1QkJhB5PgAXsMJC0rzMJ8B5oM4xXR3U4iTydY/4mfySF2EpGjObGSUiCoOwF272fFQaLhoO67bukLlchc6Q2mjpK2FetRXTPUt7MRS3TmlpAVz3cJZTbEZdrVAOXuWLJxI0SJWIZ+ARdkotTYXdpNjPW+LxCgxrl96IJIiGNpirxCe+GE3xRaLEaSN97CdEyEDFiiUHSaq8eRK8rjJbTMKrjTrdtZBTgcBytZvvs6q8W0Iq8C2o4nc0znfY5WySyRq+gcyIZ4lSkqaon2f2OViLnKoVqRgj36sblhUKDxAO7vztU9iB7IA4mgSUSjN+KejSowVseaBn6WYzpoEoeu93up4Rof+i3FX4fhFL42DqzEEet6oT57jekftueJ76+vBTo16jmpImzHmCiGdmD645giercuGpANwKDMPVMdxs01l1WHP0eOz1e2FOWZCWnq9fecaTV+rrSLL1sVDx/nVsYcld4JDckN57yoewJnXkGF1pU/zaFPH6XYupnRzApz/0Qi1OCmh1BIkZHh+u/OZaD+bVkQR1ss8QgxPFKizTsJtmDYIzQbsaWsQDh4FUDmnHaGK/tW7jlBlP8bElI8ACm5rwd+yUfGKoNF3Pk5+7SInFrXlius= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(36756003)(31696002)(508600001)(6916009)(38100700002)(2616005)(4326008)(83380400001)(66556008)(66476007)(316002)(5660300002)(16576012)(26005)(54906003)(86362001)(8676002)(31686004)(956004)(8936002)(186003)(2906002)(66946007)(6486002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZmtDWnBFZnQxR2NtMURHSEQ5YzJQSktNc09MKzhra2F6dmsyYVRKSHRtQjQ4?= =?utf-8?B?UG85Tk9vaWFaTm1ORWNXd0FTbGFCMWQzRm16MXJmTHdVbjk2RW9RNElkOVZV?= =?utf-8?B?V0lzbFl2TWpraS9xdHlUR1dlNG9DYmFVaXpGYVpXY0JPaE5XSks1ZlZHZ1ZU?= =?utf-8?B?WGdUMlorbzJ1bDN5ZmFpeUdudmZQWjRpRTB6c1pFN00wbWRLRXRZYUdZOXpC?= =?utf-8?B?M25HUERnY09EclZkMy9iT284ZzZXRzhNQVhMZ0ZpbHJOVkg5aGRVL3R6Z092?= =?utf-8?B?WDV6Ym4rN3FibUJWVlB5djlzbmUvOTVxbmdDTE1nYXBnWm1JUmtkNEtPVHdI?= =?utf-8?B?MnlnTWUzUnFiZC9yZHM3RndNMTlqdTNlNEJwTGdXU1RDOWE1bTJtRFN4VjJF?= =?utf-8?B?K3hHYndpYTV5S0VUcFY3NXR0MWNQQ1N5T1VROTVHcW9iYVNHU3FLYmhqTlNI?= =?utf-8?B?M05JcjA4b0FVTDNKSkVLU2xVRDlxSktSOTZLWkFWNE9xMDlCM1RXZDBaZlAw?= =?utf-8?B?Z1BpektwODNqalo5SlV4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dINkRCVUR3VlJ3alFKUVpsWkJFU2RYYXhKQkh6MkNEWlNKWkc3U3ZT?= =?utf-8?B?bCtubUNtKzk4cjRoSDMyZk9oaGRWZGM2SXJLL3g4L2VSam9Jd2pFWXVJTlRm?= =?utf-8?B?eERoUUV3Z3dXazN0T0oxNlNqUkVleDhFYWxPMThSRkRHaGdoT216NTNvTklU?= =?utf-8?B?bkdMcnM4T1NVQmN3YVlPc0hLaHZ3SjhKcTRuY01LUkR3QUI5MXcybklsTEJl?= =?utf-8?B?UXB4TzhmY0R5a0M2RGErL0l6d01NaXRWVk41RW5Fb0J3cEkrOHpDT2k5NktY?= =?utf-8?Q?+ciszDXkPJIu9GQe/D5OfDN1GSZZWD0eafRKzoW?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7988f48-3e17-4028-d6bf-08d97cd06436 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 07:21:12.7492 (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: +kS0cPmW0ktOELRYfFrSvLx3W8jO+myJKsOsj5Jca8mudtFhbJXABARVd5v4FUyQJOKhi1MKgUDXZYrYFEhTKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2606 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1632208892191100001 Content-Type: text/plain; charset="utf-8" To become independent of the sequence of mapping operations, permit "access" to accumulate for Dom0, noting that there's not going to be an introspection agent for it which this might interfere with. While e.g. ideally only ROM regions would get mapped with X set, getting there is quite a bit of work. Plus the use of p2m_access_* here is abusive in the first place. Signed-off-by: Jan Beulich --- v3: Move last in series, for being controversial. v2: Split off from original patch. Accumulate all of R, W, and X. --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -1319,6 +1319,18 @@ static int set_typed_p2m_entry(struct do return -EPERM; } =20 + /* + * Gross bodge, to go away again rather sooner than later: + * + * For MMIO allow access permissions to accumulate, but only for D= om0. + * Since set_identity_p2m_entry() and set_mmio_p2m_entry() differ = in + * the way they specify "access", this will allow the ultimate res= ult + * to be independent of the sequence of operations. + */ + if ( is_hardware_domain(d) && gfn_p2mt =3D=3D p2m_mmio_direct && + access <=3D p2m_access_rwx && a <=3D p2m_access_rwx ) + access |=3D a; + if ( access =3D=3D a ) { gfn_unlock(p2m, gfn, order);