Skip to content

Commit 04c5dec

Browse files
committed
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS fixes from Ralf Baechle: "These are the fixes for the N32 syscall bugs found by Al, an extraneous break that broke detection for R3000 and R3081 processors, an endless loop processing signals for kernel task (x86 received the same fix a while ago) and a fix for transparent huge page which took ages to track down because it was so hard to come up with a workable test case." * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: MIPS: Fix endless loop when processing signals for kernel tasks MIPS: R3000/R3081: Fix CPU detection. MIPS: N32: Fix signalfd4 syscall entry point MIPS: N32: Fix preadv(2) and pwritev(2) entry points. MIPS: Avoid mcheck by flushing page range in huge_ptep_set_access_flags()
2 parents d91fa97 + c90e6fb commit 04c5dec

File tree

5 files changed

+24
-20
lines changed

5 files changed

+24
-20
lines changed

arch/mips/include/asm/hugetlb.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,17 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
9595
pte_t *ptep, pte_t pte,
9696
int dirty)
9797
{
98-
return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
98+
int changed = !pte_same(*ptep, pte);
99+
100+
if (changed) {
101+
set_pte_at(vma->vm_mm, addr, ptep, pte);
102+
/*
103+
* There could be some standard sized pages in there,
104+
* get them all.
105+
*/
106+
flush_tlb_range(vma, addr, addr + HPAGE_SIZE);
107+
}
108+
return changed;
99109
}
100110

101111
static inline pte_t huge_ptep_get(pte_t *ptep)

arch/mips/kernel/cpu-probe.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,6 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
510510
c->cputype = CPU_R3000A;
511511
__cpu_name[cpu] = "R3000A";
512512
}
513-
break;
514513
} else {
515514
c->cputype = CPU_R3000;
516515
__cpu_name[cpu] = "R3000";

arch/mips/kernel/entry.S

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ FEXPORT(ret_from_exception)
3636
FEXPORT(ret_from_irq)
3737
LONG_S s0, TI_REGS($28)
3838
FEXPORT(__ret_from_irq)
39+
/*
40+
* We can be coming here from a syscall done in the kernel space,
41+
* e.g. a failed kernel_execve().
42+
*/
43+
resume_userspace_check:
3944
LONG_L t0, PT_STATUS(sp) # returning to kernel mode?
4045
andi t0, t0, KU_USER
4146
beqz t0, resume_kernel
@@ -162,7 +167,7 @@ work_notifysig: # deal with pending signals and
162167
move a0, sp
163168
li a1, 0
164169
jal do_notify_resume # a2 already loaded
165-
j resume_userspace
170+
j resume_userspace_check
166171

167172
FEXPORT(syscall_exit_partial)
168173
local_irq_disable # make sure need_resched doesn't

arch/mips/kernel/scall64-n32.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,14 +397,14 @@ EXPORT(sysn32_call_table)
397397
PTR sys_timerfd_create
398398
PTR compat_sys_timerfd_gettime /* 6285 */
399399
PTR compat_sys_timerfd_settime
400-
PTR sys_signalfd4
400+
PTR compat_sys_signalfd4
401401
PTR sys_eventfd2
402402
PTR sys_epoll_create1
403403
PTR sys_dup3 /* 6290 */
404404
PTR sys_pipe2
405405
PTR sys_inotify_init1
406-
PTR sys_preadv
407-
PTR sys_pwritev
406+
PTR compat_sys_preadv
407+
PTR compat_sys_pwritev
408408
PTR compat_sys_rt_tgsigqueueinfo /* 6295 */
409409
PTR sys_perf_event_open
410410
PTR sys_accept4

arch/mips/mm/tlb-r4k.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,11 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
120120

121121
if (cpu_context(cpu, mm) != 0) {
122122
unsigned long size, flags;
123-
int huge = is_vm_hugetlb_page(vma);
124123

125124
ENTER_CRITICAL(flags);
126-
if (huge) {
127-
start = round_down(start, HPAGE_SIZE);
128-
end = round_up(end, HPAGE_SIZE);
129-
size = (end - start) >> HPAGE_SHIFT;
130-
} else {
131-
start = round_down(start, PAGE_SIZE << 1);
132-
end = round_up(end, PAGE_SIZE << 1);
133-
size = (end - start) >> (PAGE_SHIFT + 1);
134-
}
125+
start = round_down(start, PAGE_SIZE << 1);
126+
end = round_up(end, PAGE_SIZE << 1);
127+
size = (end - start) >> (PAGE_SHIFT + 1);
135128
if (size <= current_cpu_data.tlbsize/2) {
136129
int oldpid = read_c0_entryhi();
137130
int newpid = cpu_asid(cpu, mm);
@@ -140,10 +133,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
140133
int idx;
141134

142135
write_c0_entryhi(start | newpid);
143-
if (huge)
144-
start += HPAGE_SIZE;
145-
else
146-
start += (PAGE_SIZE << 1);
136+
start += (PAGE_SIZE << 1);
147137
mtc0_tlbw_hazard();
148138
tlb_probe();
149139
tlb_probe_hazard();

0 commit comments

Comments
 (0)