From: Dario Faggioli <dario.faggioli@citrix.com>
To: Ian Campbell <ian.campbell@citrix.com>,
Joshua Otto <jtotto@uwaterloo.ca>,
xen-devel@lists.xen.org
Cc: wei.liu2@citrix.com, stefano.stabellini@eu.citrix.com,
george.dunlap@eu.citrix.com, ian.jackson@eu.citrix.com,
czylin@uwaterloo.ca, hjarmstr@uwaterloo.ca
Subject: Re: [PATCH 2/5] libxl: make GC_FREE reachable in libxl_get_scheduler()
Date: Tue, 5 Jan 2016 09:49:29 +0100 [thread overview]
Message-ID: <1451983769.27063.43.camel@citrix.com> (raw)
In-Reply-To: <1451924973.13361.183.camel@citrix.com>
[-- Attachment #1.1: Type: text/plain, Size: 2370 bytes --]
On Mon, 2016-01-04 at 16:29 +0000, Ian Campbell wrote:
> On Mon, 2015-12-28 at 00:16 -0500, Joshua Otto wrote:
> > Coverity CID 1343309
> >
> > This patch preserves the multiple error paths in order to avoid
> > meaninglessly assigning the ERROR_FAIL libxl error code to the
> > return variable, which is of type libxl_scheduler.
>
> Which makes me think that the existing code is bogus to return an
> error
> code as a libxl_scheduler too, since that is not very different to
> the
> bogus assignment.
>
Indeed.
> Given that a caller really ought to be handling
> LIBXL_SCHEDULER_UNKNOWN as
> a return value, even if it is also written to expect negative error
> values
> as well, so I reckon we can get away with changing the return to
> SCHEDULER_UNKNOWN in the error case. Either the caller already
> handles
> that, or it was already buggy in not doing so.
>
Again, FWIW, I think this indeed is the proper way forward.
About callers, xl is, of course, quite easy to change.
I just quickly checked libvirt, and I think things will just continue
to work there too. In fact, libxl_get_scheduler() is used 3 times in
there, of which:
- 2 of them, explicitly check for the result to
be LIBXL_SCHEDULER_CREDIT, and errors if it is not (as Credit1 is
the only supported scheduler in libvirt for now)
- 1 explicitly check for the result to be either _SEDF, _CREDIT,
_CREDIT2 or _ARINC653, and errors out if it's something else[1]
For other users, I agree that they should be handling or start to
handle LIBXL_SCHEDULER_UNKNOWN. *Maybe*, just as a "mitigation"
measure", we can redefine the enum and make "unknown"=-1... or is
something like that to be considered an API change as well?
I know, it looks really an hack, and it would remain wrong, for a
caller, to check for a libxl_scheduler object to be equal to
ERROR_FAIL, but maybe it's worth at least being considered.
Thanks and Regards,
Dario
[1] note to self, send a patch to update that (e.g., adding RTDS and
removing SEDF, when adequate, depending on Xen version)
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-01-05 8:49 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 20:26 Taking on a Xen development project jtotto
2015-12-10 10:59 ` Wei Liu
2015-12-10 17:23 ` Andrew Cooper
2015-12-12 2:19 ` Yang Hongyang
2015-12-12 22:30 ` Joshua Otto
2015-12-12 23:02 ` Andrew Cooper
2015-12-14 22:49 ` Joshua Otto
2015-12-11 13:52 ` Ian Campbell
2015-12-12 22:07 ` Joshua Otto
2015-12-14 11:08 ` Ian Campbell
2015-12-14 22:59 ` Joshua Otto
2015-12-15 15:48 ` Ian Campbell
2015-12-28 5:16 ` Coverity tidying Joshua Otto
2015-12-28 5:16 ` [PATCH 1/5] libxl: tidy libxl_get_scheduler() according to CODING_STYLE Joshua Otto
2016-01-04 16:23 ` Ian Campbell
2016-01-05 8:20 ` Dario Faggioli
2016-01-19 5:57 ` [PATCH v2 " Chester Lin
2016-01-19 9:14 ` Dario Faggioli
2016-01-19 11:28 ` Wei Liu
2016-01-19 11:35 ` Ian Campbell
2015-12-28 5:16 ` [PATCH 2/5] libxl: make GC_FREE reachable in libxl_get_scheduler() Joshua Otto
2016-01-04 16:29 ` Ian Campbell
2016-01-05 8:49 ` Dario Faggioli [this message]
2016-01-05 11:16 ` Ian Campbell
2016-01-19 5:57 ` [PATCH v2 " Chester Lin
2016-01-19 9:08 ` Dario Faggioli
2016-01-19 14:15 ` Ian Jackson
2015-12-28 5:16 ` [PATCH 3/5] ns16550: widen an integer constant for Coverity Joshua Otto
2016-01-04 16:36 ` Ian Campbell
2016-01-06 9:26 ` Jan Beulich
2016-01-19 5:57 ` [PATCH v2 3/5] n16550: add sanity check for reg_shift Chester Lin
2016-01-19 13:32 ` Jan Beulich
2016-01-25 0:41 ` czylin
2015-12-28 5:16 ` [PATCH 4/5] credit: remove pointless local variable initialization Joshua Otto
2015-12-28 5:16 ` [PATCH 5/5] libxl: Add explicit cast to libxl_psr_cat_set_cbm Joshua Otto
2016-01-04 16:40 ` Ian Campbell
2016-01-19 5:58 ` [PATCH v2 " Chester Lin
2016-01-19 8:34 ` Dario Faggioli
2016-01-19 14:06 ` Ian Jackson
2016-01-19 14:21 ` Ian Campbell
2016-01-19 14:28 ` Dario Faggioli
2016-01-19 14:33 ` Ian Jackson
2016-01-19 14:31 ` George Dunlap
2016-01-19 14:31 ` Ian Campbell
2016-01-19 14:35 ` Ian Jackson
2017-01-12 18:08 ` George Dunlap
2017-01-13 9:05 ` Dario Faggioli
2015-12-28 9:34 ` Coverity tidying Andrew Cooper
2016-01-01 3:14 ` [PATCH] svm: rephrase local variable use for Coverity Joshua Otto
2016-01-06 13:24 ` Jan Beulich
2016-01-06 14:33 ` Boris Ostrovsky
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=1451983769.27063.43.camel@citrix.com \
--to=dario.faggioli@citrix.com \
--cc=czylin@uwaterloo.ca \
--cc=george.dunlap@eu.citrix.com \
--cc=hjarmstr@uwaterloo.ca \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jtotto@uwaterloo.ca \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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).