[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Argo: don't obtain excess page references
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Tue, 11 Oct 2022 11:28:06 +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=8PYxNmAx/0BwYebHPv3JpL7U0cAtJcGFRrWrDqUDEgM=; b=VuFP6tLulfhs1qWbX0vFoqctto7bGA60L95pNo1Soik8V8qV+/dGmke7sPL2+9zhzk4H0kSkRmqY9IiFPR54kqsKI5B3AgQ05mtEdlf204/+d3H+0mKyBBIOvS6CwLuzCR1GdTYsBgBaTtn/TH5KD1a4onQ/vIYdux//Ne7MUSqjD2ok8HLJDc+qRcQpY4++gLc/vbiqMYhjrfdKyI07L5AGMhgQXw/ZdaBtg4gmbrPBa908XrRe04ueJ4Newuga6m3T9pveDGtZbNZHSobwjkM/KGFVBqPk9ex47gFtaq5SR/bgWmEelceC7if2aObO0YHm+i7Pk7V5LT2PWlhqQQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JX2G5Hrb2e11gb0n9RjKB/eO0dJZ9bcxjCF5cxm4Ird0YYOCbqiAxoYhpyiqkK5wTO+n1YPB2TNQWRHAcaKkEK8e8KsUGW6yht5X+e0DsX6K9houVgplIxBTBnfEvKu9Lp6w22MuT4hbx5iUX0wBg+IavGhG7GrH2/Rzsnxz7mRYcCo0sSpqDC7ibiraCHBMXuswatUks1TJlYiEu9WC4aqsIImyFvXjgDCx+WVemaa5pU8HBpSCKi4ySOHtpr0wU/2OZ8l8SEwFBKlq7TO8KZwq8O74RpLjTRscAFRwC56QNJrj2yap0RiKK8kwtwK/eOd+cm35gm4bimS8LKfJqA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Christopher Clark <christopher.w.clark@xxxxxxxxx>
- Delivery-date: Tue, 11 Oct 2022 09:28:23 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
find_ring_mfn() already holds a page reference when trying to obtain a
writable type reference. We shouldn't make assumptions on the general
reference count limit being effectively "infinity". Obtain merely a type
ref, re-using the general ref by only dropping the previously acquired
one in the case of an error.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
I further question the log-dirty check there: The present P2M type of a
page doesn't really matter for writing to the page (plus it's stale by
the time it is looked at). Instead I think every write to such a page
needs to be accompanied by a call to paging_mark_dirty().
--- a/xen/common/argo.c
+++ b/xen/common/argo.c
@@ -1429,10 +1429,11 @@ find_ring_mfn(struct domain *d, gfn_t gf
ret = -EAGAIN;
#endif
else if ( (p2mt != p2m_ram_rw) ||
- !get_page_and_type(page, d, PGT_writable_page) )
+ !get_page_type(page, PGT_writable_page) )
ret = -EINVAL;
- put_page(page);
+ if ( unlikely(ret) )
+ put_page(page);
return ret;
}
|