Skip to contentSkip to conversation

arm64: psci: respect MIGRATE_INFO_TYPE

PATCH New Ashwin Chaugule 2 participants 4 messages Sep 5, 2014 – Sep 8, 2014 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAJ5Y-eZqWsLT1ERWsdzCQASgzCfFTgn6fCBCpc7ceMoU2ONkNA@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): 20140905141345.GF20164@leverpostej

#4 lore raw

PATCH 1/2 arm64: psci: respect MIGRATE_INFO_TYPE

Quoted 50 lines · Mark Rutland
Quoted 40 lines · Ashwin Chaugule
Quoted 39 lines · Mark Rutland

Commit e71246a23acb (PSCI: Add initial support for PSCIv0.2 functions) added hooks for MIGRATE_INFO_TYPE, but didn't call it anywhere. This means that currently a UP Trusted OS can reject CPU_OFF calls, which will cause things to blow up.

This patch ensures we test MIGRATE_INFO_TYPE before calling CPU_OFF. If there's a UP trusted OS hotplug is rejected. Full support for PSCI in the presence of a UP trusted OS will require the use of MIGRATE and will have to come as a later patch.

Cc Ashwin Chaugule <[email protected]>
Cc Rob Herring <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Christoffer Dall <[email protected]>
Cc Will Deacon <[email protected]>
Cc Catalin Marinas <[email protected]>
---
 arch/arm64/kernel/psci.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/kernel/psci.c +9 -0
index 5539547..a5407af 100644
@@ -386,6 +386,20 @@ static int cpu_psci_cpu_disable(unsigned int cpu)
        /* Fail early if we don't have CPU_OFF support */
        if (!psci_ops.cpu_off)
                return -EOPNOTSUPP;
+
+       /*
+        * In the presence of a UP trusted OS, it might not be possible to
+        * hotplug certain CPUs, and CPU_OFF may return (which would be bad).
+        * Supporting a UP trusted OS requires careful use of
+        * MIGRATE_INFO_UP_CPU and MIGRATE, so for now fail in the presence of
+        * a UP Trusted OS.
+        */
+       if (psci_ops.migrate_info_type &&
Quoted 8 lines

arch/arm64/kernel/psci.c static int cpu_psci_cpu_disable(unsigned int cpu) · line 402

Quoted 5 lines
arch/arm64/kernel/psci.c +5 -0
+               psci_ops.migrate_info_type() != PSCI_0_2_TOS_MP) {
+                       pr_warn("Unable to handle UP trusted OS\n");
+                       return -EPERM;
+       }
+

Guessing there is no way for us to know which CPU the UP TOS is running on and only deny hotplug on that CPU?

Quoted 4 lines

In the comment above I mention we can use MIGRATE_INFO_UP_CPU for that. I started down that route, but the plumbing for it ended up looking a little crazy so I thought it was better for the moment to have a simple solution that we can backport to stable.

Ah. I faintly recollect experiencing similar craziness when I was adding v0.2 support.

Quoted 5 lines

No systems with a UP trusted OS (migrateable or not) have hit my radar yet, and we're currently broken for them anyhow. So for the moment it didn't seem worthwhile implementing support for those. We can add the requisite MIGRATE_INFO_UP_CPU and MIGRATE calls in a later series.

Ok.

Cheers,
Ashwin

#5 lore raw

PATCH 1/2 arm64: psci: respect MIGRATE_INFO_TYPE

[...]

Quoted 10 lines
Quoted 7 lines
Quoted 2 lines

Guessing there is no way for us to know which CPU the UP TOS is running on and only deny hotplug on that CPU?

In the comment above I mention we can use MIGRATE_INFO_UP_CPU for that. I started down that route, but the plumbing for it ended up looking a little crazy so I thought it was better for the moment to have a simple solution that we can backport to stable.

Ah. I faintly recollect experiencing similar craziness when I was adding v0.2 support.

Yeah, it's lot of churny fun with many function prototypes changing about. I wasn't too keen on rushing that, though I would like to get around to it at some point.

Quoted 8 lines
Quoted 4 lines

No systems with a UP trusted OS (migrateable or not) have hit my radar yet, and we're currently broken for them anyhow. So for the moment it didn't seem worthwhile implementing support for those. We can add the requisite MIGRATE_INFO_UP_CPU and MIGRATE calls in a later series.

Ok.

Thanks.

Does that apply to both patches or just the arm64 one?

Mark.

#6 lore raw

PATCH 1/2 arm64: psci: respect MIGRATE_INFO_TYPE

Quoted 22 lines · Mark Rutland

[...]

Quoted 10 lines
Quoted 7 lines
Quoted 2 lines

Guessing there is no way for us to know which CPU the UP TOS is running on and only deny hotplug on that CPU?

In the comment above I mention we can use MIGRATE_INFO_UP_CPU for that. I started down that route, but the plumbing for it ended up looking a little crazy so I thought it was better for the moment to have a simple solution that we can backport to stable.

Ah. I faintly recollect experiencing similar craziness when I was adding v0.2 support.

Yeah, it's lot of churny fun with many function prototypes changing about. I wasn't too keen on rushing that, though I would like to get around to it at some point.

Quoted 5 lines
Quoted 4 lines

No systems with a UP trusted OS (migrateable or not) have hit my radar yet, and we're currently broken for them anyhow. So for the moment it didn't seem worthwhile implementing support for those. We can add the requisite MIGRATE_INFO_UP_CPU and MIGRATE calls in a later series.

Quoted 7 lines
Quoted 3 lines

Ok.

Thanks.

Does that apply to both patches or just the arm64 one?

Sorry, just looked at it. Please consider the ACK for both.

Thanks,
Ashwin

#7 lore raw

PATCH 1/2 arm64: psci: respect MIGRATE_INFO_TYPE

Quoted 25 lines · Ashwin Chaugule
Quoted 24 lines · Mark Rutland

[...]

Quoted 10 lines
Quoted 7 lines
Quoted 2 lines

Guessing there is no way for us to know which CPU the UP TOS is running on and only deny hotplug on that CPU?

In the comment above I mention we can use MIGRATE_INFO_UP_CPU for that. I started down that route, but the plumbing for it ended up looking a little crazy so I thought it was better for the moment to have a simple solution that we can backport to stable.

Ah. I faintly recollect experiencing similar craziness when I was adding v0.2 support.

Yeah, it's lot of churny fun with many function prototypes changing about. I wasn't too keen on rushing that, though I would like to get around to it at some point.

Quoted 7 lines
Quoted 4 lines

No systems with a UP trusted OS (migrateable or not) have hit my radar yet, and we're currently broken for them anyhow. So for the moment it didn't seem worthwhile implementing support for those. We can add the requisite MIGRATE_INFO_UP_CPU and MIGRATE calls in a later series.

Ok.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Thanks.

Does that apply to both patches or just the arm64 one?

Sorry, just looked at it. Please consider the ACK for both.

Thanks for taking a look, it's much appreciated.

Mark.