All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] arm64: Ensure the instruction emulation is ready for userspace
@ 2017-10-06 13:16 ` Suzuki K Poulose
  0 siblings, 0 replies; 6+ messages in thread
From: Suzuki K Poulose @ 2017-10-06 13:16 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, matwey.kornilov, Suzuki K Poulose, stable,
	Catalin Marinas, Dave Martin, Matthias Brugger, James Morse

We trap and emulate some instructions (e.g, mrs, deprecated instructions)
for the userspace. However the handlers for these are registered as
late_initcalls and the userspace could be up and running from the initramfs
by that time (with populate_rootfs, which is a rootfs_initcall()). This
could cause problems for the early applications ending up in failure
like :

[   11.152061] modprobe[93]: undefined instruction: pc=0000ffff8ca48ff4

This patch promotes the specific calls to core_initcalls, which are
guaranteed to be completed before we hit userspace.

Cc: stable@vger.kernel.org
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Martin <dave.martin@arm.com>
Cc: Matthias Brugger <mbrugger@suse.com>
Cc: James Morse <james.morse@arm.com>
Reported-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 arch/arm64/kernel/armv8_deprecated.c | 2 +-
 arch/arm64/kernel/cpufeature.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
index f0e6d717885b..d06fbe4cd38d 100644
--- a/arch/arm64/kernel/armv8_deprecated.c
+++ b/arch/arm64/kernel/armv8_deprecated.c
@@ -649,4 +649,4 @@ static int __init armv8_deprecated_init(void)
 	return 0;
 }
 
-late_initcall(armv8_deprecated_init);
+core_initcall(armv8_deprecated_init);
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index cd52d365d1f0..21e2c95d24e7 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -1307,4 +1307,4 @@ static int __init enable_mrs_emulation(void)
 	return 0;
 }
 
-late_initcall(enable_mrs_emulation);
+core_initcall(enable_mrs_emulation);
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 1/2] arm64: Ensure the instruction emulation is ready for userspace
@ 2017-10-06 13:16 ` Suzuki K Poulose
  0 siblings, 0 replies; 6+ messages in thread
From: Suzuki K Poulose @ 2017-10-06 13:16 UTC (permalink / raw)
  To: linux-arm-kernel

We trap and emulate some instructions (e.g, mrs, deprecated instructions)
for the userspace. However the handlers for these are registered as
late_initcalls and the userspace could be up and running from the initramfs
by that time (with populate_rootfs, which is a rootfs_initcall()). This
could cause problems for the early applications ending up in failure
like :

[   11.152061] modprobe[93]: undefined instruction: pc=0000ffff8ca48ff4

This patch promotes the specific calls to core_initcalls, which are
guaranteed to be completed before we hit userspace.

Cc: stable at vger.kernel.org
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Martin <dave.martin@arm.com>
Cc: Matthias Brugger <mbrugger@suse.com>
Cc: James Morse <james.morse@arm.com>
Reported-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 arch/arm64/kernel/armv8_deprecated.c | 2 +-
 arch/arm64/kernel/cpufeature.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
index f0e6d717885b..d06fbe4cd38d 100644
--- a/arch/arm64/kernel/armv8_deprecated.c
+++ b/arch/arm64/kernel/armv8_deprecated.c
@@ -649,4 +649,4 @@ static int __init armv8_deprecated_init(void)
 	return 0;
 }
 
-late_initcall(armv8_deprecated_init);
+core_initcall(armv8_deprecated_init);
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index cd52d365d1f0..21e2c95d24e7 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -1307,4 +1307,4 @@ static int __init enable_mrs_emulation(void)
 	return 0;
 }
 
-late_initcall(enable_mrs_emulation);
+core_initcall(enable_mrs_emulation);
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] arm64: Ensure fpsimd support is ready before userspace is active
  2017-10-06 13:16 ` Suzuki K Poulose
@ 2017-10-06 13:16   ` Suzuki K Poulose
  -1 siblings, 0 replies; 6+ messages in thread
From: Suzuki K Poulose @ 2017-10-06 13:16 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, matwey.kornilov, Suzuki K Poulose, Catalin Marinas,
	Will Deacon, Mark Rutland, Dave Martin

We register the pm/hotplug callbacks for FPSIMD as late_initcall,
which happens after the userspace is active (from initramfs via
populate_rootfs, a rootfs_initcall). Make sure we are ready even
before the userspace could potentially use it, by promoting to
a core_initcall.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Dave Martin <dave.martin@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 arch/arm64/kernel/fpsimd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index f444f374bd7b..5d547deb6996 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -444,4 +444,4 @@ static int __init fpsimd_init(void)
 
 	return 0;
 }
-late_initcall(fpsimd_init);
+core_initcall(fpsimd_init);
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] arm64: Ensure fpsimd support is ready before userspace is active
@ 2017-10-06 13:16   ` Suzuki K Poulose
  0 siblings, 0 replies; 6+ messages in thread
From: Suzuki K Poulose @ 2017-10-06 13:16 UTC (permalink / raw)
  To: linux-arm-kernel

We register the pm/hotplug callbacks for FPSIMD as late_initcall,
which happens after the userspace is active (from initramfs via
populate_rootfs, a rootfs_initcall). Make sure we are ready even
before the userspace could potentially use it, by promoting to
a core_initcall.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Dave Martin <dave.martin@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 arch/arm64/kernel/fpsimd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index f444f374bd7b..5d547deb6996 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -444,4 +444,4 @@ static int __init fpsimd_init(void)
 
 	return 0;
 }
-late_initcall(fpsimd_init);
+core_initcall(fpsimd_init);
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] arm64: Ensure the instruction emulation is ready for userspace
  2017-10-06 13:16 ` Suzuki K Poulose
@ 2017-10-06 15:35   ` Catalin Marinas
  -1 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2017-10-06 15:35 UTC (permalink / raw)
  To: Suzuki K Poulose
  Cc: linux-arm-kernel, Matthias Brugger, linux-kernel, stable,
	matwey.kornilov, James Morse, Dave Martin

On Fri, Oct 06, 2017 at 02:16:52PM +0100, Suzuki K. Poulose wrote:
> We trap and emulate some instructions (e.g, mrs, deprecated instructions)
> for the userspace. However the handlers for these are registered as
> late_initcalls and the userspace could be up and running from the initramfs
> by that time (with populate_rootfs, which is a rootfs_initcall()). This
> could cause problems for the early applications ending up in failure
> like :
> 
> [   11.152061] modprobe[93]: undefined instruction: pc=0000ffff8ca48ff4
> 
> This patch promotes the specific calls to core_initcalls, which are
> guaranteed to be completed before we hit userspace.
> 
> Cc: stable@vger.kernel.org
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Dave Martin <dave.martin@arm.com>
> Cc: Matthias Brugger <mbrugger@suse.com>
> Cc: James Morse <james.morse@arm.com>
> Reported-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>

Both patches queued for 4.14. Thanks.

-- 
Catalin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] arm64: Ensure the instruction emulation is ready for userspace
@ 2017-10-06 15:35   ` Catalin Marinas
  0 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2017-10-06 15:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Oct 06, 2017 at 02:16:52PM +0100, Suzuki K. Poulose wrote:
> We trap and emulate some instructions (e.g, mrs, deprecated instructions)
> for the userspace. However the handlers for these are registered as
> late_initcalls and the userspace could be up and running from the initramfs
> by that time (with populate_rootfs, which is a rootfs_initcall()). This
> could cause problems for the early applications ending up in failure
> like :
> 
> [   11.152061] modprobe[93]: undefined instruction: pc=0000ffff8ca48ff4
> 
> This patch promotes the specific calls to core_initcalls, which are
> guaranteed to be completed before we hit userspace.
> 
> Cc: stable at vger.kernel.org
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Dave Martin <dave.martin@arm.com>
> Cc: Matthias Brugger <mbrugger@suse.com>
> Cc: James Morse <james.morse@arm.com>
> Reported-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>

Both patches queued for 4.14. Thanks.

-- 
Catalin

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-06 15:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-06 13:16 [PATCH 1/2] arm64: Ensure the instruction emulation is ready for userspace Suzuki K Poulose
2017-10-06 13:16 ` Suzuki K Poulose
2017-10-06 13:16 ` [PATCH 2/2] arm64: Ensure fpsimd support is ready before userspace is active Suzuki K Poulose
2017-10-06 13:16   ` Suzuki K Poulose
2017-10-06 15:35 ` [PATCH 1/2] arm64: Ensure the instruction emulation is ready for userspace Catalin Marinas
2017-10-06 15:35   ` Catalin Marinas

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.