From: Ian Campbell <Ian.Campbell@citrix.com>
To: Kai Huang <mail.kai.huang@gmail.com>
Cc: "Xen-devel@lists.xensource.com" <Xen-devel@lists.xensource.com>
Subject: Re: [question] bug in cpu_schedule_up?
Date: Wed, 18 Jan 2012 08:38:55 +0000 [thread overview]
Message-ID: <1326875935.29475.23.camel@dagon.hellion.org.uk> (raw)
In-Reply-To: <CANqQZNHUMrf-sNpfH3zsnPwYr3uGpeFSjycUufYHxR3kZ006+A@mail.gmail.com>
On Wed, 2012-01-18 at 08:13 +0000, Kai Huang wrote:
> Hi,
>
> I see below code in cpu_schedule_up in xen-unstable hg repository
> (xen/common/schedule.c).
>
> if ( idle_vcpu[cpu] == NULL )
> alloc_vcpu(idle_vcpu[0]->domain, cpu, cpu);
> if ( idle_vcpu[cpu] == NULL )
> return -ENOMEM;
>
> Seems it's a bug? Should be like this?
>
> if ( idle_vcpu[cpu] == NULL )
> idle_vcpu[cpu] = alloc_vcpu(idle_vcpu[0]->domain, cpu, cpu);
> if ( idle_vcpu[cpu] == NULL )
> return -ENOMEM;
alloc_vcpu will set idle_vcpu[0]->domain->vcpu[cpu] to the newly
allocated vcpu. idle_vcpu[0]->domain == idle_domain and
idle_vcpu[0]->domain->vcpu == idle_vcpu (both are by construction in
scheduler_init). Therefore idle_vcpu[cpu] is already being set inside
alloc_vcpu.
The return value of alloc_vcpu is to save code which wants a local
handle on the newly allocated vcpu to perform further setup from doing
the lookup itself.
Ian.
next prev parent reply other threads:[~2012-01-18 8:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-18 8:13 [question] bug in cpu_schedule_up? Kai Huang
2012-01-18 8:38 ` Ian Campbell [this message]
[not found] ` <CANqQZNFL9=8wFBc2Cutrd2nwpk0Wk1EupqGQE6RU9a8aWzf0PA@mail.gmail.com>
2012-01-18 12:10 ` Ian Campbell
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=1326875935.29475.23.camel@dagon.hellion.org.uk \
--to=ian.campbell@citrix.com \
--cc=Xen-devel@lists.xensource.com \
--cc=mail.kai.huang@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).