From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54EE0C3A59F for ; Wed, 23 Nov 2022 17:09:33 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.447697.704220 (Exim 4.92) (envelope-from ) id 1oxtFO-0008Ji-4c; Wed, 23 Nov 2022 17:09:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 447697.704220; Wed, 23 Nov 2022 17:09:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oxtFO-0008Jb-1z; Wed, 23 Nov 2022 17:09:18 +0000 Received: by outflank-mailman (input) for mailman id 447697; Wed, 23 Nov 2022 17:09:17 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oxtFM-0008JV-Ve for xen-devel@lists.xenproject.org; Wed, 23 Nov 2022 17:09:17 +0000 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [2a00:1450:4864:20::22e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8f204587-6b51-11ed-91b6-6bf2151ebd3b; Wed, 23 Nov 2022 18:09:15 +0100 (CET) Received: by mail-lj1-x22e.google.com with SMTP id r8so11493271ljn.8 for ; Wed, 23 Nov 2022 09:09:15 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8f204587-6b51-11ed-91b6-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=k3ZmQCA06DghUmm4/08LgMrzJ9Jcm98zIeKuuGnYmnE=; b=Z3w2hDG+gD3kDBUDOTKXJiKkdYGarxhaa7IjKH0qdbpY71ZVkcDbJYapTe/6UN+bap h+VQjDuJKwCCu4AqiErj6uj3ro/k5ooGbEANq/uGQHiK38hbNlxnMCSpZFV7TfD5aES9 W4qlBd2ahS5ueBTlVBHxmoANBK2zGvvStCF+zUarDzP013T0Jbt0hlpWfSTEF9PEBGXZ cQODspNYYHb0aIUhb14/zAayPMNLsMjCX3Ii5z8Nn15s7dqyAPIvEdYvfy/Aaan88Zlb i6fp5YBXg862xT0+FO5DNH+NMC9YMmFgwXt8iHD2tdmopNULL2qiWKKN9qzd0+mgKat+ fCoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=k3ZmQCA06DghUmm4/08LgMrzJ9Jcm98zIeKuuGnYmnE=; b=ELU5232YOyhz8rMQ0wv0N8VqtY6LSywJQTTy0UuwhDjdp5nxIHil3R/d+ere2wNCJL tZ6RIjMXvSBaTJS6Xe9786naCtvBo8tLhWYBeBj6sm3U8SV3vvvqYuLa4X5uSeFRXdCj aVVYWrK5+yuOSJ3IKs90XPu3mTDNhRRAuIAf6a3JybFf7f7a6S4C4ZxUNDHGJf2+AR5z gGOxn4DvdOlBps83I6SXJyHvjY/EhIoGGwjRXkUrmdzPalYY93eHli/HWH4ssh+y5NIf 4ch9jV/BTrMOhRBC0qVGO7IyTZv8Bh76X1atLVXcfjKJV6cXE52XMvR8JnfbnzjIZ+pV SaVw== X-Gm-Message-State: ANoB5pkx0BlcA7PQElyvo13EMHntAvcBhvRnzH/+KEiQjdnRn2jDK9P4 x0X7Ef4oNUul3G2qnclK1PHWEYCc6FmeYSVGetI= X-Google-Smtp-Source: AA0mqf4+wh3zmf6SqcU+g9RnG/X8Je08CCEtO5G2E9SpIQOlEkVftFtm9SKylmUdUnN1i8yl1Wi0ljK1OTofLYT9i14= X-Received: by 2002:a2e:be1c:0:b0:26e:6fb:4845 with SMTP id z28-20020a2ebe1c000000b0026e06fb4845mr4391642ljq.120.1669223355226; Wed, 23 Nov 2022 09:09:15 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Christopher Clark Date: Wed, 23 Nov 2022 09:09:01 -0800 Message-ID: Subject: Re: Ping: [PATCH] Argo: don't obtain excess page references To: Jan Beulich Cc: "xen-devel@lists.xenproject.org" Content-Type: multipart/alternative; boundary="00000000000023a07805ee26597e" --00000000000023a07805ee26597e Content-Type: text/plain; charset="UTF-8" On Mon, Nov 21, 2022 at 4:41 AM Jan Beulich wrote: > On 11.10.2022 11:28, Jan Beulich wrote: > > 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 > > Ping? > Message received -- I will look at this. Thanks. Christopher > > > --- > > 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; > > } > > > > --00000000000023a07805ee26597e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Mon, Nov 21, 2022 at 4:41 AM Jan B= eulich <jbeulich@suse.com> w= rote:
On 11.10.2= 022 11:28, Jan Beulich wrote:
> find_ring_mfn() already holds a page reference when trying to obtain a=
> writable type reference. We shouldn't make assumptions on the gene= ral
> reference count limit being effectively "infinity". Obtain m= erely 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@suse.com>

Ping?

Message received -- I will look a= t this. Thanks.

Christopher
=C2=A0
=

> ---
> 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<= br> > 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
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D -EAGAIN;
>=C2=A0 #endif
>=C2=A0 =C2=A0 =C2=A0 else if ( (p2mt !=3D p2m_ram_rw) ||
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 !get_page_and_type(p= age, d, PGT_writable_page) )
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 !get_page_type(page,= PGT_writable_page) )
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D -EINVAL;
>=C2=A0
> -=C2=A0 =C2=A0 put_page(page);
> +=C2=A0 =C2=A0 if ( unlikely(ret) )
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 put_page(page);
>=C2=A0
>=C2=A0 =C2=A0 =C2=A0 return ret;
>=C2=A0 }
>

--00000000000023a07805ee26597e--