xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Dario Faggioli <dario.faggioli@citrix.com>,
	Stefano Stabellini <sstabellini@kernel.org>
Cc: edgar.iglesias@xilinx.com, george.dunlap@eu.citrix.com,
	nd@arm.com, Punit Agrawal <punit.agrawal@arm.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH] xen/arm: introduce vwfi parameter
Date: Tue, 21 Feb 2017 13:04:46 +0000	[thread overview]
Message-ID: <cfda4df3-8e01-6e4a-9bf9-d24101a0d71a@arm.com> (raw)
In-Reply-To: <1487669092.6732.324.camel@citrix.com>

Hi Dario,

On 21/02/17 09:24, Dario Faggioli wrote:
> On Tue, 2017-02-21 at 08:10 +0000, Julien Grall wrote:
>> On 21/02/2017 00:38, Stefano Stabellini wrote:
>>> On Mon, 20 Feb 2017, Dario Faggioli wrote:
>>>> Mmm... ok, yes, in that case, it may make sense and work, from a,
>>>> let's
>>>> say, purely functional perspective. But still I struggle to place
>>>> this
>>>> in a bigger picture.
>>>
>>> I feel the same way as you, Dario. That said, if we could make it
>>> work
>>> without breaking too many assumptions in Xen, it would be a great
>>> improvement for this use-case.
>>
>> Again, there is no assumption broken. Using WFI/WFE is just a nice
>> way
>> to say: "You can sleep and save power" so a scheduler can decide to
>> schedule another vCPU. Obviously a guest is free to not use them and
>> could do a busy loop instead.
>>
> Again, other way round. It is a scheduler that, when a CPU would go
> idle, decides whether to sleep or busy loop.
>
> It's the Linux scheduler that, in Linux, on x86, decides whether to HLT
> (or use MWAIT and that stuff) during the idle loop (which is what
> happens by default) or not, and hence busy loop (which is what happens
> if you pass 'idle=poll'). And, as far as Linux (and every OS running on
> baremetal), that's it.
>
> In Xen, it's the exact same thing. When the scheduler decides to run
> the idle loop on a pCPU, it's Xen itself (it's, strictly speaking, not
> really the scheduler, because the code is in arch/foo/domain.c, but,
> whatever) that decides whether to sleep --with MWAIT, WFI, etc-- or to
> stay awake. Stay awake would basically mean calling something like
> cpu_relax() idle_loop() (basically, doing, on x86,
> pm_idle=cpu_relax()). We currently don't have a way to tell Xen we want
> that, but it may be added. That would be the _exact_ equivalent of
> Linux's 'idle=poll'. And that is _not_ what this patch does.
>
> In fact, still in Xen, we also have to decide what to do when one of
> our guests' vCPUs goes idle. This is where, I feel, at least part of
> the misunderstanding going on in this thread is actually happening...

Likely :). I would be happy to have idle_loop to be a busy loop. But I 
don't think this will solve Stefano's problem (see my answer [1]) 
because the underlying problem is using the idle vCPU on ARM is really 
expensive.

>
>>> Right, I asked myself those questions as well. That is why I wrote
>>> "it
>>> breaks the scheduler" in the previous email. I don't think it can
>>> work
>>> today, but it could work one day, building on top of the nop
>>> scheduler.
>>
>> WFE/WFI is only a hint for the scheduler to reschedule. If you don't
>> trap them, the guest will still run until the end of its credit. It
>> doesn't break anything.
>>
> And in fact, I totally fail to understand what you mean here. By "don't
> trap them" do you mean just ignore them? Or do you mean execute them on
> hardware?

I mean executing on the hardware. My whole point was about WFI/WFE 
executed by the guest and not Xen.

Cheers,

[1] <14575011-0042-8940-c19f-2482136ff91c@foss.arm.com>

-- 
Julien Grall

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

  reply	other threads:[~2017-02-21 13:04 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1487286292-29502-1-git-send-email-sstabellini@kernel.org>
     [not found] ` <a271394a-6c76-027c-fb08-b3fe775224ba@arm.com>
2017-02-17 22:50   ` [PATCH] xen/arm: introduce vwfi parameter Stefano Stabellini
2017-02-18  1:47     ` Dario Faggioli
2017-02-19 21:27       ` Julien Grall
2017-02-20 10:43         ` George Dunlap
2017-02-20 11:15         ` Dario Faggioli
2017-02-19 21:34     ` Julien Grall
2017-02-20 11:35       ` Dario Faggioli
2017-02-20 18:43         ` Stefano Stabellini
2017-02-20 18:45           ` George Dunlap
2017-02-20 18:49             ` Stefano Stabellini
2017-02-20 18:47       ` Stefano Stabellini
2017-02-20 18:53         ` Julien Grall
2017-02-20 19:20           ` Dario Faggioli
2017-02-20 19:38             ` Julien Grall
2017-02-20 22:53               ` Dario Faggioli
2017-02-21  0:38                 ` Stefano Stabellini
2017-02-21  8:10                   ` Julien Grall
2017-02-21  9:24                     ` Dario Faggioli
2017-02-21 13:04                       ` Julien Grall [this message]
2017-02-21  7:59                 ` Julien Grall
2017-02-21  9:09                   ` Dario Faggioli
2017-02-21 12:30                     ` Julien Grall
2017-02-21 13:46                       ` George Dunlap
2017-02-21 15:07                         ` Dario Faggioli
2017-02-21 17:49                           ` Stefano Stabellini
2017-02-21 17:56                             ` Julien Grall
2017-02-21 18:30                               ` Stefano Stabellini
2017-02-21 19:20                                 ` Julien Grall
2017-02-22  4:21                                   ` Edgar E. Iglesias
2017-02-22 17:22                                     ` Stefano Stabellini
2017-02-23  9:19                                       ` Edgar E. Iglesias
2017-02-21 18:17                             ` George Dunlap
2017-02-22 16:40                               ` Dario Faggioli
2017-02-21 15:14                         ` Julien Grall
2017-02-21 16:59                           ` George Dunlap
2017-02-21 18:03                           ` Stefano Stabellini
2017-02-21 18:24                             ` Julien Grall
2017-02-21 16:51                       ` Dario Faggioli
2017-02-21 17:39                         ` Stefano Stabellini

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=cfda4df3-8e01-6e4a-9bf9-d24101a0d71a@arm.com \
    --to=julien.grall@arm.com \
    --cc=dario.faggioli@citrix.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=nd@arm.com \
    --cc=punit.agrawal@arm.com \
    --cc=sstabellini@kernel.org \
    --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 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).