From: Jan Beulich <jbeulich@suse.com>
To: "Xia, Hongyan" <hongyxia@amazon.com>
Cc: "andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
"Grall, Julien" <jgrall@amazon.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"wl@xen.org" <wl@xen.org>,
"roger.pau@citrix.com" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v3 1/2] x86/mm: factor out the code for shattering an l3 PTE
Date: Wed, 11 Dec 2019 17:58:30 +0100 [thread overview]
Message-ID: <c692fd22-ce57-5f84-e596-2c59252be0b4@suse.com> (raw)
In-Reply-To: <9abd6bc8c4d77e8653da6d451ecaa4d122c94b35.camel@amazon.com>
On 11.12.2019 17:27, Xia, Hongyan wrote:
> On Wed, 2019-12-11 at 16:32 +0100, Jan Beulich wrote:
>> On 11.12.2019 11:58, Hongyan Xia wrote:
>>> @@ -5578,27 +5597,8 @@ int modify_xen_mappings(unsigned long s,
>>> unsigned long e, unsigned int nf)
>>> }
>>>
>>> /* PAGE1GB: shatter the superpage and fall through. */
>>> - pl2e = alloc_xen_pagetable();
>>> - if ( !pl2e )
>>> + if ( shatter_l3e(pl3e, 0, locking) )
>>> return -ENOMEM;
>>
>> Hmm, I didn't expect I'd need to comment on this again: As per
>> my v2 reply, you should hand on the return value from the
>> function, not make up your own. This is so that in case the
>> function gains another error path with a different error code,
>> it wouldn't become indistinguishable to callers further up.
>
> I was basically thinking about the conversation we had that ENOMEM is
> probably the only error value map_pages_to_xen would return ever, and
> it is unlikely to gain another return value in the future, so initially
> I just let shatter return -1 and the caller return -ENOMEM. There is no
> problem for me if we want to change it to handle different error
> values.
The alternative to your prior 0 / -1 returning would have been to
have the function return bool. In this case "inventing" an error
code here would be fine. The 0 / -1 approach would introduce
another instance of what we're trying to get rid of elsewhere.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-12-11 16:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 10:58 [Xen-devel] [PATCH v3 0/2] Refactor super page shattering Hongyan Xia
2019-12-11 10:58 ` [Xen-devel] [PATCH v3 1/2] x86/mm: factor out the code for shattering an l3 PTE Hongyan Xia
2019-12-11 15:29 ` Jan Beulich
2019-12-11 16:34 ` Xia, Hongyan
2019-12-11 17:00 ` Jan Beulich
2019-12-11 15:32 ` Jan Beulich
2019-12-11 16:27 ` Xia, Hongyan
2019-12-11 16:58 ` Jan Beulich [this message]
2019-12-11 10:58 ` [Xen-devel] [PATCH v3 2/2] x86/mm: factor out the code for shattering an l2 PTE Hongyan Xia
2019-12-11 15:33 ` Jan Beulich
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=c692fd22-ce57-5f84-e596-2c59252be0b4@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=hongyxia@amazon.com \
--cc=jgrall@amazon.com \
--cc=roger.pau@citrix.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 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.