Skip to content

Commit b148942

Browse files
committed
Merge tag 'arc-5.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
Pull ARC fixes from Vineet Gupta: "A couple more stack unwinder related fixes: - More stack unwinding updates - Misc minor fixes" * tag 'arc-5.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc: ARC: stack unwinding: reorganize how initial register state setup ARC: stack unwinding: don't assume non-current task is sleeping ARC: mm: fix spelling mistakes ARC: bitops: Remove unecessary operation and value
2 parents d5beb31 + f737561 commit b148942

File tree

3 files changed

+44
-40
lines changed

3 files changed

+44
-40
lines changed

arch/arc/include/asm/bitops.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,8 @@ static inline int constant_fls(unsigned int x)
243243
x <<= 2;
244244
r -= 2;
245245
}
246-
if (!(x & 0x80000000u)) {
247-
x <<= 1;
246+
if (!(x & 0x80000000u))
248247
r -= 1;
249-
}
250248
return r;
251249
}
252250

arch/arc/kernel/stacktrace.c

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,27 @@
3838

3939
#ifdef CONFIG_ARC_DW2_UNWIND
4040

41-
static void seed_unwind_frame_info(struct task_struct *tsk,
42-
struct pt_regs *regs,
43-
struct unwind_frame_info *frame_info)
41+
static int
42+
seed_unwind_frame_info(struct task_struct *tsk, struct pt_regs *regs,
43+
struct unwind_frame_info *frame_info)
4444
{
45-
/*
46-
* synchronous unwinding (e.g. dump_stack)
47-
* - uses current values of SP and friends
48-
*/
49-
if (tsk == NULL && regs == NULL) {
45+
if (regs) {
46+
/*
47+
* Asynchronous unwinding of intr/exception
48+
* - Just uses the pt_regs passed
49+
*/
50+
frame_info->task = tsk;
51+
52+
frame_info->regs.r27 = regs->fp;
53+
frame_info->regs.r28 = regs->sp;
54+
frame_info->regs.r31 = regs->blink;
55+
frame_info->regs.r63 = regs->ret;
56+
frame_info->call_frame = 0;
57+
} else if (tsk == NULL || tsk == current) {
58+
/*
59+
* synchronous unwinding (e.g. dump_stack)
60+
* - uses current values of SP and friends
61+
*/
5062
unsigned long fp, sp, blink, ret;
5163
frame_info->task = current;
5264

@@ -63,13 +75,17 @@ static void seed_unwind_frame_info(struct task_struct *tsk,
6375
frame_info->regs.r31 = blink;
6476
frame_info->regs.r63 = ret;
6577
frame_info->call_frame = 0;
66-
} else if (regs == NULL) {
78+
} else {
6779
/*
68-
* Asynchronous unwinding of sleeping task
69-
* - Gets SP etc from task's pt_regs (saved bottom of kernel
70-
* mode stack of task)
80+
* Asynchronous unwinding of a likely sleeping task
81+
* - first ensure it is actually sleeping
82+
* - if so, it will be in __switch_to, kernel mode SP of task
83+
* is safe-kept and BLINK at a well known location in there
7184
*/
7285

86+
if (tsk->state == TASK_RUNNING)
87+
return -1;
88+
7389
frame_info->task = tsk;
7490

7591
frame_info->regs.r27 = TSK_K_FP(tsk);
@@ -90,19 +106,8 @@ static void seed_unwind_frame_info(struct task_struct *tsk,
90106
frame_info->regs.r28 += 60;
91107
frame_info->call_frame = 0;
92108

93-
} else {
94-
/*
95-
* Asynchronous unwinding of intr/exception
96-
* - Just uses the pt_regs passed
97-
*/
98-
frame_info->task = tsk;
99-
100-
frame_info->regs.r27 = regs->fp;
101-
frame_info->regs.r28 = regs->sp;
102-
frame_info->regs.r31 = regs->blink;
103-
frame_info->regs.r63 = regs->ret;
104-
frame_info->call_frame = 0;
105109
}
110+
return 0;
106111
}
107112

108113
#endif
@@ -116,7 +121,8 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
116121
unsigned int address;
117122
struct unwind_frame_info frame_info;
118123

119-
seed_unwind_frame_info(tsk, regs, &frame_info);
124+
if (seed_unwind_frame_info(tsk, regs, &frame_info))
125+
return 0;
120126

121127
while (1) {
122128
address = UNW_PC(&frame_info);

arch/arc/mm/tlb.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
* -Changes related to MMU v2 (Rel 4.8)
3131
*
3232
* Vineetg: Aug 29th 2008
33-
* -In TLB Flush operations (Metal Fix MMU) there is a explict command to
33+
* -In TLB Flush operations (Metal Fix MMU) there is a explicit command to
3434
* flush Micro-TLBS. If TLB Index Reg is invalid prior to TLBIVUTLB cmd,
3535
* it fails. Thus need to load it with ANY valid value before invoking
3636
* TLBIVUTLB cmd
3737
*
3838
* Vineetg: Aug 21th 2008:
3939
* -Reduced the duration of IRQ lockouts in TLB Flush routines
40-
* -Multiple copies of TLB erase code seperated into a "single" function
40+
* -Multiple copies of TLB erase code separated into a "single" function
4141
* -In TLB Flush routines, interrupt disabling moved UP to retrieve ASID
4242
* in interrupt-safe region.
4343
*
@@ -66,7 +66,7 @@
6666
*
6767
* Although J-TLB is 2 way set assoc, ARC700 caches J-TLB into uTLBS which has
6868
* much higher associativity. u-D-TLB is 8 ways, u-I-TLB is 4 ways.
69-
* Given this, the thrasing problem should never happen because once the 3
69+
* Given this, the thrashing problem should never happen because once the 3
7070
* J-TLB entries are created (even though 3rd will knock out one of the prev
7171
* two), the u-D-TLB and u-I-TLB will have what is required to accomplish memcpy
7272
*
@@ -127,7 +127,7 @@ static void utlb_invalidate(void)
127127
* There was however an obscure hardware bug, where uTLB flush would
128128
* fail when a prior probe for J-TLB (both totally unrelated) would
129129
* return lkup err - because the entry didn't exist in MMU.
130-
* The Workround was to set Index reg with some valid value, prior to
130+
* The Workaround was to set Index reg with some valid value, prior to
131131
* flush. This was fixed in MMU v3
132132
*/
133133
unsigned int idx;
@@ -272,7 +272,7 @@ noinline void local_flush_tlb_all(void)
272272
}
273273

274274
/*
275-
* Flush the entrie MM for userland. The fastest way is to move to Next ASID
275+
* Flush the entire MM for userland. The fastest way is to move to Next ASID
276276
*/
277277
noinline void local_flush_tlb_mm(struct mm_struct *mm)
278278
{
@@ -303,7 +303,7 @@ noinline void local_flush_tlb_mm(struct mm_struct *mm)
303303
* Difference between this and Kernel Range Flush is
304304
* -Here the fastest way (if range is too large) is to move to next ASID
305305
* without doing any explicit Shootdown
306-
* -In case of kernel Flush, entry has to be shot down explictly
306+
* -In case of kernel Flush, entry has to be shot down explicitly
307307
*/
308308
void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
309309
unsigned long end)
@@ -620,7 +620,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr_unaligned,
620620
* Super Page size is configurable in hardware (4K to 16M), but fixed once
621621
* RTL builds.
622622
*
623-
* The exact THP size a Linx configuration will support is a function of:
623+
* The exact THP size a Linux configuration will support is a function of:
624624
* - MMU page size (typical 8K, RTL fixed)
625625
* - software page walker address split between PGD:PTE:PFN (typical
626626
* 11:8:13, but can be changed with 1 line)
@@ -698,7 +698,7 @@ void local_flush_pmd_tlb_range(struct vm_area_struct *vma, unsigned long start,
698698

699699
#endif
700700

701-
/* Read the Cache Build Confuration Registers, Decode them and save into
701+
/* Read the Cache Build Configuration Registers, Decode them and save into
702702
* the cpuinfo structure for later use.
703703
* No Validation is done here, simply read/convert the BCRs
704704
*/
@@ -803,13 +803,13 @@ void arc_mmu_init(void)
803803
pr_info("%s", arc_mmu_mumbojumbo(0, str, sizeof(str)));
804804

805805
/*
806-
* Can't be done in processor.h due to header include depenedencies
806+
* Can't be done in processor.h due to header include dependencies
807807
*/
808808
BUILD_BUG_ON(!IS_ALIGNED((CONFIG_ARC_KVADDR_SIZE << 20), PMD_SIZE));
809809

810810
/*
811811
* stack top size sanity check,
812-
* Can't be done in processor.h due to header include depenedencies
812+
* Can't be done in processor.h due to header include dependencies
813813
*/
814814
BUILD_BUG_ON(!IS_ALIGNED(STACK_TOP, PMD_SIZE));
815815

@@ -881,7 +881,7 @@ void arc_mmu_init(void)
881881
* the duplicate one.
882882
* -Knob to be verbose abt it.(TODO: hook them up to debugfs)
883883
*/
884-
volatile int dup_pd_silent; /* Be slient abt it or complain (default) */
884+
volatile int dup_pd_silent; /* Be silent abt it or complain (default) */
885885

886886
void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
887887
struct pt_regs *regs)
@@ -948,7 +948,7 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
948948

949949
/***********************************************************************
950950
* Diagnostic Routines
951-
* -Called from Low Level TLB Hanlders if things don;t look good
951+
* -Called from Low Level TLB Handlers if things don;t look good
952952
**********************************************************************/
953953

954954
#ifdef CONFIG_ARC_DBG_TLB_PARANOIA

0 commit comments

Comments
 (0)