[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: Mon, 26 Sep 2022 17:36:41 +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=XiRO1fbiMz0K0BF4WVdahsc51lQbrzcFmA4oYs8BhU8=; b=e2/eQVC451wQVaEMEhp4M/6vc642FMP2G3Uexo4V8OPnywUhNQkY1AcIrYuiirZocLQZVqpeALKD+kC3sKjksT8utKsfoKySgri7ZBGkYqt/29PGZo+Ja2YMnYHIzl2HgE72ru7keqNHsKTwdeF+xcklJfJWqlmTOLQIA5YSUHuII5u0iUC5zmXn5gYJP7PJ5pvca7+dbBZVV2ZpEzMV1WdPBWitmVjIib47n0TUS+o1NzZQMNBFYMH4U6esKYVNK1g9Red1NyQPKfwIjRPqnscXqSb8OIYP3HduSzEmFHj+cwiCaAWxurSVCesXn6en7dyo+9BXM0MxSr5K+JAYCg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GmtQ7ebnfaPlrVPL+vMi61szgYsXIvOpBts1FIAN2tpOIJEvh6TshlR+/dqFPiQgc+v0SErl8qImhnJpd5F9IZrBx+VdDc7OB7YBNjLatx+NT2qsyqmn83vpmW50sGuUvdhpt3XTjF9Natk6dPiPDhVxM4/Esbn9EQVd09LQ3atuE5wQ8/oZdu8fgZGmm5NbgGXCwWEWJOtI5w73Dvlj+UncMP+W+Mv0Ueal3FWqHeOnJaMp1IhAFv2lXSw74OS8pBvpFfclZF03jixbHspnPcKNwEXXpYK/epJPHL9vnlM8YnevI6EH6R6NTmIxzH7c0tlTzssCc5o6mMT4x3lw+A==
  • 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: Mon, 26 Sep 2022 15:36:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.09.2022 17:25, Roger Pau Monné wrote:
> On Mon, Sep 26, 2022 at 04:50:22PM +0200, Roger Pau Monné wrote:
>> On Mon, Sep 26, 2022 at 09:33:10AM +0200, Jan Beulich wrote:
>>> On 23.09.2022 10:35, Roger Pau Monné wrote:
>>>> On Thu, Sep 22, 2022 at 09:21:59PM +0200, Jan Beulich wrote:
>>>>> On 22.09.2022 18:05, Roger Pau Monne wrote:
>>>>> And if we were to restrict the calls, I think we need to clearly
>>>>> tie together the various places which need updating together in
>>>>> case e.g. the condition in epte_get_entry_emt() is changed.
>>>>> Minimally by way of comments, but maybe by way of a small helper
>>>>> function (for which I can't seem to be able to think of a good
>>>>> name) sitting next to epte_get_entry_emt().
>>>>
>>>> Such helper function is also kind of problematic, as it would have to
>>>> live in p2m-ept.c but be used in domctl.c and x86/domctl.c?  It would
>>>> have to go through the p2m_domain indirection structure.
>>>
>>> It would need abstraction at the arch level as well as for !HVM configs
>>> on x86. I'm not sure the indirection layer would actually be needed, as
>>> the contents of the function - despite wanting placing in p2m-ept.c -
>>> isn't really vendor dependent. (If AMD/SVM gained a need for a similar
>>> helper, things would nee re-evaluating.)
>>
>> Maybe it would be better to add the calls to memory_type_changed()
>> directly in iomem_{permit,deny}_access() and
>> ioports_{permit,deny}_access itself?

I'm of two minds - on one hand that would nicely take the call "out of
sight", but otoh this would feel like a layering violation. Yet then
maybe it's a layering violation no matter where that call lives.

>> That would also allow to remove the noop Arm memory_type_changed()
>> halper.
> 
> 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.)

Jan



 


Rackspace

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