From patchwork Thu Mar 30 11:26:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13193980 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70D96C6FD1D for ; Thu, 30 Mar 2023 11:26:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.516629.801053 (Exim 4.92) (envelope-from ) id 1phqQS-0007AF-0F; Thu, 30 Mar 2023 11:26:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 516629.801053; Thu, 30 Mar 2023 11:26:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1phqQR-0007A8-Tk; Thu, 30 Mar 2023 11:26:39 +0000 Received: by outflank-mailman (input) for mailman id 516629; Thu, 30 Mar 2023 11:26:39 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1phqQR-0006gd-1j for xen-devel@lists.xenproject.org; Thu, 30 Mar 2023 11:26:39 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on20615.outbound.protection.outlook.com [2a01:111:f400:fe1a::615]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bc64e8e2-ceed-11ed-85db-49a42c6b2330; Thu, 30 Mar 2023 13:26:38 +0200 (CEST) Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AS8PR04MB8468.eurprd04.prod.outlook.com (2603:10a6:20b:34b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.21; Thu, 30 Mar 2023 11:26:37 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b%6]) with mapi id 15.20.6222.033; Thu, 30 Mar 2023 11:26:37 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bc64e8e2-ceed-11ed-85db-49a42c6b2330 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kawQ88ejvpYSr+SK5zXClVyuo1dvd+jkmp5bnmO2qncx0zmsqa20lcDsPg0BKQQvLdcoyRpEsDdjZBoX9LYqWIMTrykiN0CHgegnba4Z95YMkDsjB9sV4WFOEryekhZ7mKMnPYiD+2iLOpIjtr7M9EWHnO673rvjvmqLnmcKYyR3Nb4DxjzIMm6Z+tvw+byyT9JD6vNafnE1qXunr9Pss64ETSEEF2tzGfgtpJYFeyDDcCksNpfPczjBpjY87YijHBaQ5zAQJgCjVmaoACS9AdD9v3s9MTdlINu2vBPpDm78yrh/UTFU/xZAxOlbi5pi+fNZm5QuTYUzchiDgAn0fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=o37qmZQGz0dUPVarEE5M4F8gAAfRaPl7Obs64dcS6gQ=; b=Dlqt8EZ92XFYkUkX6dsOgfeIPc0lRWiBpHdysauln6eQoLm+6lLMrVxjL6eiC1YyW68PtYB2wrEnA6l9GxxT5JJMDQOhrkXTOXN/lYXQq2NiRMPXS5yQ7yzKA3OrgDQWbgmnDYANSJ6D5YnE9QmCRZ3lUfve7BXM4F8lGxH1vfT6K3S8j4ignFth842VT5mkPjWcYp5EoBMMF9rSNAP8l3I6j18Q/W0pSOcgTM5V9vsmYaN79KwmrIHn4ynM5GcnvgARzXSADk764pziCbNB2jxCNzgqB2YDVlDCxQuba7Q4iOrRlmIBsPuDc9ZQOH8DMb9kZmb8ftRx2kaT70TukQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o37qmZQGz0dUPVarEE5M4F8gAAfRaPl7Obs64dcS6gQ=; b=jqgZCThEfB4GsA6wvAxQFST6HoPuurWldv1Uuszho1cmWP7KBHvJ2csVBIbqo4HEmz0yO9Sab14BYCUB4tk8IvBhv214+umdEyBiLtAl2vKLuBUs2B2dfqzRTdgE37pNtCyXlfkqF8dq0/CHRnhL8nSt+33YEIaViw6t7UNOQrGFKEVFnJJSuj7OGwwtKgCy0vTap7/oEdlkMPy2VG+OMJ3/hpWny8R/gD2G+e6Z44ktbG1fb5l8RtH8WbI4wxLt3VPjhsD9KxYW8H6YZE8EIHTpejopAmmmJXEhIiH1V6VhVWiPDI6cy5rsNMYsWPzChjhpQc33S4D2/GAz1Xx15g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: Date: Thu, 30 Mar 2023 13:26:35 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: [PATCH v2 03/13] x86/shadow: reduce explicit log-dirty recording for HVM Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , George Dunlap , Tim Deegan References: In-Reply-To: X-ClientProxiedBy: FR3P281CA0175.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a0::12) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AS8PR04MB8468:EE_ X-MS-Office365-Filtering-Correlation-Id: 248b542d-67f2-422e-c1d6-08db31119fc6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: is+k0jfzLnA1SefsrgzOh8bkUUhqQFeYigt5qJ7tXEg7F6uSeHvXonN46vPqIsp4ZHdnScYJtCe1xOimsBQm4TnTDKfRyLljsnaOcNHm8aPe2RxEtrJxD4qjyji4M06D91SIdA/mRiqiyTTacpqoACYgs256He2Fr51nGupcFyVEeCCGWt8jWldC30QkhkmIz+qRnoFszYIrQRUwvrGJq7QZw7AQziTGgYrFsT7KEXsSrk/b8R6zyP9lJ7hBj7guTqTnXNPecICAKR+Vt3jyqeIOUdEvzcnTr3AiWDC+co/KarldMlUBoAG427vgRRfHBZofeNd/cOiu5g6cABpuDl6KVN6I3AHUw+T3r6RJf8bVnuuiW1mHrKZTqJDcocp7CRelPwlz3cG3lKWWZJug4yZCFQZeZs8bkepHhKKrJlp1/yPmjUoI6mEXsJs/5HAVxxMbw9y3jf4Op7M5gTwLhATDv1hf7ok3dNdNgvyF5Xj8to36rk5fFwh5w+9qaSOtcyGmJdpjJTBV5jvTMNMJZZb1I/WG6OGRcEop50E9kh12J2F72wZdlq5VOEwgeAG/1nWiVZYnTpxESy/SU3pM7Ik/+iNvXGHcd7dVsCZvunByD+yaXmcCcgwrC2yhO+wn5VgzAgSwnJeIx06vtLhuBVZ2VrpjEg3zCHMf/XkDMfk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6560.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(136003)(376002)(39860400002)(366004)(396003)(451199021)(2616005)(83380400001)(6486002)(478600001)(316002)(186003)(26005)(6506007)(6512007)(54906003)(2906002)(36756003)(5660300002)(86362001)(4326008)(6916009)(8936002)(38100700002)(41300700001)(31696002)(8676002)(66556008)(66476007)(66946007)(31686004)(14143004)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?lMeWfFmXVxviBCiu7n4Ogyv/sXst?= =?utf-8?q?oU61Cq4Qh/cgWMkZfY9JrXcBLQu1EWoedcbuZt2ep2vcN1jz2O6StyzPr+sAsZk2i?= =?utf-8?q?Yg8umtSnLOL++3AZhtxZjCMQEdQa9myIA8J4xV/HvbE2fZsx6ugTIDn0CR8tJyjpW?= =?utf-8?q?PGNc/lKm+Oy5/EnptdfR6+IiCIEmYc55Nax6ra9ALoi7PHgH3YW5VhUqvdDj7G9fh?= =?utf-8?q?WkXB5oY8QLb4OZIKGLcz12apQeDGF2Qeilzgl0nXs0XhPMS32o1cHFKimtX8iNt+K?= =?utf-8?q?2NU6NB/qfj+mW52+eIcHusChWRPSpVAxr4NXBCF76X/EOpSDJYaijDD73kb4Pu23o?= =?utf-8?q?oqJyydX6GOL6XqGCVcMr43blg/vlPX9JhO47FLyq6C5Axj6xGky1uH6TlwfQkqBDI?= =?utf-8?q?CR4oA+Nap0v3IiGfqeFcgDbhDX6rvwzkbqUjBTTPYdZXzcUhcIhe3cWckQwt9sF7v?= =?utf-8?q?UucA06tvSQmI54zfLWtSQTkUlL8l2CTfTlalIFqR7qOKbQokPho+3w7YzgqGDy6VR?= =?utf-8?q?OCt8LwE41kFVZD49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poc45YHpb0CEMt6HOOk2+AyfbI/9k6lTDoRIrd3?= =?utf-8?q?GWFB5C8zTYEjx4cVX0TqmvEAo0w03LIspjwIjcz5vXJg9BIV/S2sUu6SA68VK5YjF?= =?utf-8?q?szww/ZqlVswd?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 248b542d-67f2-422e-c1d6-08db31119fc6 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 11:26:36.9286 (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: EEcg+3fq/oYA1PnQCOjBiEXykK6PXKWbSSI/XQ1Igkl7n28ctN3CPhzdNBIIraaDE9+nR5aKjpKIrorKgIE+fQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8468 validate_guest_pt_write(), by calling sh_validate_guest_entry(), already guarantees the needed update of log-dirty information. Move the operation into the sole code path needing it (when SHOPT_SKIP_VERIFY is enabled), making clear that only one such call is needed. Signed-off-by: Jan Beulich --- a/xen/arch/x86/mm/shadow/hvm.c +++ b/xen/arch/x86/mm/shadow/hvm.c @@ -656,6 +656,7 @@ static void sh_emulate_unmap_dest(struct { /* Writes with this alignment constraint can't possibly cross pages. */ ASSERT(!mfn_valid(sh_ctxt->mfn[1])); + paging_mark_dirty(v->domain, sh_ctxt->mfn[0]); } else #endif /* SHADOW_OPTIMIZATIONS & SHOPT_SKIP_VERIFY */ @@ -673,12 +674,10 @@ static void sh_emulate_unmap_dest(struct validate_guest_pt_write(v, sh_ctxt->mfn[1], addr + b1, b2); } - paging_mark_dirty(v->domain, sh_ctxt->mfn[0]); put_page(mfn_to_page(sh_ctxt->mfn[0])); if ( unlikely(mfn_valid(sh_ctxt->mfn[1])) ) { - paging_mark_dirty(v->domain, sh_ctxt->mfn[1]); put_page(mfn_to_page(sh_ctxt->mfn[1])); vunmap((void *)((unsigned long)addr & PAGE_MASK)); }