All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: "Wu, Feng" <feng.wu@intel.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>, Keir Fraser <keir@xen.org>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	Jan Beulich <jbeulich@suse.com>
Subject: Re: [v4 16/17] vmx: Add some scheduler hooks for VT-d posted interrupts
Date: Mon, 3 Aug 2015 12:02:02 +0200	[thread overview]
Message-ID: <1438596122.16912.145.camel@citrix.com> (raw)
In-Reply-To: <E959C4978C3B6342920538CF579893F002669E97@SHSMSX104.ccr.corp.intel.com>


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

On Mon, 2015-08-03 at 01:36 +0000, Wu, Feng wrote:
> > -----Original Message-----
> > From: Dario Faggioli [mailto:dario.faggioli@citrix.com]

> > It's safe in any case. In fact, the spinlock will  prevent both the
> > vcpu's processor to schedule, as well as any other processors to steal
> > the waking vcpu from the runqueue to run it.
> 
> Good to know this. For " as well as any other processors to steal
> the waking vcpu from the runqueue to run it ", could you please show
> some hints in the code side, so I can better understand how this can
> be protected by the spinlock. Thank you!
> 
Sure. For instance, for the Credit1 scheduler, look at
csched_load_balance(). vcpus are moved from one runqueue to another by
means of csched_runq_steal() which, as you can see, is called only if
the spinlock for the pcpu from where we want to try stealing has been
successfully acquired:

    spinlock_t *lock = pcpu_schedule_trylock(peer_cpu);

    if ( !lock )
    {
        SCHED_STAT_CRANK(steal_trylock_failed);
        peer_cpu = cpumask_cycle(peer_cpu, &workers);
        continue;
    }

    /* Any work over there to steal? */
    speer = cpumask_test_cpu(peer_cpu, online) ?
         csched_runq_steal(peer_cpu, cpu, snext->pri, bstep) : NULL;
    pcpu_schedule_unlock(lock, peer_cpu);

Same happen in Credit2. Check choose_cpu(), and you'll fine similar
reasoning and code.

In RTDS, finally, there's just one runqueue, for all pcpus, so each time
each one of them has to schedule it has to take the only one spinlock
protecting it.

Hope this helped.

Regards,
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: 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

  reply	other threads:[~2015-08-03 10:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03  1:36 [v4 16/17] vmx: Add some scheduler hooks for VT-d posted interrupts Wu, Feng
2015-08-03 10:02 ` Dario Faggioli [this message]
2015-08-05  6:06   ` Wu, Feng
  -- strict thread matches above, loose matches on Subject: below --
2015-07-23 11:35 [v4 00/17] Add VT-d Posted-Interrupts support Feng Wu
2015-07-23 11:35 ` [v4 16/17] vmx: Add some scheduler hooks for VT-d posted interrupts Feng Wu
2015-07-23 12:50   ` Dario Faggioli
2015-07-24  0:49     ` Wu, Feng
2015-07-28 14:15   ` Dario Faggioli
2015-07-30  2:04     ` Wu, Feng
2015-07-30 18:26       ` Dario Faggioli
2015-08-11 10:23         ` 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=1438596122.16912.145.camel@citrix.com \
    --to=dario.faggioli@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=feng.wu@intel.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.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 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.