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

Re: [RFC PATCH v2 1/2] xen/memory : Add a stats_table resource type


  • To: Matias Ezequiel Vara Larsen <matiasevara@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 14 Dec 2022 08:56:57 +0100
  • 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=zo4vZGUxkZXAazECKQB+/3LjGsIxwEmAkmnlT1+b+vI=; b=hpqX7Ccvo5d/dcKX7npFsGucDLe1f7cKTQQpB774Ae1g2UDyeT/AcsfJssIkVDJG6ouFd34sPyWfwgamKRw0Z1nq/SyWzaqBh5YavWTfzb7+7WRyS303yFrJb4m68209jwlzIN4Tymq2bZAYPV10OZKznX2BvqHF7qZgg3PuiatqhlOgHvZGLq6XIE7SSUWv0qo5uoG6I6OgMStxG8mYad4+uLWpKXll3QyWUDEnB9Q+mjxvhVxJsWJhkSLcr54WOavtIOf4duApqAITuL2fVadCVWq1YOhbMCuJ1bK9Lbl/A9Wbsiecf3MBjS2OIhesueuUaN5+rpqXC78/+FElrQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GE2TvQZSvJDB/pXIRF3v+JnDkV0a9AYmhvPgQqVgOiw2vjg4tPWlKT5+n9IlBJBz9oQu4s3FwNXY+h4r7/WQ7PuVLYDdashjH6xKfIh22aWxY53h7g31w/r18QfCmuf4i3IDNcWuDNLRWoiroVfnD54YXf9K17KwtpkmIP72/LTt16qYthhQHrKs8Stsv1wULvPzrMHxITSpOMENVH1LCGwIJjZp6JU9LIwhW+F7A0P9kWjM65rO+vFqnB2NMSgPKtHeg+HA0XSSIFt0wBFd0TIFer8/7ywnEg0N4yv9QLa0hHaeCJXpTv67JQCJWJpSWXP1kAz/3hfQ2NMKo2xZuw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Matias Ezequiel Vara Larsen <matias.vara@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 14 Dec 2022 07:57:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.12.2022 08:29, Jan Beulich wrote:
> On 07.10.2022 14:39, Matias Ezequiel Vara Larsen wrote:
>> +static int stats_vcpu_alloc_mfn(struct domain *d)
>> +{
>> +    struct page_info *pg;
>> +
>> +    pg = alloc_domheap_page(d, MEMF_no_refcount);
> 
> The ioreq and vmtrace resources are also allocated this way, but they're
> HVM-specific. The one here being supposed to be VM-type independent, I'm
> afraid such pages will be accessible by an "owning" PV domain (it'll
> need to guess the MFN, but that's no excuse).

Which might be tolerable if it then can't write to the page. That would
require "locking" the page r/o (from guest pov), which ought to be
possible by leveraging a variant of what share_xen_page_with_guest()
does: It marks pages PGT_none with a single type ref. This would mean
...

>> +    if ( !pg )
>> +        return -ENOMEM;
>> +
>> +    if ( !get_page_and_type(pg, d, PGT_writable_page) ) {

... using PGT_none here. Afaict this _should_ work, but we have no
precedent of doing so in the tree, and I may be overlooking something
which prevents that from working.

Jan



 


Rackspace

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