All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	xen-devel@lists.xenproject.org, Juergen Gross <JGross@suse.com>
Subject: Re: [PATCH] xen: credit1: fix tickling when it happens from a remote pCPU
Date: Thu, 24 Sep 2015 11:52:08 +0200	[thread overview]
Message-ID: <1443088328.3276.28.camel@citrix.com> (raw)
In-Reply-To: <5603DE7C02000078000A52C7@prv-mh.provo.novell.com>


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

On Thu, 2015-09-24 at 03:29 -0600, Jan Beulich wrote:
> > > > On 24.09.15 at 06:31, <dario.faggioli@citrix.com> wrote:
> > --- a/xen/common/sched_credit.c
> > +++ b/xen/common/sched_credit.c

> >  #define csched_balance_mask (CSCHED_PCPU(smp_processor_id())
> > ->balance_mask)
> >  
> > +#define csched_balance_mask_cpu(c) (CSCHED_PCPU(c)->balance_mask)
> 
> csched_runq_steal() gets called with peer_cpu's runqueue lock held
> afaics, but uses smp_processor_id()'s balance_mask. I.e. it looks to
> me that what Jürgen suggested as an option is actually a requirement.
> 
And I'm very much agreeable on taking his suggestion, because I
actually like it.

Correctness should not be an issue, though. In fact, here is the story
about csched_runq_steal():

 schedule()
   cpu = smp_processor_id()
   lock = pcpu_schedule_lock_irq(cpu);
   sched = this_cpu(scheduler);
   next_slice = sched->do_schedule(sched, ...); 
    |
    --> csched_schedule()
          cpu = smp_processor_id();
          snext = csched_load_balance(..., cpu, ...);
            peer_cpu = xxx;
            lock = pcpu_schedule_trylock(peer_cpu);
            speer = csched_runq_steal(peer_cpu, cpu, ...);
              csched_balance_cpumask(..., csched_balance_mask);
            pcpu_schedule_unlock(lock, peer_cpu);
   pcpu_schedule_unlock_irq(lock, cpu);

So, we can safely use smp_processor_id()'s scratch space, as we own its
runqueue lock too.

In any case, thanks a lot for having a look.
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-09-24  9:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-24  4:31 [PATCH] xen: credit1: fix tickling when it happens from a remote pCPU Dario Faggioli
2015-09-24  6:44 ` Juergen Gross
2015-09-24  9:54   ` Dario Faggioli
2015-09-24  9:29 ` Jan Beulich
2015-09-24  9:52   ` Dario Faggioli [this message]

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=1443088328.3276.28.camel@citrix.com \
    --to=dario.faggioli@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=JGross@suse.com \
    --cc=george.dunlap@eu.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.