Helge Deller | 27 Mar 23:23 2015
Picon
Picon

[GIT PULL] parisc fixes for v4.0

Hi Linus,

Please pull three patches for kernel-4.0 for the parisc architecture from

  git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git parisc-4.0-1

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. 

Thanks,
Helge

----------------------------------------------------------------
Helge Deller (2):
      parisc: Add compile-time check when adding new syscalls
      parisc: Fix pmd code to depend on PT_NLEVELS value, not on CONFIG_64BIT

Mikulas Patocka (1):
      parisc: mm: don't count preallocated pmds

 arch/parisc/include/asm/pgalloc.h  | 17 ++++++++++-------
 arch/parisc/kernel/syscall_table.S |  9 ++++++---
 2 files changed, 16 insertions(+), 10 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
(Continue reading)

Matthew Wilcox | 20 Mar 18:37 2015
Picon

[PATCH] parisc: Eliminate sg_virt_addr() and private scatterlist.h

From: Matthew Wilcox <willy <at> linux.intel.com>

The only reason to keep parisc's private asm/scatterlist.h was that it
had the macro sg_virt_addr().  Convert all callers to use something else
(sometimes just sg->offset was enough, others should use sg_virt()), and
we can just use the asm-generic scatterlist.h instead.

Signed-off-by: Matthew Wilcox <willy <at> linux.intel.com>
---

I haven't even compile-tested these changes ... I do have some PA-RISC
equipment, but it hasn't been turned on in seven years.

 arch/parisc/include/asm/Kbuild        |  1 +
 arch/parisc/include/asm/cacheflush.h  |  2 +-
 arch/parisc/include/asm/scatterlist.h | 10 ----------
 arch/parisc/kernel/pci-dma.c          |  8 ++++----
 drivers/parisc/ccio-dma.c             |  6 +++---
 drivers/parisc/iommu-helpers.h        | 30 ++++++++++++++++--------------
 drivers/parisc/sba_iommu.c            |  7 +++----
 7 files changed, 28 insertions(+), 36 deletions(-)
 delete mode 100644 arch/parisc/include/asm/scatterlist.h

diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild
index 8686237..a5f0375 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
 <at>  <at>  -20,6 +20,7  <at>  <at>  generic-y += param.h
 generic-y += percpu.h
 generic-y += poll.h
(Continue reading)

Mikulas Patocka | 18 Mar 16:16 2015
Picon

[PATCH] mm: don't count preallocated pmds

Hi

Here I'm sending a patch that fixes numerous "BUG: non-zero nr_pmds on 
freeing mm: -1" errors on 64-bit PA-RISC kernel.

I think the patch posted here 
http://www.spinics.net/lists/linux-parisc/msg05981.html is incorrect, it 
wouldn't work if the affected address range is freed and allocated 
multiple times.
	- 1. alloc pgd with built-in pmd, the count of pmds is 1
	- 2. free the range covered by the built-in pmd, the count of pmds 
		is 0, but the built-in pmd is still present
	- 3. alloc some memory in the range affected by the built-in pmd, 
		the count of pmds is still 0
	- 4. free the range covered by the built-in pmd, the counter 
		underflows to -1

Mikulas

From: Mikulas Patocka <mpatocka <at> redhat.com>

The patch dc6c9a35b66b520cf67e05d8ca60ebecad3b0479 that counts pmds 
allocated for a process introduced a bug on 64-bit PA-RISC kernels. There 
are many "BUG: non-zero nr_pmds on freeing mm: -1" messages.

The PA-RISC architecture preallocates one pmd with each pgd. This
preallocated pmd can never be freed - pmd_free does nothing when it is
called with this pmd. When the kernel attempts to free this preallocated
pmd, it decreases the count of allocated pmds. The result is that the
counter underflows and this error is reported.
(Continue reading)

Helge Deller | 16 Mar 21:21 2015
Picon
Picon

[PATCH] parisc: Do not hardcode PAGE_SIZE dependend values in assembler

Signed-off-by: Helge Deller <deller <at> gmx.de>

diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 2ab16bb..c9bbf88 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
 <at>  <at>  -640,9 +640,9  <at>  <at> 
 	 * Check "subtle" note in pacache.S re: r23/r26.
 	 */
 #ifdef CONFIG_64BIT
-	extrd,u,*=	\va,41,1,%r0
+	extrd,u,*=	\va,63-PAGE_SHIFT,1,%r0
 #else
-	extrw,u,=	\va,9,1,%r0
+	extrw,u,=	\va,31-PAGE_SHIFT,1,%r0
 #endif
 	or,COND(tr)	%r23,%r0,\pte
 	or		%r26,%r0,\pte
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Helge Deller | 16 Mar 21:17 2015
Picon
Picon

[PATCH] parisc: Fix pmd code to depend on PT_NLEVELS value, not on CONFIG_64BIT

Make the code which sets up the pmd depend on PT_NLEVELS == 3, not on
CONFIG_64BIT. The reason is, that a 64bit kernel with a page size
greater than 4k doesn't need the pmd and thus has PT_NLEVELS = 2.

Signed-off-by: Helge Deller <deller <at> gmx.de>

diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h
index 8ee9a0b..c500730 100644
--- a/arch/parisc/include/asm/pgalloc.h
+++ b/arch/parisc/include/asm/pgalloc.h
 <at>  <at>  -26,7 +26,7  <at>  <at>  static inline pgd_t *pgd_alloc(struct mm_struct *mm)

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

 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 {
-#ifdef CONFIG_64BIT
+#if PT_NLEVELS == 3
 	pgd -= PTRS_PER_PGD;
 #endif
 	free_pages((unsigned long)pgd, PGD_ALLOC_ORDER);
 <at>  <at>  -73,12 +73,10  <at>  <at>  static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)

(Continue reading)

Helge Deller | 15 Mar 21:00 2015
Picon
Picon

[PATCH] parisc: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian

This patch is basically the same as commit 9d42d48 from Catalin Marinas
but adopted to the parisc architecture.

The native (64-bit) sigval_t union contains sival_int (32-bit) and sival_ptr
(64-bit). When a compat application invokes a syscall that takes a sigval_t
value (as part of a larger structure, e.g.  compat_sys_mq_notify,
compat_sys_timer_create), the compat_sigval_t union is converted to the native
sigval_t with sival_int overlapping with either the least or the most
significant half of sival_ptr, depending on endianness. When the corresponding
signal is delivered to a compat application, on big endian the current
(compat_uptr_t)sival_ptr cast always returns 0 since sival_int corresponds to
the top part of sival_ptr. This patch fixes copy_siginfo_to_user32() so that
sival_int is copied to the compat_siginfo_t structure.

Cc: <stable <at> vger.kernel.org>
Reported-by: Bamvor Jian Zhang <bamvor.zhangjian <at> huawei.com>
Signed-off-by: Helge Deller <deller <at> gmx.de>

diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c
index 984abbe..d1f1fcd 100644
--- a/arch/parisc/kernel/signal32.c
+++ b/arch/parisc/kernel/signal32.c
 <at>  <at>  -322,7 +322,6  <at>  <at>  int
 copy_siginfo_to_user32 (compat_siginfo_t __user *to, const siginfo_t *from)
 {
 	compat_uptr_t addr;
-	compat_int_t val;
 	int err;

 	if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
(Continue reading)

Helge Deller | 14 Mar 21:34 2015
Picon
Picon

[PATCH] parisc: Add compile-time check when adding new syscalls

Signed-off-by: Helge Deller <deller <at> gmx.de>

diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 5a8997d..802f807 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
 <at>  <at>  -41,20 +41,25  <at>  <at> 
 #define ENTRY_UHOH(_name_) .dword sys32_##unimplemented
 #define ENTRY_OURS(_name_) .dword parisc_##_name_
 #define ENTRY_COMP(_name_) .dword compat_sys_##_name_
+#define SYSCALLTABLE_NAME  syscall_table_compat
 #elif defined(CONFIG_64BIT) && defined(SYSCALL_TABLE_64BIT)
 #define ENTRY_SAME(_name_) .dword sys_##_name_
 #define ENTRY_DIFF(_name_) .dword sys_##_name_
 #define ENTRY_UHOH(_name_) .dword sys_##_name_
 #define ENTRY_OURS(_name_) .dword sys_##_name_
 #define ENTRY_COMP(_name_) .dword sys_##_name_
+#define SYSCALLTABLE_NAME  syscall_table_64bit
 #else
 #define ENTRY_SAME(_name_) .word sys_##_name_
 #define ENTRY_DIFF(_name_) .word sys_##_name_
 #define ENTRY_UHOH(_name_) .word sys_##_name_
 #define ENTRY_OURS(_name_) .word parisc_##_name_
 #define ENTRY_COMP(_name_) .word sys_##_name_
+#define SYSCALLTABLE_NAME  syscall_table_32bit
 #endif

+        .local SYSCALLTABLE_NAME
+SYSCALLTABLE_NAME:
 	ENTRY_SAME(restart_syscall)	/* 0 */
(Continue reading)

Kirill A. Shutemov | 13 Mar 11:30 2015
Picon

[PATCH] parisc: fix pmd accounting with 3-level page tables

There's hack in pgd_alloc() on parisc to initialize one pmd, which is
not accounted. It leads to underflow on exit.

Let's adjust nr_pmds on pgd_alloc() to get accounting correct.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov <at> linux.intel.com>
Cc: John David Anglin <dave.anglin <at> bell.net>
Cc: Aaro Koskinen <aaro.koskinen <at> iki.fi>
Cc: Graham Gower <graham.gower <at> gmail.com>
Cc: Domenico Andreoli <cavokz <at> gmail.com>
---
 arch/parisc/include/asm/pgalloc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h
index 55ad8be9b7f3..068b2fb9a47c 100644
--- a/arch/parisc/include/asm/pgalloc.h
+++ b/arch/parisc/include/asm/pgalloc.h
 <at>  <at>  -38,6 +38,7  <at>  <at>  static inline pgd_t *pgd_alloc(struct mm_struct *mm)
 		/* The first pmd entry also is marked with _PAGE_GATEWAY as
 		 * a signal that this pmd may not be freed */
 		__pgd_val_set(*pgd, PxD_FLAG_ATTACHED);
+		mm_inc_nr_pmds(mm);
 #endif
 	}
 	return actual_pgd;
--

-- 
2.1.4

--
(Continue reading)

Kirill A. Shutemov | 13 Mar 11:29 2015

Re: BUG: non-zero nr_pmds on freeing mm: -1

On Thu, Mar 12, 2015 at 08:41:37PM -0400, John David Anglin wrote:
> On 2015-03-12, at 6:07 PM, Kirill A. Shutemov wrote:
> 
> > There's hack in pgd_alloc() on parisc to initialize one pmd, which is not
> > accounted and we get underflow on exit. We need to adjust accounting for
> > that pmd.
> > 
> > Could you try the patch below?
> > 
> > diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h
> > index f213f5b4c423..8ee9a0bdc468 100644
> > --- a/arch/parisc/include/asm/pgalloc.h
> > +++ b/arch/parisc/include/asm/pgalloc.h
> >  <at>  <at>  -38,6 +38,7  <at>  <at>  static inline pgd_t *pgd_alloc(struct mm_struct *mm)
> > 		/* The first pmd entry also is marked with _PAGE_GATEWAY as
> > 		 * a signal that this pmd may not be freed */
> > 		__pgd_val_set(*pgd, PxD_FLAG_ATTACHED);
> > +		mm_inc_nr_pmds(mm);
> > #endif
> > 	}
> > 	return actual_pgd;
> 
> The patch fixes the BUG messages.
> 
> Helge, the #ifdef in pgd_alloc doesn't seem correct.  We only have a L2/L3 scheme when
> "defined(CONFIG_64BIT) && defined(CONFIG_PARISC_PAGE_SIZE_4KB)".

Looks like you're correct. But that's separate issue. Please, post a
patch.

(Continue reading)

pepa6.es@ono.com | 12 Mar 12:49 2015

(unknown)

Proposal,

Respond to my personal email;  mrs.zhangxiao1962 <at> outlook.
com 

Yours Sincerely.
Mrs. Zhang Xiao (Accounts book Keeper)
Angang 
Steel Company Limited
396 Nan Zhong Hua Lu, Tie Dong District Anshan, 
Liaoning 114021, China.

--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

John David Anglin | 11 Mar 15:14 2015
Picon

Re: BUG: non-zero nr_pmds on freeing mm: -1

On 2015-03-11 7:32 AM, Domenico Andreoli wrote:
> I also do. Related to https://lkml.org/lkml/2015/2/13/431?
More info is here:
http://www.spinics.net/lists/linux-mm/msg84937.html

There doesn't seem to be a patch yet.

Dave

--

-- 
John David Anglin  dave.anglin <at> bell.net

--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane