All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Mirela Simonovic <mirela.simonovic@aggios.com>
Cc: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Davorin Mista <dm@aggios.com>,
	julien.grall@arm.org, Xen Devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 3/7] xen/arm/psci: Implement CPU_OFF PSCI call (physical interface)
Date: Mon, 16 Apr 2018 15:26:00 +0100	[thread overview]
Message-ID: <c71989bb-51e8-551e-d710-3f5c4a33158a@arm.com> (raw)
In-Reply-To: <CAKPH-Nhddgu7oJ32BBxmtO+Zmwp9S+t1L7TXBaww-Z2JY-5nDQ@mail.gmail.com>

Hi Mirela,

On 16/04/18 11:02, Mirela Simonovic wrote:
> On Thu, Apr 12, 2018 at 3:31 PM, Julien Grall <julien.grall@arm.com> wrote:
>>
>>
>> On 12/04/18 12:33, Mirela Simonovic wrote:
>>>
>>> On Wed, Apr 11, 2018 at 4:46 PM, Julien Grall <julien.grall@arm.com>
>>> wrote:
>>>>
>>>> On 11/04/18 14:19, Mirela Simonovic wrote:
>>>>
>>>>>         local_irq_disable();
>>>>>         cpu_is_dead = true;
>>>>>         /* Make sure the write happens before we sleep forever */
>>>>>         dsb(sy);
>>>>>         isb();
>>>>> +    /* PSCI cpu off call will return only in case of an error */
>>>>> +    errno = call_psci_cpu_off();
>>>>> +    printk(XENLOG_DEBUG "PSCI cpu off call failed for CPU#%d err=%d\n",
>>>>> +           get_processor_id(), errno);
>>>>> +    isb();
>>>>
>>>>
>>>>
>>>> What are you trying to achieve with the isb() here?
>>>>
>>>
>>> I use to have a problem that the wfi below gets executed before the
>>> call_psci_cpu_off(). Adding isb() fixed the issue. However, I tried
>>> now to reproduce the problem and it doesn't show up. I still believe
>>> isb() should be here, please let me know if you disagree (I obviously
>>> can't prove the claim now).
>>
>>
>> The problem you describe can't be possible with the code you have because
>> call_psci_cpu_off() is issuing a SMC. SMC will lead to change exception
>> level and therefore have a context-synchronization barrier.
>>
>> This is obviously based on the assumption you don't have an errata on your
>> CPU exposing the behavior you describe. For that you would need to check
>> errata notice for your CPU and/or try to reproduce.
>>
>> However, what you would need is a dsb(sy); isb(); to drain the write buffer
>> if you print a message.
>>
>> Furthermore, now on platform without CPU off support (e.g non-PSCI platform
>> and PSCI 0.1) you will log an error message that may worry people. In
>> reality, PSCI cpu_off will unlikely fail, so you probably want to add a
>> panic in call_psci_cpu_off instead.
>>
> 
> Even if PSCI cpu_off call fails, what is unlikely to happen, the
> system is still functional.

I disagree here, if you are unable to turn off a CPU via PSCI then 
something is definitely wrong. This means that CPU will forever spin in 
Xen code with no way to exit. This could bring interesting issue with 
anything potentially modifying Xen code (i.e livepatching).

IHMO, the forever sleep in stop_cpu() is just a temporary solution to 
cater shutdown of the platform. The state of secondary CPU does not much 
matter at that time. In case of suspend/resume you want really want to 
be able to turn off those CPUs correctly otherwise they are not going to 
come up again.

> Enabling that pCPU later will fail, but
> Xen can handle this error and continue running properly on the boot
> pCPU (I've tested this in 2 pCPUs config).

I don't consider that as xen running properly. You lost a pCPU so your 
workload is completely different. Imagine you are using the NULL 
scheduler (e.g only one vCPU is pinned to a specific pCPU), what are you 
going to do with the vCPU?

> Therefore, I believe panic may not be necessary in this case. I
> suggest that we dump the error message and continue to run. Please let
> me know if you disagree.

This is a bad idea, a failure should at least be logged to show 
something gone wrong.

PSCI CPU off will, as you said, unlikely failed. Looking at the spec, 
the only possible reason is your are trying to turn off a CPU where 
Trusted OS is resident. This means something far more wrong is happening 
in Xen code and I don't think it would be safe to continue to run.

Hence why I suggested a BUG_ON/panic because this is something that is 
not meant to happen.

Cheers,

-- 
Julien Grall

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

  reply	other threads:[~2018-04-16 14:26 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-11 13:19 [PATCH 0/7] xen/arm: CPU hotplug fixes Mirela Simonovic
2018-04-11 13:19 ` [PATCH 1/7] xen/arm: Added handling of the trapped access to OSLSR register Mirela Simonovic
2018-04-11 14:39   ` Julien Grall
2018-04-11 23:28     ` Stefano Stabellini
2018-04-11 13:19 ` [PATCH 2/7] xen/arm/vgic-v2: Ignore write to GICD_ISACTIVERn registers Mirela Simonovic
2018-04-11 14:43   ` Julien Grall
2018-04-11 23:31     ` Stefano Stabellini
2018-04-12 11:15       ` Mirela Simonovic
2018-04-11 13:19 ` [PATCH 3/7] xen/arm/psci: Implement CPU_OFF PSCI call (physical interface) Mirela Simonovic
2018-04-11 14:46   ` Julien Grall
2018-04-12 11:33     ` Mirela Simonovic
2018-04-12 13:31       ` Julien Grall
2018-04-16 10:02         ` Mirela Simonovic
2018-04-16 14:26           ` Julien Grall [this message]
2018-04-16 16:52             ` Mirela Simonovic
2018-04-16 17:02               ` Julien Grall
2018-04-11 13:19 ` [PATCH 4/7] xen/arm: When CPU dies, free percpu area immediatelly Mirela Simonovic
2018-04-11 14:53   ` Julien Grall
2018-04-11 23:46     ` Stefano Stabellini
2018-04-12  8:53       ` Julien Grall
2018-04-12 21:31         ` Stefano Stabellini
2018-04-16 13:14           ` Julien Grall
2018-04-16 13:41             ` Mirela Simonovic
2018-04-16 15:21               ` Julien Grall
2018-04-17 10:52                 ` Mirela Simonovic
2018-04-17 11:02                   ` Julien Grall
2018-04-18 22:52                     ` Stefano Stabellini
2018-04-19  9:32                       ` Julien Grall
2018-04-11 13:19 ` [PATCH 5/7] xen/arm: Remove __initdata and __init to enable CPU hotplug Mirela Simonovic
2018-04-12  0:07   ` Stefano Stabellini
2018-04-12  9:03     ` Julien Grall
2018-04-12 12:50       ` Mirela Simonovic
2018-04-12 12:56         ` Julien Grall
2018-04-12 13:55           ` Mirela Simonovic
2018-04-11 13:19 ` [PATCH 6/7] xen/arm: Setup virtual paging for secondary CPUs in non-boot scenario Mirela Simonovic
2018-04-11 15:11   ` Julien Grall
2018-04-17 12:54     ` Mirela Simonovic
2018-04-17 14:11       ` Julien Grall
2018-04-17 15:22         ` Mirela Simonovic
2018-04-18  9:48           ` Julien Grall
2018-04-18 10:34             ` Mirela Simonovic
2018-04-18 10:45         ` Mirela Simonovic
2018-04-18 10:58           ` Julien Grall
2018-04-18 22:56             ` Stefano Stabellini
2018-04-11 13:19 ` [PATCH 7/7] xen/arm: Restore IRQ affinity after hotplugging a CPU Mirela Simonovic
2018-04-11 14:55   ` Julien Grall
2018-04-12  0:20   ` Stefano Stabellini
2018-04-12  7:38     ` Mirela Simonovic
2018-04-12 16:49   ` Dario Faggioli
2018-04-13 10:11     ` Mirela Simonovic
2018-04-16 12:38       ` Dario Faggioli
2018-04-11 15:07 ` [PATCH 0/7] xen/arm: CPU hotplug fixes Julien Grall
2018-04-11 15:58   ` Mirela Simonovic
2018-04-11 16:02     ` Julien Grall
2018-04-11 16:37       ` Mirela Simonovic
2018-04-12  8:43         ` Julien Grall
2018-04-13 10:19           ` Mirela Simonovic
2018-04-16 11:33             ` Julien Grall
2018-04-16 14:06               ` Mirela Simonovic
2018-04-16 15:05                 ` Julien Grall
2018-04-11 15:13 ` Julien Grall

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=c71989bb-51e8-551e-d710-3f5c4a33158a@arm.com \
    --to=julien.grall@arm.com \
    --cc=dm@aggios.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=julien.grall@arm.org \
    --cc=mirela.simonovic@aggios.com \
    --cc=sstabellini@kernel.org \
    --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.