Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp289640pxb; Thu, 30 Sep 2021 06:12:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxXA5xu1bZbaCbS3pzC5PLpVxa/pbnUwTgCENEjwWH+pGY+6y1X7j8lnF+eEyU3iDFWpgv X-Received: by 2002:a17:902:bb8d:b0:13e:6e78:87a1 with SMTP id m13-20020a170902bb8d00b0013e6e7887a1mr2869582pls.24.1633007568142; Thu, 30 Sep 2021 06:12:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1633007568; cv=pass; d=google.com; s=arc-20160816; b=qV5xGZ6cleuBuCQtISQsawLtqm80QBnTSsyuDp5h0Rvx8ux92gIZ5hJMHPKMgkPGvv 4Ye5otAjEH3sXsWjItmJbDdQxARn7dVk662UjcqM77ICNm1HZLTmJEPwUXk9036YOEAc nknF7dYeX20OdzbbX5knNkYVxtYV4XOldmEzAyH0ERAQ65DqjRxfBrD0DUVxVS4pd03l mND8k8Vpj2OSHNelsFDtpxg3oe3bL1CKWQNU1XA8rqPy+MWISxawZ9Vy4PC5FBhPJtwn MxQpsdRHAenJZ6ciaNYAzaCgWBniU4TrmHExJ2mmr7aqXcqNxuXZKTrAG8AabqNgurzd KudQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:references :cc:to:from:subject:dkim-signature; bh=csvwBDBtFGc48jg4jEJIdJUsqEpEZpnnkIuWC7zw3YQ=; b=k9OSCohEyTmFW9TeDRB+4w77nhfTZw+z9V1HKgvD5sENyDREynoGfK4dLvGQrzDmN4 y01Q1orcoVCjRgzBj3Yf2OkQZtpCJGn0v+Vj/OKldvQhgEAn6Li85D0r61DsOj4ieajQ TJcgC0fqhYdRPz/KkvJPzaj6DswIoOWOSjjD+bpmgzM5G0V4Ef9IWUonrTkSs4xaW41+ GcH6/SOke1vqNRfWR3lmXMsThXIDoMrZYgWT023mvUkmCym5ZAptUQCpt+3ncOL9iB1a yFpbfR/fqwRKswZ8Aamvr3poSWqyNgDnFNgvSMqBQLAJdORRX+qyAOU9075xaMiysiIe rqdA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=mimecast20200619 header.b=bqvNY1Rp; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i11si2721223pfu.359.2021.09.30.06.12.27; Thu, 30 Sep 2021 06:12:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=mimecast20200619 header.b=bqvNY1Rp; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350915AbhI3Mho (ORCPT + 99 others); Thu, 30 Sep 2021 08:37:44 -0400 Received: from de-smtp-delivery-102.mimecast.com ([194.104.109.102]:27410 "EHLO de-smtp-delivery-102.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350647AbhI3Mhk (ORCPT ); Thu, 30 Sep 2021 08:37:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1633005357; 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=csvwBDBtFGc48jg4jEJIdJUsqEpEZpnnkIuWC7zw3YQ=; b=bqvNY1Rp3+97atd0vJfMyGRPQbRJVrhbbEJspkM+hBJK/l9rNiqm327UbdbUsu26poYojI 6eE0EeYH/9K1ilvbI0v2ZnLSS/iTudsMNpVMv8Rp8yXGfLtepBukGQW8+mgYRu5tMNTOC/ /bvsBvfjtfgdlUfeEjMMtSLDdQSdIJo= Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02lp2055.outbound.protection.outlook.com [104.47.6.55]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-23-4iLhtgzoOE-IdxjPXrGF9g-2; Thu, 30 Sep 2021 14:35:56 +0200 X-MC-Unique: 4iLhtgzoOE-IdxjPXrGF9g-2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FEdWrKHzXgjyp7ZEHrbXCFH6f7gIoRdJxTJRaM5qejyIyVP5t8YLM941Ss03r005KvIpTh+w66LzNQo8+4TcfIxapaGDiFInA7duYaZxTud6TPt7AqSsaq8Lx/oBw2SY7/MSWiL3oqcEZHxY+MfIr1S3u8ziwIK4FxZwW7f/YhW4TicFf3V8h4RTZc8NnV89jE2+hKmcBsAC8d+pMXBi1ftcmD8889QrL77QN2WuW2iuo5fpZeT47XZ49P/XJKNjk24ptdlvh1LHsLyQ+FIcqls0cj0zvGazmq6HzY+gfv/ZyF7HQxcOMBB6yG3Zhwm9HrxotvovuDubrOz2VW0MXw== 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=csvwBDBtFGc48jg4jEJIdJUsqEpEZpnnkIuWC7zw3YQ=; b=ZcvCV2pd5y9a99dHbgErSusWKYtrYYe1JVKdU+Fl6+9kfK/90vRoQVjEmE6q1n2811b5sAPf69SBxeBlVuYse7isclAJs956GlPonBVpu54oWs6/qOrGvzTspb3RTCrjLZUv29l2h3nNwrbGNmTQOsSRfxJtJ0kqmjKITl89pXZYdUhlG7TOB+wYPP4H9Xls4J8neNjCMOXvFPoxMmaxejYfnGmcadQxbUVmLXk9bWpYZ9CQig7KuNXy1POLCoqXJCWVuqZRm3XfZ9FAaKaki0fxxfrXcLzvJd40xyQPblcoonPQsQaNbg/468i4jNb7P3RrLy/nRP7E/sXv6GAdmw== 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: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com; Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VE1PR04MB6383.eurprd04.prod.outlook.com (2603:10a6:803:11b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.13; Thu, 30 Sep 2021 12:35:54 +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.4566.014; Thu, 30 Sep 2021 12:35:54 +0000 Subject: [PATCH 3/6] xen/x86: adjust xen_set_fixmap() From: Jan Beulich To: Juergen Gross , Boris Ostrovsky Cc: Stefano Stabellini , lkml , "xen-devel@lists.xenproject.org" References: <022b1a5e-4121-6bae-f07c-4ad5eac12481@suse.com> Message-ID: <11fcaea2-ec17-3edd-ecdf-4cdd2d472bd0@suse.com> Date: Thu, 30 Sep 2021 14:35:52 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <022b1a5e-4121-6bae-f07c-4ad5eac12481@suse.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AM6PR01CA0058.eurprd01.prod.exchangelabs.com (2603:10a6:20b:e0::35) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 Received: from [10.156.60.236] (37.24.206.209) by AM6PR01CA0058.eurprd01.prod.exchangelabs.com (2603:10a6:20b:e0::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.16 via Frontend Transport; Thu, 30 Sep 2021 12:35:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 733cb1a5-c54a-41c4-369a-08d9840ed853 X-MS-TrafficTypeDiagnostic: VE1PR04MB6383: X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: myEIyzqFlWR0QrxdEpAZVC+kMgoa8VyQRPVsJvIIB/9mrT6ZOoOJ53sMJyck12R5nMTjIuRneA7fU3mZOtVPxF/IpUAJzxRcF4QrYKkWHyaCjM+GdrxkpwYjGkemq5LTUIFLuO9mq0vXkqk0Z1NgbPukI7GjnCaGoo4EZ7lTYPidPJzS4brADk8XIix+EYobpcg4xqbWE8DjJumuPHc2CNSUjThGyr95nBBwU1BwA7GkIOLycVw3De2qFb4AKl71yLsdAm+XFe89/K7vwFR/0zM1jKmWgOdbfxToPxb2a3Zk1zkqD9so+/Jp/cXyQYiIUXeSCywNWVfjWiznDpjAZNVQ7lHxNy4VBRQCwTnfnxUC9CZHtoqHf286Tb3SG7ZQEXQ8wVETXsrjNlOEkXeD0XN4RVGDyDhUzNijQinc09b1tkut+wv7i1yJcPysW9PX4K+rCy23Tjh+HJL8lizfMDAhtndXUi+Y0deQ5niOT87aK6fGOdnZKl3YR/L/t+NVdl7VrzJFlJt1+kHRD2EVW6XfxDB7F36dw0spF24JV/wHhGkJrlNJGtd9/CyoR5piWigIndnre1js/4hdlvGRBW4fKjSOpElHtaoEdOr71/3MgOaHy9LA7sqh4N/XCVOuqigSYFG4wGHK4yOzO5Csb6De8VJGJqf0Slog9wcfHLPertff7YBdUA02Sv+udubbmCI+UVR8TVPre9slX5rNfg== 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)(4326008)(2616005)(186003)(956004)(508600001)(31686004)(66946007)(83380400001)(8936002)(86362001)(2906002)(31696002)(16576012)(316002)(38100700002)(110136005)(8676002)(36756003)(6486002)(66556008)(66476007)(54906003)(26005)(5660300002)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UFB3UlR3YkVQSU5ic1M5TlFsT3BjMURKYjNCZEtTdjFDaDhMbjk1WFB4ZFIx?= =?utf-8?B?Q1FVNFNDVVRLQVdzNCtJRmduckJMcS9PSm9tUHBqNy9JMm5RZCsxQUFZM0ht?= =?utf-8?B?UkpHcUtUNGhtbi9uZHFteVpsTUovRHRqczZ2UzNuQ1pENlRwVms4TWZCaGtq?= =?utf-8?B?emxWOHQwZ1k0cHNmaHlqZ3F3cmRkdW5pUGs5MFd2NExlL01mbVdHNllxRmlE?= =?utf-8?B?ZjZsTzhtbUZyTGMzdzdOaFMyZ1ppWHV0N0c5d3ZXOWlSOGNWVjJGNjd0VWI1?= =?utf-8?B?OGU4b2hQOXhIbTNTZ211R3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9YRDBSN1lYR3VvbWw1OUVGdXpwcXZuMERpRjRrNVBUN3ZKSlhZbzk4?= =?utf-8?B?RTdjeUR5cDhadWdsV3gySzR1VnlyTlR4RGpHVTlsZXNCQjFocFlrTStyVkNx?= =?utf-8?B?WEplR1FBYTVFc2hIUlhZS1hkU0I5ZGJLN09jMzFTbE9WQmE4VVRqQml2c1l1?= =?utf-8?B?Vmxid0UyVDAvN1NrbElQT2N1Nlk3dXlQdVdjMFFiS0dUeGx4LzY3a1l5U1VL?= =?utf-8?B?UkYyNWNxNjNKcXlyaEdWYXpnamRDTHNYc1lQY2N0T2o0aCtmUmwybVFDTUhl?= =?utf-8?B?OFZ3a0ZMZnFBTXJSK1NBWG44VFRHSnZMTEppaHhBczN4ek16eHQvdnZycWJZ?= =?utf-8?B?MzZKQ1NaMDBYSUprVmtvUGZ3b2M2VUcvNm5QdlhWeXIvSVprblc1QVp1SjYr?= =?utf-8?B?WjF0ZEJ3TnhLTnlaNWlndlNVNEZLa1ovdVYxN1VXVjB1MXcrdFlKbU9OQmJ2?= =?utf-8?B?NFRFNmg3ODlSdXkwUkp1d3planBYRUcvTXFPS0paaUQ1QW5OZzBxWWlscExm?= =?utf-8?Q?rX8YE4XHd/jpxBwtdja4KUYuj5kV+O7aAPytAvi?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 733cb1a5-c54a-41c4-369a-08d9840ed853 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2021 12:35:54.4645 (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: SgL0mzeJ4pJiRZIPT79Ewr88HsQdIU/G/WhWCllKZd+ErP5iAy3MdUnMGElgEPiueK0J3e7on0LHxLRtAnkq2w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6383 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using __native_set_fixmap() here means guaranteed trap-and-emulate instances the hypervisor has to deal with. Since the virtual address covered by the to be adjusted page table entry is easy to determine (and actually already gets obtained in a special case), simply use an available, easy to invoke hypercall instead. Signed-off-by: Jan Beulich --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -2010,6 +2010,7 @@ static unsigned char dummy_mapping[PAGE_ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) { pte_t pte; + unsigned long vaddr; phys >>= PAGE_SHIFT; @@ -2050,15 +2051,15 @@ static void xen_set_fixmap(unsigned idx, break; } - __native_set_fixmap(idx, pte); + vaddr = __fix_to_virt(idx); + if (HYPERVISOR_update_va_mapping(vaddr, pte, UVMF_INVLPG)) + BUG(); #ifdef CONFIG_X86_VSYSCALL_EMULATION /* Replicate changes to map the vsyscall page into the user pagetable vsyscall mapping. */ - if (idx == VSYSCALL_PAGE) { - unsigned long vaddr = __fix_to_virt(idx); + if (idx == VSYSCALL_PAGE) set_pte_vaddr_pud(level3_user_vsyscall, vaddr, pte); - } #endif }