All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Wei Yang <richard.weiyang@huawei.com>
Cc: xuquan8@huawei.com, liuxiaojian6@huawei.com,
	george.dunlap@eu.citrix.com, xen-devel@lists.xen.org,
	mengxu@cis.upenn.edu, Wei Yang <richard.weiyang@gmail.com>
Subject: Re: [Help] Trigger Watchdog when adding an IPI in vcpu_wake
Date: Mon, 26 Sep 2016 12:18:06 +0200	[thread overview]
Message-ID: <1474885086.23934.47.camel@citrix.com> (raw)
In-Reply-To: <20160924033925.GA31810@linux-gk3p>


[-- Attachment #1.1: Type: text/plain, Size: 2327 bytes --]

On Sat, 2016-09-24 at 11:39 +0800, Wei Yang wrote:
> On Thu, Sep 22, 2016 at 11:12:15AM +0200, Dario Faggioli wrote:
> > _Almost_ correct. However, the problem is more that vcpu_wake() can
> > happen in response to an IRQ, and when you grab a spinlock in IRQ
> > context, you need to disable IRQs.
> > 
> 
> Ok, now I have a question to this sentence.
> 
> I have checked some posts which says in the interrupt handling, irq
> would be
> disabled. Well, this really depends on the implementation.
> 
> This means in Xen, irq is still enabled during interrupt handling?
> Because of
> this, we have to disable IRQ when we need to grab the spin lock?
> 
So, I don't think I'm getting all you're saying and asking.

The situation is like this: currently, vcpu_wake() can be called both
from inside or outside IRQ context, and both with IRQs enabled or
disabled.

Given this situation, to be safe, we need to disable IRQs when taking
whatever spinlock vcpu_wake() (and the functions it calls, of course)
calls. Since it takes the scheduler's runq lock, this means we need to
take the lock with IRQ disabled.

And because of that, _everyone_ that takes the schedulr's lock must do
that with IRQs disabled. If we manage to *not* take the scheduler's
lock with IRQ disabled in vcpu_wake(), we then can do the same
everywhere else. But we can't do that with the current structure of the
code, and that's why we're thinking to defer the actual wakeup --i.e.,
the actual call to vcpu_wake()-- to a moment when:
 - IRQs are enabled,
 - we don't need to disable them.

This is it. About the following...

> Looks I almost get every thing. Let me do a summary to see whether I
> have got
> your words.
> 
>    (spinlock usage convention in Xen)  &  (vcpu_wake() may happen in
> an IRQ)
> 
This is ok.

> =>
> 
>    (irq all disabled || irq all enabled) & (disable irq on grabbing
> spinlock)
> 
This, I don't get it.

> =>
> 
>    should grab schedule lock with IRQ disabled
> 
Yes, sounds right.

Dario
-- 
<<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: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

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

  reply	other threads:[~2016-09-26 10:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20160913085437.GA14514@linux-gk3p>
2016-09-13 11:30 ` [Help] Trigger Watchdog when adding an IPI in vcpu_wake Dario Faggioli
2016-09-14 10:44   ` Wei Yang
2016-09-14 16:18     ` Dario Faggioli
2016-09-16  2:49       ` Wei Yang
2016-09-16 16:07         ` Dario Faggioli
2016-09-17  0:31           ` Wei Yang
2016-09-19 23:24             ` Dario Faggioli
2016-09-20  3:51               ` Wei Yang
2016-09-17  3:30     ` Wei Yang
2016-09-22  9:12       ` Dario Faggioli
2016-09-22  9:55         ` Dario Faggioli
2016-09-24  7:26           ` Wei Yang
2016-09-24  3:39         ` Wei Yang
2016-09-26 10:18           ` Dario Faggioli [this message]
2016-09-28  3:44             ` Wei Yang
2016-09-18  4:03   ` Wei Yang
2016-09-22  9:47     ` Dario Faggioli

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=1474885086.23934.47.camel@citrix.com \
    --to=dario.faggioli@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=liuxiaojian6@huawei.com \
    --cc=mengxu@cis.upenn.edu \
    --cc=richard.weiyang@gmail.com \
    --cc=richard.weiyang@huawei.com \
    --cc=xen-devel@lists.xen.org \
    --cc=xuquan8@huawei.com \
    /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.