[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] x86/ept: limit calls to memory_type_changed()


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 27 Sep 2022 08:35:20 +0200
  • 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
  • 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=iIr6NuGjff+Po5IsD9ItbZh4rwNiw03g7QwP09PZqyk=; b=XB9fE16yRNxlbtgABJ/wMRKFYnmlD/TXZ7dmWrF9yk7nfaBl57MzHFr7VyZ164dCvx/2/AD8uwG5vqcCo6dHrIMgJtTr6U3+yD4UXeudjioT3Rpq8DEoyGmnCM0DBZqrqAvgEP7qBlopZ57+KEzrd9d+JMzm3nJpMruhjSmv6jcyqK+otqX+FxRtDWeWreTjhO+t5z411SuosAmSJjPbX3oHF+cdWeJdwBxh+wma6SoKuYP/wUhNE4VcAvsDkmjeeAoCtZ8+yn27srSuUZBiSQ8/XAkvX+Bs5/IL91Hgb54h7oDbMiS/2ORZSZHH1gBFcvBiYtyQvoaYemIpoY39sA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lYD49ReDlBsiO4TWWgHf/kbnNqYHZnjwwMvl+iJgdg99dvsBK4cHsr5ScHApRf+v/FC0TmyDkFFpA2BeE4spNyKtVnuELrdYLQMQWynsQ5Fu6RHqrx5n9/vK4oHgIHItAGX5OrIy1lRjZiz/jyqpAKYNGyHJM2jDGSn/iHXNb0X1JK8z40WuAgUHUfbGFdx4ah7mnVo5anFkbwu1cYkOQRIGzt4dj40NrqwNk7HQcjNeR8lcEXhM/E89V0QamqhkNxPsa68QC38ehTp5J+Rhe+Akplu8kmZG1zQONrs1w6hYRBlLv/UPHcMvdPtmcdVRZoNRG9ffVTPVDo+V1qXG3g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 27 Sep 2022 06:35:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.09.2022 17:58, Roger Pau Monné wrote:
> On Mon, Sep 26, 2022 at 05:36:41PM +0200, Jan Beulich wrote:
>> On 26.09.2022 17:25, Roger Pau Monné wrote:
>>> Correction: the Arm memory_type_changed() needs to stay, as
>>> iomem_{permit,deny}_access() is common code.
>>
>> Right, or we'd need some other arch abstraction. (I wonder whether
>> long term Arm can actually get away without this. Even on the AMD side
>> of x86 I don't think it's quite right that adding/removing of MMIO
>> ranges has no effect on the memory type of accesses.)
> 
> IIRC there's no way for the hypervisor to infer cache attributes on
> AMD SVM for NPT entries, but maybe I'm missing something.  Guest MTRRs
> settings are completely ignored for AMD guests.

Right, as documented: "Note that there is no hardware support for guest
MTRRs; the VMM can simulate their effect by altering the memory types
in the nested page tables." That's something we imo should do, but which
I don't think we actually do (see p2m_type_to_flags()). We respect the
PAT bit when splitting large pages, but I don't think we ever set the
bit when making new / updated entries.

>  I'm not able ATM
> however to find in the AMD PM how effective cache attributes are
> calculated when using NPT however.  I would guess host MTRR + guest
> PAT?

First guest and host PAT are combined, then the result is combined with
(host) MTRR. See the tables in the "Nested Paging" sub-section "Combining
Memory Types, MTRRs". Of course things are quite a bit more limited (but
also simpler) in shadow mode.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.