public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb•auug.org.au>
To: Russell King <linux@armlinux•org.uk>
Cc: Ard Biesheuvel <ardb@kernel•org>,
	Linux Kernel Mailing List <linux-kernel@vger•kernel.org>,
	Linux Next Mailing List <linux-next@vger•kernel.org>,
	"Russell King (Oracle)" <rmk+kernel@armlinux•org.uk>
Subject: linux-next: manual merge of the arm tree with Linus' tree
Date: Wed, 9 Mar 2022 09:35:18 +1100	[thread overview]
Message-ID: <20220309093519.4a9026a7@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 3503 bytes --]

Hi all,

Today's linux-next merge of the arm tree got a conflict in:

  arch/arm/kernel/traps.c

between commit:

  04e91b732476 ("ARM: early traps initialisation")

from Linus' tree and commits:

  a1c510d0adc6 ("ARM: implement support for vmap'ed stacks")
  d31e23aff011 ("ARM: mm: make vmalloc_seq handling SMP safe")

from the arm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/arm/kernel/traps.c
index 5d58aee24087,2dec6944e5dd..000000000000
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@@ -878,5 -840,72 +893,72 @@@ void __init early_trap_init(void *vecto
  	 * memory area. The address is configurable and so a table in the kernel
  	 * image can be used.
  	 */
 -#endif
  }
 +#endif
+ 
+ #ifdef CONFIG_VMAP_STACK
+ 
+ DECLARE_PER_CPU(u8 *, irq_stack_ptr);
+ 
+ asmlinkage DEFINE_PER_CPU(u8 *, overflow_stack_ptr);
+ 
+ static int __init allocate_overflow_stacks(void)
+ {
+ 	u8 *stack;
+ 	int cpu;
+ 
+ 	for_each_possible_cpu(cpu) {
+ 		stack = (u8 *)__get_free_page(GFP_KERNEL);
+ 		if (WARN_ON(!stack))
+ 			return -ENOMEM;
+ 		per_cpu(overflow_stack_ptr, cpu) = &stack[OVERFLOW_STACK_SIZE];
+ 	}
+ 	return 0;
+ }
+ early_initcall(allocate_overflow_stacks);
+ 
+ asmlinkage void handle_bad_stack(struct pt_regs *regs)
+ {
+ 	unsigned long tsk_stk = (unsigned long)current->stack;
+ #ifdef CONFIG_IRQSTACKS
+ 	unsigned long irq_stk = (unsigned long)this_cpu_read(irq_stack_ptr);
+ #endif
+ 	unsigned long ovf_stk = (unsigned long)this_cpu_read(overflow_stack_ptr);
+ 
+ 	console_verbose();
+ 	pr_emerg("Insufficient stack space to handle exception!");
+ 
+ 	pr_emerg("Task stack:     [0x%08lx..0x%08lx]\n",
+ 		 tsk_stk, tsk_stk + THREAD_SIZE);
+ #ifdef CONFIG_IRQSTACKS
+ 	pr_emerg("IRQ stack:      [0x%08lx..0x%08lx]\n",
+ 		 irq_stk - THREAD_SIZE, irq_stk);
+ #endif
+ 	pr_emerg("Overflow stack: [0x%08lx..0x%08lx]\n",
+ 		 ovf_stk - OVERFLOW_STACK_SIZE, ovf_stk);
+ 
+ 	die("kernel stack overflow", regs, 0);
+ }
+ 
+ #ifndef CONFIG_ARM_LPAE
+ /*
+  * Normally, we rely on the logic in do_translation_fault() to update stale PMD
+  * entries covering the vmalloc space in a task's page tables when it first
+  * accesses the region in question. Unfortunately, this is not sufficient when
+  * the task stack resides in the vmalloc region, as do_translation_fault() is a
+  * C function that needs a stack to run.
+  *
+  * So we need to ensure that these PMD entries are up to date *before* the MM
+  * switch. As we already have some logic in the MM switch path that takes care
+  * of this, let's trigger it by bumping the counter every time the core vmalloc
+  * code modifies a PMD entry in the vmalloc region. Use release semantics on
+  * the store so that other CPUs observing the counter's new value are
+  * guaranteed to see the updated page table entries as well.
+  */
+ void arch_sync_kernel_mappings(unsigned long start, unsigned long end)
+ {
+ 	if (start < VMALLOC_END && end > VMALLOC_START)
+ 		atomic_inc_return_release(&init_mm.context.vmalloc_seq);
+ }
+ #endif
+ #endif

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2022-03-08 22:35 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 22:35 Stephen Rothwell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-26 23:50 linux-next: manual merge of the arm tree with Linus' tree Stephen Rothwell
2020-05-27 23:09 Stephen Rothwell
2020-05-27 23:22 ` Russell King - ARM Linux admin
2020-05-28  7:01   ` Ard Biesheuvel
2020-05-30  8:41     ` Russell King - ARM Linux admin
2020-05-30  8:51       ` Ard Biesheuvel
2020-05-30  9:17         ` Russell King - ARM Linux admin
2020-05-30  9:53           ` Stephen Rothwell
2020-05-30 10:25           ` Ard Biesheuvel
2016-06-01  0:07 Stephen Rothwell
2016-06-01  8:52 ` Russell King
2012-03-30  0:11 Stephen Rothwell
2012-03-26  0:05 Stephen Rothwell
2012-03-13  0:08 Stephen Rothwell
2012-03-13  6:16 ` Ingo Molnar
2012-03-13  8:33   ` Russell King
2012-03-13  8:36     ` Ingo Molnar
2012-03-13  8:47       ` Russell King
2012-03-13  8:56         ` Ingo Molnar
2012-03-13  9:00           ` Russell King
2012-03-13  8:48     ` Ingo Molnar
2012-03-13  8:58       ` Russell King
2012-03-13  9:06         ` Ingo Molnar
2012-03-13  9:09           ` Russell King
2012-03-13  9:11           ` Russell King
2012-01-29 23:38 Stephen Rothwell
2012-01-08 23:53 Stephen Rothwell
2012-01-08 23:53 linux-next: manual merge of the arm tree with Linus tree Stephen Rothwell
2012-01-08 23:53 linux-next: manual merge of the arm tree with Linus' tree Stephen Rothwell
2011-12-20 23:08 Stephen Rothwell
2011-09-21  0:33 Stephen Rothwell
2011-09-21  9:31 ` Linus Walleij
2010-07-13  0:51 Stephen Rothwell
2010-03-03 23:49 Stephen Rothwell
2010-03-04  1:16 ` Eric Miao
2010-03-03 23:33 Stephen Rothwell
2009-07-31  0:33 Stephen Rothwell
2009-07-31  0:41 ` H Hartley Sweeten

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=20220309093519.4a9026a7@canb.auug.org.au \
    --to=sfr@canb$(echo .)auug.org.au \
    --cc=ardb@kernel$(echo .)org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=linux@armlinux$(echo .)org.uk \
    --cc=rmk+kernel@armlinux$(echo .)org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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