From: Jan Beulich <jbeulich@suse.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: "sstabellini@kernel.org" <sstabellini@kernel.org>,
"julien@xen.org" <julien@xen.org>, "wl@xen.org" <wl@xen.org>,
"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
"george.dunlap@eu.citrix.com" <george.dunlap@eu.citrix.com>,
"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
"ian.jackson@eu.citrix.com" <ian.jackson@eu.citrix.com>,
"george.dunlap@citrix.com" <george.dunlap@citrix.com>,
"jeff.kubascik@dornerworks.com" <jeff.kubascik@dornerworks.com>,
"Xia, Hongyan" <hongyxia@amazon.com>,
"stewart.hildebrand@dornerworks.com"
<stewart.hildebrand@dornerworks.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [Xen-devel] [PATCH 2/2] xen/mm: Introduce PG_state_uninitialised
Date: Wed, 18 Mar 2020 14:27:00 +0100 [thread overview]
Message-ID: <3fa1dfe5-28e8-77fd-4898-62d68ffa058c@suse.com> (raw)
In-Reply-To: <80a0959cb68373b03c2d57fa9d0af6eb8b117d42.camel@infradead.org>
On 18.03.2020 13:11, David Woodhouse wrote:
> On Wed, 2020-03-18 at 11:03 +0100, Jan Beulich wrote:
>> On 17.03.2020 23:15, David Woodhouse wrote:
>>> On Thu, 2020-02-20 at 12:59 +0100, Jan Beulich wrote:
>>>> On 07.02.2020 19:04, David Woodhouse wrote:
>>>
>>> ASSERT((pg[i].count_info & ~PGC_extra) == PGC_state_inuse ||
>>> (pg[i].count_info & ~PGC_extra) == PGC_state_uninitialised);
>>>>> page_set_owner(&pg[i], d);
>>>>> smp_wmb(); /* Domain pointer must be visible before updating refcnt. */
>>>>> - pg[i].count_info = PGC_allocated | 1;
>>>>> + pg[i].count_info |= PGC_allocated | 1;
>>>>
>>>> This is too relaxed for my taste: I understand you want to
>>>> retain page state, but I suppose other bits would want clearing
>>>> nevertheless.
>>>
>>> You seem to have dropped the ASSERT immediately before the code snippet
>>> you cited, in which arbitrary other contents of count_info are not
>>> permitted. I put it back, in its current form after I rebase on top of
>>> Paul's commit c793d13944b45d assing PGC_extra.
>>
>> But that' only an ASSERT(), i.e. no protection at all in release builds.
>
> An ASSERT does protect release builds. If the rule is that you must
> never call assign_pages() with pages that have the other bits in
> count_info set, then the ASSERT helps to catch the cases where people
> introduce a bug and start doing precisely that, and the bug never
> *makes* it to release builds.
>
> What we're debating here is the behaviour of assign_pages() when
> someone introduces such a bug and calls it with inappropriate pages.
>
> Currently, the behaviour is that the other flags are silently cleared.
> I've seen no analysis that such clearing is correct or desirable. In
> fact, for the PGC_state bits I determined that it now is NOT correct,
> which is why I changed it.
>
> While I was at it, I let it preserve the other bits — which, again,
> should never be set, and which would trigger the ASSERT in debug builds
> if it were to happen.
>
> But I'm not tied to that behaviour. It's still a "can never happen"
> case as far as I'm concerned. So let's make it look like this:
>
>
> for ( i = 0; i < (1 << order); i++ )
> {
> ASSERT(page_get_owner(&pg[i]) == NULL);
> /*
> * Note: Not using page_state_is() here. The ASSERT requires that
> * all other bits in count_info are zero, in addition to PGC_state
> * being appropriate.
> */
> ASSERT((pg[i].count_info & ~PGC_extra) == PGC_state_inuse ||
> (pg[i].count_info & ~PGC_extra) == PGC_state_uninitialised);
> page_set_owner(&pg[i], d);
> smp_wmb(); /* Domain pointer must be visible before updating refcnt. */
> pg[i].count_info = (pg[i].count_info & PGC_state) | PGC_allocated | 1;
> page_list_add_tail(&pg[i], &d->page_list);
> }
>
> OK?
Yes, thanks.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2020-03-18 13:27 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-04 15:14 [Xen-devel] [XEN PATCH v2 1/2] Check zone before merging adjacent blocks in heap Stewart Hildebrand
2020-02-04 15:14 ` [Xen-devel] [DO NOT APPLY XEN PATCH v2 2/2] Test case for buddy allocator merging issue Stewart Hildebrand
2020-02-04 15:22 ` [Xen-devel] [XEN PATCH v2 1/2] Check zone before merging adjacent blocks in heap Jan Beulich
2020-02-04 15:37 ` George Dunlap
2020-02-05 9:50 ` David Woodhouse
2020-02-05 10:02 ` Jan Beulich
2020-02-05 10:24 ` David Woodhouse
2020-02-05 10:49 ` Jan Beulich
2020-02-05 11:23 ` David Woodhouse
2020-02-05 13:37 ` Jan Beulich
2020-02-05 14:12 ` David Woodhouse
2020-02-07 15:49 ` David Woodhouse
2020-02-07 15:57 ` [Xen-devel] [PATCH 1/2] xen/mm: fold PGC_broken into PGC_state bits David Woodhouse
2020-02-07 20:27 ` Julien Grall
2020-02-09 13:22 ` David Woodhouse
2020-02-09 17:59 ` Julien Grall
2020-03-17 21:39 ` David Woodhouse
2020-02-20 11:10 ` Jan Beulich
2020-03-17 21:52 ` David Woodhouse
2020-03-18 9:56 ` Jan Beulich
2020-03-18 12:31 ` Julien Grall
2020-03-18 13:23 ` Jan Beulich
2020-03-18 17:13 ` David Woodhouse
2020-03-19 8:49 ` Jan Beulich
2020-03-19 10:26 ` David Woodhouse
2020-03-19 11:59 ` Jan Beulich
2020-03-19 13:54 ` David Woodhouse
2020-03-19 14:46 ` Jan Beulich
2020-02-07 15:57 ` [Xen-devel] [PATCH 2/2] xen/mm: Introduce PG_state_uninitialised David Woodhouse
2020-02-07 16:30 ` Xia, Hongyan
2020-02-07 16:32 ` David Woodhouse
2020-02-07 16:40 ` Xia, Hongyan
2020-02-07 17:06 ` David Woodhouse
2020-02-07 18:04 ` David Woodhouse
2020-02-20 11:59 ` Jan Beulich
2020-02-20 13:27 ` Julien Grall
2020-03-17 22:15 ` David Woodhouse
2020-03-18 8:53 ` Paul Durrant
2020-03-18 10:10 ` Jan Beulich
2020-03-18 10:41 ` Paul Durrant
2020-03-18 11:12 ` Jan Beulich
2020-03-18 10:03 ` Jan Beulich
2020-03-18 12:11 ` David Woodhouse
2020-03-18 13:27 ` Jan Beulich [this message]
2020-02-05 10:22 ` [Xen-devel] [XEN PATCH v2 1/2] Check zone before merging adjacent blocks in heap Julien Grall
2020-02-05 10:32 ` David Woodhouse
2020-02-05 11:36 ` David Woodhouse
2020-02-04 15:37 ` Stewart Hildebrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3fa1dfe5-28e8-77fd-4898-62d68ffa058c@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=dwmw2@infradead.org \
--cc=george.dunlap@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=hongyxia@amazon.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jeff.kubascik@dornerworks.com \
--cc=julien@xen.org \
--cc=konrad.wilk@oracle.com \
--cc=sstabellini@kernel.org \
--cc=stewart.hildebrand@dornerworks.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).