Skip to content

Commit 713d25d

Browse files
committed
Merge branch 'parisc-4.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parsic fixes from Helge Deller: "One patch from Mikulas fixes a bug on parisc by artifically incrementing the counter in pmd_free when the kernel tries to free the preallocated pmd. Other than that we now prevent that syscalls gets added without incrementing __NR_Linux_syscalls and fix the initial pmd setup code if a default page size greater than 4k has been selected" * 'parisc-4.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Fix pmd code to depend on PT_NLEVELS value, not on CONFIG_64BIT parisc: mm: don't count preallocated pmds parisc: Add compile-time check when adding new syscalls
2 parents 22824c5 + 2e3f0ab commit 713d25d

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

arch/parisc/include/asm/pgalloc.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
2626

2727
if (likely(pgd != NULL)) {
2828
memset(pgd, 0, PAGE_SIZE<<PGD_ALLOC_ORDER);
29-
#ifdef CONFIG_64BIT
29+
#if PT_NLEVELS == 3
3030
actual_pgd += PTRS_PER_PGD;
3131
/* Populate first pmd with allocated memory. We mark it
3232
* with PxD_FLAG_ATTACHED as a signal to the system that this
@@ -45,7 +45,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
4545

4646
static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
4747
{
48-
#ifdef CONFIG_64BIT
48+
#if PT_NLEVELS == 3
4949
pgd -= PTRS_PER_PGD;
5050
#endif
5151
free_pages((unsigned long)pgd, PGD_ALLOC_ORDER);
@@ -72,12 +72,15 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
7272

7373
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
7474
{
75-
#ifdef CONFIG_64BIT
7675
if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
77-
/* This is the permanent pmd attached to the pgd;
78-
* cannot free it */
76+
/*
77+
* This is the permanent pmd attached to the pgd;
78+
* cannot free it.
79+
* Increment the counter to compensate for the decrement
80+
* done by generic mm code.
81+
*/
82+
mm_inc_nr_pmds(mm);
7983
return;
80-
#endif
8184
free_pages((unsigned long)pmd, PMD_ORDER);
8285
}
8386

@@ -99,7 +102,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
99102
static inline void
100103
pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
101104
{
102-
#ifdef CONFIG_64BIT
105+
#if PT_NLEVELS == 3
103106
/* preserve the gateway marker if this is the beginning of
104107
* the permanent pmd */
105108
if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)

arch/parisc/kernel/syscall_table.S

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
#define ENTRY_COMP(_name_) .word sys_##_name_
5656
#endif
5757

58-
ENTRY_SAME(restart_syscall) /* 0 */
59-
ENTRY_SAME(exit)
58+
90: ENTRY_SAME(restart_syscall) /* 0 */
59+
91: ENTRY_SAME(exit)
6060
ENTRY_SAME(fork_wrapper)
6161
ENTRY_SAME(read)
6262
ENTRY_SAME(write)
@@ -439,7 +439,10 @@
439439
ENTRY_SAME(bpf)
440440
ENTRY_COMP(execveat)
441441

442-
/* Nothing yet */
442+
443+
.ifne (. - 90b) - (__NR_Linux_syscalls * (91b - 90b))
444+
.error "size of syscall table does not fit value of __NR_Linux_syscalls"
445+
.endif
443446

444447
#undef ENTRY_SAME
445448
#undef ENTRY_DIFF

0 commit comments

Comments
 (0)