From: Dario Faggioli <dario.faggioli@citrix.com>
To: "JBeulich@suse.com" <JBeulich@suse.com>
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
George Dunlap <George.Dunlap@citrix.com>,
"uma.sharma523@gmail.com" <uma.sharma523@gmail.com>
Subject: Re: [PATCH v2 2/2] sched_credit2.c: runqueue_per_core code
Date: Tue, 17 Mar 2015 18:18:30 +0000 [thread overview]
Message-ID: <1426616308.32500.98.camel@citrix.com> (raw)
In-Reply-To: <5506E11F020000780006A426@mail.emea.novell.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 2045 bytes --]
On Mon, 2015-03-16 at 12:56 +0000, Jan Beulich wrote:
> >>> On 16.03.15 at 13:51, <george.dunlap@eu.citrix.com> wrote:
> > On 03/16/2015 12:48 PM, Jan Beulich wrote:
> >> Them returning garbage isn't what needs fixing. Instead the code
> >> here should use a different condition to check whether this is the
> >> boot CPU (e.g. looking at system_state). And that can very well be
> >> done directly in this patch.
> >
> > What do you suggest, then?
>
> My preferred solution would be, as said, to leverage system_state.
> Provided the state to look for is consistent between x86 and ARM.
>
Would something like this make sense?
diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index cfca5a7..2f2aa73 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -1936,12 +1936,8 @@ static void init_pcpu(const struct scheduler *ops, int cpu)
}
/* Figure out which runqueue to put it in */
- rqi = 0;
-
- /* Figure out which runqueue to put it in */
- /* NB: cpu 0 doesn't get a STARTING callback, so we hard-code it to runqueue 0. */
- if ( cpu == 0 )
- rqi = 0;
+ if ( system_state == SYS_STATE_boot )
+ rqi = boot_cpu_to_socket(cpu);
else
rqi = cpu_to_socket(cpu);
@@ -1986,9 +1982,13 @@ static void init_pcpu(const struct scheduler *ops, int cpu)
static void *
csched2_alloc_pdata(const struct scheduler *ops, int cpu)
{
- /* Check to see if the cpu is online yet */
- /* Note: cpu 0 doesn't get a STARTING callback */
- if ( cpu == 0 || cpu_to_socket(cpu) >= 0 )
+ /*
+ * Actual initialization is deferred to when the pCPU will be
+ * online, via a STARTING callback. The only exception is
+ * the boot cpu, which does not get such a notification, and
+ * hence needs to be taken care of here.
+ */
+ if ( system_state == SYS_STATE_boot )
init_pcpu(ops, cpu);
else
printk("%s: cpu %d not online yet, deferring initializatgion\n",
[-- Attachment #1.1.2: credit2-system-state.patch --]
[-- Type: text/x-patch, Size: 1358 bytes --]
diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index cfca5a7..2f2aa73 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -1936,12 +1936,8 @@ static void init_pcpu(const struct scheduler *ops, int cpu)
}
/* Figure out which runqueue to put it in */
- rqi = 0;
-
- /* Figure out which runqueue to put it in */
- /* NB: cpu 0 doesn't get a STARTING callback, so we hard-code it to runqueue 0. */
- if ( cpu == 0 )
- rqi = 0;
+ if ( system_state == SYS_STATE_boot )
+ rqi = boot_cpu_to_socket(cpu);
else
rqi = cpu_to_socket(cpu);
@@ -1986,9 +1982,13 @@ static void init_pcpu(const struct scheduler *ops, int cpu)
static void *
csched2_alloc_pdata(const struct scheduler *ops, int cpu)
{
- /* Check to see if the cpu is online yet */
- /* Note: cpu 0 doesn't get a STARTING callback */
- if ( cpu == 0 || cpu_to_socket(cpu) >= 0 )
+ /*
+ * Actual initialization is deferred to when the pCPU will be
+ * online, via a STARTING callback. The only exception is
+ * the boot cpu, which does not get such a notification, and
+ * hence needs to be taken care of here.
+ */
+ if ( system_state == SYS_STATE_boot )
init_pcpu(ops, cpu);
else
printk("%s: cpu %d not online yet, deferring initializatgion\n",
[-- 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:[~2015-03-17 18:18 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-13 18:11 [PATCH v2 2/2] sched_credit2.c: runqueue_per_core code Uma Sharma
2015-03-13 18:29 ` Andrew Cooper
2015-03-13 19:13 ` George Dunlap
2015-03-16 12:48 ` Jan Beulich
2015-03-16 12:51 ` George Dunlap
2015-03-16 12:56 ` Jan Beulich
2015-03-16 13:26 ` Dario Faggioli
2015-03-17 18:18 ` Dario Faggioli [this message]
2015-03-18 7:56 ` Jan Beulich
2015-03-18 8:53 ` Dario Faggioli
2015-03-18 15:26 ` George Dunlap
2015-03-18 15:59 ` Jan Beulich
2015-03-18 16:08 ` George Dunlap
2015-03-18 16:30 ` Dario Faggioli
2015-03-18 16:49 ` Dario Faggioli
2015-03-18 17:05 ` George Dunlap
2015-03-19 10:03 ` Dario Faggioli
2015-03-19 10:50 ` Jan Beulich
2015-03-19 11:23 ` Dario Faggioli
2015-03-19 11:40 ` George Dunlap
2015-03-19 12:29 ` Dario Faggioli
2015-03-19 12:35 ` George Dunlap
2015-03-19 13:00 ` Dario Faggioli
2015-03-16 12:45 ` Jan Beulich
2015-03-16 12:49 ` 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=1426616308.32500.98.camel@citrix.com \
--to=dario.faggioli@citrix.com \
--cc=Andrew.Cooper3@citrix.com \
--cc=George.Dunlap@citrix.com \
--cc=JBeulich@suse.com \
--cc=uma.sharma523@gmail.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