[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] x86/p2m: don't calculate page owner twice in p2m_add_page()
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Tue, 29 Nov 2022 17:44:55 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- 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=d4IL8K7KB8uKCOf1ktcW//JXR37dQM3ALNhhjLMMZbY=; b=j80ilVhqZ6gXNDdm1ArA8K/2+lf+Ne6S7IA7lSci+UbPNIquGNiLCmRPbhwMVhXizXdRKM+ZV7sYjwk0d6EkGwSi+XYoRwGG4gXsnh1yiz4GzB5zHPAEHIKmYyvS+45k8vkDMdtar9pj3gVVrlF93JmftHj0nkcRIVBilB+GFWrVw7OqtwRL/l37WddpmAbQMjjMUmB2ohJitS5xaEeoOIUcJkijUN1JwDaiyAggY6FSDJKPHdZZIl2RnDXLFiD1ZALLuB6bTf3BWZ7EidhmayKsa1NSbdSpog7kxJCSglMLH4njRGjwm9qeMuf0XxGWIZ0bDks9rE4xczKrd4qUIQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TqDXVbOVKOa2nuwLfszkdm+JFhuhORgNkfwS4A8x+ZiumSMxkEy3Uq885Ef6EyvBAsFaCg3qP3+ys/J6QEWdwnv6Q+RtmVw/HDgvFHCpui5YCHWf/bM9L/0K4/FGrw50vo+Q5qgjnotPVy59Bv8OPl0+1bxsC5gH1/a+kPVKTjLsMjCOIDSKoEIzjFSAuPB6kMI2oQ8iUUWEFEKdDFhz9HdPYn6VRxeaNPXD6Csze/NBXrPB7pwVRcyN0cAgvCdVWWLg4ITj6ZsbSkzwz0WRzS3oILSp1odzau2FFvMLs1Ew4yf0MCOimFJP4htxya/2M95K+lU825ixYPH2Iu3FhA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>
- Delivery-date: Tue, 29 Nov 2022 16:45:11 +0000
- Ironport-data: A9a23:hyRiYKK+cBXxu0goFE+R9pQlxSXFcZb7ZxGr2PjKsXjdYENS0WBSx 2sXUG+HO/rbYGb2f9p2b9/lpkoBvZTdzoRnSAFlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHv+kUrWs1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPdwP9TlK6q4mlB5wZvPasjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5IBHNM7 8xAJQwkdyCIiuWLm5S+eK5F05FLwMnDZOvzu1lG5BSAVbMDfsqGRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/dqpTGLlGSd05C0WDbRUsaNSshP2F6Ru 0rN/njjAwFcP9uaodaA2iLx2b6fzX+hMG4UPLOc1MZAnHev/WhJUSdRZXSC+cKLh1HrDrqzL GRRoELCt5Ma9kamU938VB2Qu2Ofs1gXXN84O/037kSBx7TZ5y6dB3MYVXhRZdo+rsg0SDc2k FiTkLvBGjhHoLCTD3WH+d+pQSiaPCEUKSoHenUCRA5cu937+thr1lTIU8ppF7OzgpvtAzbsz juWrS84wbIOkcoM0Kb99lfC696xmqX0oscOzl2/dgqYAslRPuZJu6TABYDn0Mt9
- Ironport-hdrordr: A9a23:KdqdTa00VrHx3ta5o+1VXAqjBdJxeYIsimQD101hICG9Lfb0qy n+pp4mPEHP4wr5OEtOpTlPAtjkfZr5z+8M3WB3B8bYYOCGghrQEGgG1+ffKlLbexEWmtQttp uINpIOcuEYbmIK8voSgjPIdOrIqePvmM7IuQ6d9QYKcegDUdAd0+4TMHf+LqQZfnglOXJvf6 Dsm/av6gDQD0g/X4CePD0oTuLDr9rEmNbPZgMHPQcu7E2jnC6l87nzFjmfx1M7XylUybkv3G DZm0ihj5/T+c2T+1v57Sv+/p5WkNzuxp9qA9GNsNEcLnHBmxulf4NoXpyFpXQQrPu04Fgnvd HQq1MLPth16VnWYmapyCGdkDXI4XIL0TvP2FWYiXzsrYjQQy87MdNIgcZ8fgHC40Qtkdlg2O YTtljp/6Z/PFflpmDQ9tLIXxZlmg6dpmcjq/caizh6XZEFYLFcgIQD9Ad+EYsGHgj99Ic7ed MeRf301bJzSxe3fnrZtm5gzJiFWWkyJA6PRgw4tsmcw1Ft7QVE5npd4PZasmYL9Zo7RZUBzf /DKL5UmLZHSdJTRb5hBc8aKPHHRFDlcFbpCia/MF7nHKYINzbmsJjs+og44+msZdgh0IYyop LcS1lV3FRCNH4GMff+nKGjzyq9A1lUBV/Wu4NjDtlCy/HBrYPQQGy+oAtEqbrknx0daverKc pbdqgmR8MLFlGeabqh7zeOJaW6FkNuIfH9muxLL25m8fi7XbHCh6j8TMv5AobLPHINZl7fa0 FzLwQbYv8wo3yWZg==
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Tue, Nov 29, 2022 at 03:47:53PM +0100, Jan Beulich wrote:
> Neither page_get_owner() nor mfn_to_page() are entirely trivial
> operations - don't do the same thing twice in close succession. Instead
> help CSE (when MEM_SHARING=y) by introducing a local variable holding
> the page owner.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
> According to my observations gcc12 manages to CSE mfn_to_page() but not
> (all of) page_get_owner(). The overall savings there are, partly due to
> knock-on effects, 64 bytes of code.
>
> While looking there, "mfn_eq(omfn, mfn_add(mfn, i))" near the end of the
> same loop caught my eye: Is that really correct? Shouldn't we fail the
> operation if the MFN which "ogfn" was derived from doesn't match the MFN
> "ogfn" maps to?
Getting into that state possibly means something has gone wrong if we
have rules out grants and foreign maps?
So it should be:
if ( !mfn_eq(omfn, mfn_add(mfn, i)) )
{
/* Something has gone wrong, ASSERT_UNREACHABLE()? */
goto out;
}
rc = p2m_remove_entry(p2m, ogfn, omfn, 0)
if ( rc )
goto out;
but maybe I'm missing the point of the check there, I have to admit I
sometimes find the p2m code difficult to follow.
Thanks, Roger.
|