From mboxrd@z Thu Jan 1 00:00:00 1970 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 10C1FC3600E for ; Thu, 27 Mar 2025 09:00:43 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.928737.1331401 (Exim 4.92) (envelope-from ) id 1txj6A-0006rA-59; Thu, 27 Mar 2025 09:00:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 928737.1331401; Thu, 27 Mar 2025 09:00:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1txj69-0006r3-W8; Thu, 27 Mar 2025 09:00:25 +0000 Received: by outflank-mailman (input) for mailman id 928737; Thu, 27 Mar 2025 09:00:24 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1txj68-0006qx-8n for xen-devel@lists.xenproject.org; Thu, 27 Mar 2025 09:00:24 +0000 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [2a00:1450:4864:20::62e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e8707f34-0ae9-11f0-9ffa-bf95429c2676; Thu, 27 Mar 2025 10:00:19 +0100 (CET) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-ac6ed4ab410so111794266b.1 for ; Thu, 27 Mar 2025 02:00:19 -0700 (PDT) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with UTF8SMTPSA id 4fb4d7f45d1cf-5ebccfb049csm11036342a12.42.2025.03.27.02.00.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Mar 2025 02:00:18 -0700 (PDT) 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: e8707f34-0ae9-11f0-9ffa-bf95429c2676 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1743066019; x=1743670819; darn=lists.xenproject.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=L2jgDOvPwmBkenNWZjM8NoOIHmfh1BQmSjH3lIERFBM=; b=vLEkkz/TW7MUX93qgd6E5BvH21sFqFjlXY1HVNz6K91SHhQMA/vhNHJf8tYyZFUyAv kF6cggq6P/0aQ0gIreFfqe37OrWK3TIPH96T0gBlN0IG/ng/xoCY5r7GbzPlXXr3hXgv dczaOoPuYMf2OQVLRMouLFUQadBYx8fud23Ec= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743066019; x=1743670819; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=L2jgDOvPwmBkenNWZjM8NoOIHmfh1BQmSjH3lIERFBM=; b=TcwFOTF3v0w7UvRFdAz6BogumDDs8qYXGn/MHyUtMyQHcbt9R/LnbPkKTm6b5H5sRo ER12piNNcL6fL3tUJxPSvXZzWU4PSe4/jONpAS04gOi5ySfSPIIDfJTReMkjeM8/bXOF 9P5s8zVUBFMPsu5+AIkKKoQzlbSx7wu61PcbnJ4XkLxBBxAjhxxUobb810f3dEpKgR5x nnxS0WNYCm4zGeL33Q8NT9WM7+0t7gei3WpwSjcoARD9WCm/d2owfdVgYWNIZl7kldPx AM0Mkf2TCX86C02AVc1xHxKhM/LqcwkSQAasLWsU/3sTUTkw7no6fSZZv2hjvV+WlTwX abdw== X-Gm-Message-State: AOJu0YzaHw9hHKlE3vAUPQqheFRmxNqN3f56dbddv+ZVlKjSGhEXbMab BdkfS0SJvRh6Na0uqTS9OHJTJjsYi9YS58aSLkQtXVx79U/l6qgoKMLPV63h33zPVbKXQUuUXCN 4 X-Gm-Gg: ASbGncvDVfcBdMb50FJWBUyhvi2g0Rd8L6IS1DxaOV6PojTNwtHH1Fpr18xJK/bc7BN YSv0/ZPGVrdvhmaPKmJ6K9Jasxv0++XILU1ETtAOanznlgBvdcjC78ra1TaBScbkZQAq/u7u768 mC+jjj3YyoMcau0DiiL1p8olHdAYbCZshNCzAiev9R3bQkWpkGBXxdSRDi3SHypn7X8PvETubBM thY4ef1hhYWZbUt140I817BGvQcDyui8zTpt99WKCRhALo4wbl/sbE3lp9K9KG/kQt7puJ6b0gd l4/IaZMGpY5FH0UEXbZK0pQq8t65ttLwkE0teLfTNgUKUregmA== X-Google-Smtp-Source: AGHT+IHuea3Lnyi+pm77wHtv7sp2DeHAn/DPNJ4gr7I/cqFIyK/6GLFojOUWxgyf96N5I/S2H2gNQg== X-Received: by 2002:a17:906:6a20:b0:ac6:b243:e480 with SMTP id a640c23a62f3a-ac6fb0fd669mr226362966b.42.1743066018664; Thu, 27 Mar 2025 02:00:18 -0700 (PDT) Date: Thu, 27 Mar 2025 10:00:17 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Jan Beulich Cc: "xen-devel@lists.xenproject.org" , Andrew Cooper Subject: Re: [PATCH v2] x86/P2M: synchronize fast and slow paths of p2m_get_page_from_gfn() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Tue, Mar 25, 2025 at 08:17:04AM +0100, Jan Beulich wrote: > Handling of both grants and foreign pages was different between the two > paths. > > While permitting access to grants would be desirable, doing so would > require more involved handling; undo that for the time being. In > particular the page reference obtained would prevent the owning domain > from changing e.g. the page's type (after the grantee has released the > last reference of the grant). Instead perhaps another reference on the > grant would need obtaining. Which in turn would require determining > which grant that was. > > Foreign pages in any event need permitting on both paths. I've been wondering about this, and AFAICT the PV equivalent of this function (the tail of get_page_from_gfn()) is much more limited in that it just allows access to domain owned RAM or MMIO that has a backing page (I expect mostly for the low 1MB?). However for HVM domains we allow to take references to foreign mapped pages and taking references to MMIO pages is not permitted. Should the tail of get_page_from_gfn() also be adjusted to make use of the newly introduced get_page_from_mfn_and_type(), thus unifying the logic for both PV and HVM? Could possibly be done in a separate change, I'm just trying to understand why we have this seemingly different handling for PV vs HVM. Thanks, Roger.