All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Tim Deegan <tim@xen.org>, Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v2] mm: disallow MEMF_no_refcount to be passed for domain-owned allocations
Date: Fri, 23 Nov 2018 10:50:19 +0000	[thread overview]
Message-ID: <b245229e-ae0d-1b57-d23a-49b1915ccd85@citrix.com> (raw)
In-Reply-To: <5BF7DB2102000078001FF53F@prv1-mh.provo.novell.com>

On 23/11/2018 10:49, Jan Beulich wrote:
>>>> On 23.11.18 at 11:28, <andrew.cooper3@citrix.com> wrote:
>> On 23/11/2018 09:45, Jan Beulich wrote:
>>> When such pages get assigned to domains (and hence their ->tot_pages
>>> not incremented accordingly) we would otherwise also need to suppress
>>> decrementing the count when freeing those pages.
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>> ---
>>> v2: Add ASSERT_UNREACHABLE().
>>>
>>> --- a/xen/common/page_alloc.c
>>> +++ b/xen/common/page_alloc.c
>>> @@ -2303,6 +2303,11 @@ struct page_info *alloc_domheap_pages(
>>>  
>>>      if ( memflags & MEMF_no_owner )
>>>          memflags |= MEMF_no_refcount;
>>> +    else if ( (memflags & MEMF_no_refcount) && d )
>>> +    {
>>> +        ASSERT_UNREACHABLE();
>> Sorry to do this, but on second thoughts, this path isn't actually
>> unreachable.
>>
>> Could I talk you into using ASSERT(!"Assigned domheap pages must be
>> refcounted") instead, to give a slightly more clear error to developers
>> who manage to hit it?
> I think there are other places where we use ASSERT_UNREACHABLE()
> when the path is reachable in the sense that one could construct a
> suitable path, but with how things are (supposed to be) it cannot be
> reached. I'm unconvinced the added string literal would be of overly
> much help - once you see the line number, it is pretty easy to figure
> out whats wrong.
>
> But if you insist, I'll switch to the alternative way of expressing it
> (although I'd then perhaps use
> ASSERT(!(memflags & MEMF_no_refcount)) instead). Just let me
> know.

That's fine as well.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-11-23 10:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 16:12 [PATCH 0/4] XSA-276 follow-up Jan Beulich
2018-11-20 16:17 ` [PATCH 1/4] mm: disallow MEMF_no_refcount to be passed for domain-owned allocations Jan Beulich
2018-11-20 16:35   ` Andrew Cooper
2018-11-23  9:45   ` [PATCH v2] " Jan Beulich
2018-11-23 10:28     ` Andrew Cooper
2018-11-23 10:49       ` Jan Beulich
2018-11-23 10:50         ` Andrew Cooper [this message]
2018-11-20 16:18 ` [PATCH 2/4] x86: correct instances of PGC_allocated clearing Jan Beulich
2018-11-20 16:59   ` Andrew Cooper
2018-11-20 17:12     ` Jan Beulich
2018-11-21  2:47       ` Tamas K Lengyel
2018-11-20 16:19 ` [PATCH 3/4] x86: reduce code duplication in guest_remove_page() Jan Beulich
2018-11-20 17:06   ` Andrew Cooper
2018-11-21  9:28     ` Jan Beulich
2018-11-20 16:19 ` [PATCH 4/4] make domain_adjust_tot_pages() __must_check Jan Beulich
2018-12-05 16:14 ` [PATCH v2 0/2] remaining XSA-276 follow-up Jan Beulich
2018-12-05 16:17   ` [PATCH v2 1/2] x86: reduce code duplication in guest_remove_page() Jan Beulich
2018-12-05 20:03     ` Andrew Cooper
2018-12-05 16:17   ` [PATCH v2 2/2] make domain_adjust_tot_pages() __must_check Jan Beulich
2018-12-05 20:08     ` Andrew Cooper

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=b245229e-ae0d-1b57-d23a-49b1915ccd85@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.