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

Re: [PATCH v8 08/13] vpci/header: program p2m with guest BAR view


  • To: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 24 Jul 2023 12:43:26 +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=C6wO8FBEHzc5PzmCi6rSpI2LcKx70ml1aeaqOcxC6ik=; b=AIdSeRUiSr+yRxCn3gkT+buefQmRdybCfc+PKi95MsQWAiB5yShxF2EGSxgU7DSJqjGXbVPWQ/2yAe1kPxRHMCUoRIT8q9X2oKTOifmNrXaO23JVifBzRRlxis9Pepv8pCX70VvKz5TQi+7DpgXDxnR0FkdD/un9sPkmlOxa+QaIMDOXiQqH0cunBN2T4i8+BJWyqwKzL1Ppzw9S2yjWvicbfoJcu/jM1eCF31adkA8OBweLg+i63rX7NQOPV+EwLGGA44mEvxxZiDwWXtQGeMd7bgmD/+iJfeAfl/oZUZZpn3NUAsd44houdcTnhiYk6HU5noaSaTUuH20gm3KclA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L7RkoT7QsftZogJL7Wgo5hX6vObQT5J9zyIyLjin9HBNHgs+zDzp8HK4B11F9boE9bsVaPtwjWVFHpoIiBcxBsdNpwYO1a7YtIZEv5pSEy1oPI/18OEzcBiMsP0Of2yLytMBQ0hRb33rPetqjYw3hPeCOFdeKkcUH696lbQZGPgS12RY4ZzvDO83EWZtzwdUTe8TJU8hyAAOF67qPvJb6+UPTIMXjIe3nx7CtpzHpfjN1WiqIuFXs2a7MSm08568Zg9cIVWrkOEAer5tK3uAI8eUWhlGbtol4VFDeQpxEdbh4UrffpvQfl3v4jG9WvIILa00SddQqQhUTaHtkyk+GQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 24 Jul 2023 10:43:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.07.2023 02:32, Volodymyr Babchuk wrote:
> @@ -52,8 +66,8 @@ static int cf_check map_range(
>           * - {un}map_mmio_regions doesn't support preemption.
>           */
>  
> -        rc = map->map ? map_mmio_regions(map->d, _gfn(s), size, _mfn(s))
> -                      : unmap_mmio_regions(map->d, _gfn(s), size, _mfn(s));
> +        rc = map->map ? map_mmio_regions(map->d, start_gfn, size, _mfn(s))
> +                      : unmap_mmio_regions(map->d, start_gfn, size, _mfn(s));

Aiui this is the first direct exposure of these functions to DomU-s;
so far all calls were Xen-internal or from a domctl. There are a
couple of Arm TODOs listed in the comment ahead, but I'm not sure
that's all what is lacking here, and it's unclear whether this can
sensibly be left as a follow-on activity (at the very least known
open issues need mentioning as TODOs).

For example the x86 function truncates an unsigned long local
variable to (signed) int in its main return statement. This may for
the moment still be only a theoretical issue, but will need dealing
with sooner or later, I think.

Furthermore this yet again allows DomU-s to fiddle with their p2m.
To a degree this is unavoidable, I suppose. But some thought may
need putting into this anyway. Aiui on real hardware if a BAR is
placed over RAM, behavior is simply undefined. Once the BAR is
moved away though, behavior will become defined again: The RAM will
"reappear" in case the earlier undefined-ness made it disappear. I
don't know how the Arm variants of the functions behave, but on x86
the RAM pages will disappear from the guest's p2m upon putting a
BAR there, but they won't reappear upon unmapping of the BAR.

Luckily at least preemption looks to be handled in a satisfactory
manner already.

Jan



 


Rackspace

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