From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: andrew.cooper3@citrix.com, malcolm.crossley@citrix.com,
xen-devel@lists.xenproject.org, linux@eikelenboom.it
Subject: Re: [RFC PATCH] dpci: Put the dpci back on the list if running on another CPU.
Date: Fri, 23 Jan 2015 09:54:20 -0500 [thread overview]
Message-ID: <20150123145420.GI7365@l.oracle.com> (raw)
In-Reply-To: <54C2248102000078000589D6@mail.emea.novell.com>
On Fri, Jan 23, 2015 at 09:37:53AM +0000, Jan Beulich wrote:
> >>> On 23.01.15 at 02:44, <konrad.wilk@oracle.com> wrote:
> > Here is a patch that does this. I don't yet have an setup to test
> > the failing scenario (working on that). I removed the part in
> > the softirq because with this patch I cannot see a way it would
> > ever get there (in the softirq hitting the BUG).
>
> Hmm, but how do you now schedule the second instance that needed ...
>
> > --- a/xen/drivers/passthrough/io.c
> > +++ b/xen/drivers/passthrough/io.c
> > @@ -64,16 +64,24 @@ static void raise_softirq_for(struct hvm_pirq_dpci
> > *pirq_dpci)
> > {
> > unsigned long flags;
> >
> > - if ( test_and_set_bit(STATE_SCHED, &pirq_dpci->state) )
> > + switch ( cmpxchg(&pirq_dpci->state, 0, 1 << STATE_SCHED) )
> > + {
> > + case (1 << STATE_SCHED):
> > + case (1 << STATE_RUN):
>
> ... in this case?
We do need that. I was under the false understanding that the old
code would just drop it if it was running. However the old code
(tasklet only) followed the logic that:
a) If it is scheduled (on the list), then don't put it there.
b) If it is running (t->running), then don't put it there. However
once the function is done (in the do_tasklet_work) we detect
that we tried to schedule it (t->scheduled_on is set to non-zero value)
- and we put it back on the list.
I need to think about this some more.
>
> >> Additionally I think it should be considered whether the bitmap
> >> approach of interpreting ->state is the right one, and we don't
> >> instead want a clean 3-state (idle, sched, run) model.
> >
> > Could you elaborate a bit more please? As in three different unsigned int
> > (or bool_t) that set in what state we are in?
>
> An enum { STATE_IDLE, STATE_SCHED, STATE_RUN }. Especially
> if my comment above turns out to be wrong, you'd have no real
> need for the SCHED and RUN flags to be set at the same time.
Seems we do need these four states: scheduled; running; schedulding while running; and idle.
>
> Jan
>
next prev parent reply other threads:[~2015-01-23 14:54 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-12 16:45 [RFC PATCH] dpci: Put the dpci back on the list if running on another CPU Konrad Rzeszutek Wilk
2015-01-12 17:27 ` Sander Eikelenboom
2015-01-12 17:35 ` Konrad Rzeszutek Wilk
2015-01-13 10:26 ` Jan Beulich
2015-01-13 10:20 ` Jan Beulich
2015-01-23 1:44 ` Konrad Rzeszutek Wilk
2015-01-23 9:37 ` Jan Beulich
2015-01-23 14:54 ` Konrad Rzeszutek Wilk [this message]
2015-03-17 17:44 ` Konrad Rzeszutek Wilk
2015-03-17 22:16 ` Sander Eikelenboom
2015-03-18 7:41 ` Jan Beulich
2015-03-18 14:06 ` Konrad Rzeszutek Wilk
2015-03-18 16:43 ` Jan Beulich
2015-03-18 17:00 ` Konrad Rzeszutek Wilk
2015-03-19 7:15 ` Jan Beulich
2015-02-02 14:29 ` Konrad Rzeszutek Wilk
2015-02-02 15:19 ` Jan Beulich
2015-02-02 15:31 ` Konrad Rzeszutek Wilk
2015-02-02 15:48 ` Jan Beulich
2015-02-02 17:44 ` Konrad Rzeszutek Wilk
2015-02-03 8:58 ` Jan Beulich
2015-03-16 17:59 ` Konrad Rzeszutek Wilk
2015-03-17 8:18 ` Jan Beulich
2015-03-17 8:42 ` Sander Eikelenboom
2015-03-17 14:54 ` Konrad Rzeszutek Wilk
2015-03-17 16:01 ` Jan Beulich
2015-03-17 16:09 ` Konrad Rzeszutek Wilk
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=20150123145420.GI7365@l.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=linux@eikelenboom.it \
--cc=malcolm.crossley@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.