2017-03-14 14:56:43

by Stafford Horne

[permalink] [raw]
Subject: [PATCH 0/3] Openrisc fixes for 4.11

Hello,

These are a few compile error and warning fixes which were pointed out
after the 4.11 code was merged.

Most of these could be found at this kbuild failure here:

https://lkml.org/lkml/2017/3/9/976

The rest I found with some local testing.

Stafford Horne (3):
openrisc: xchg: fix `computed is not used` warning
openrisc: fix issue handling 8 byte get_user calls
openrisc: Export symbols needed by modules

arch/openrisc/include/asm/cmpxchg.h | 8 ++++++--
arch/openrisc/include/asm/uaccess.h | 2 +-
arch/openrisc/kernel/or32_ksyms.c | 5 +++++
arch/openrisc/kernel/process.c | 1 +
4 files changed, 13 insertions(+), 3 deletions(-)

--
2.9.3


2017-03-14 14:57:02

by Stafford Horne

[permalink] [raw]
Subject: [PATCH 2/3] openrisc: fix issue handling 8 byte get_user calls

Was getting the following error with allmodconfig:

ERROR: "__get_user_bad" [lib/test_user_copy.ko] undefined!

This was simply a missing break statement, causing an unwanted fall
through.

Signed-off-by: Stafford Horne <[email protected]>
---
arch/openrisc/include/asm/uaccess.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h
index 140faa1..1311e6b 100644
--- a/arch/openrisc/include/asm/uaccess.h
+++ b/arch/openrisc/include/asm/uaccess.h
@@ -211,7 +211,7 @@ do { \
case 1: __get_user_asm(x, ptr, retval, "l.lbz"); break; \
case 2: __get_user_asm(x, ptr, retval, "l.lhz"); break; \
case 4: __get_user_asm(x, ptr, retval, "l.lwz"); break; \
- case 8: __get_user_asm2(x, ptr, retval); \
+ case 8: __get_user_asm2(x, ptr, retval); break; \
default: (x) = __get_user_bad(); \
} \
} while (0)
--
2.9.3

2017-03-14 14:57:26

by Stafford Horne

[permalink] [raw]
Subject: [PATCH 3/3] openrisc: Export symbols needed by modules

This was detected by allmodconfig, errors reported:

ERROR: "empty_zero_page" [net/ceph/libceph.ko] undefined!
ERROR: "__ucmpdi2" [lib/842/842_decompress.ko] undefined!
ERROR: "empty_zero_page" [fs/nfs/objlayout/objlayoutdriver.ko] undefined!
ERROR: "empty_zero_page" [fs/exofs/exofs.ko] undefined!
ERROR: "empty_zero_page" [fs/crypto/fscrypto.ko] undefined!
ERROR: "__ucmpdi2" [fs/btrfs/btrfs.ko] undefined!
ERROR: "pm_power_off" [drivers/regulator/act8865-regulator.ko] undefined!

Signed-off-by: Stafford Horne <[email protected]>
---
arch/openrisc/kernel/or32_ksyms.c | 5 +++++
arch/openrisc/kernel/process.c | 1 +
2 files changed, 6 insertions(+)

diff --git a/arch/openrisc/kernel/or32_ksyms.c b/arch/openrisc/kernel/or32_ksyms.c
index 5c4695d..2842979 100644
--- a/arch/openrisc/kernel/or32_ksyms.c
+++ b/arch/openrisc/kernel/or32_ksyms.c
@@ -42,6 +42,11 @@ DECLARE_EXPORT(__muldi3);
DECLARE_EXPORT(__ashrdi3);
DECLARE_EXPORT(__ashldi3);
DECLARE_EXPORT(__lshrdi3);
+DECLARE_EXPORT(__ucmpdi2);
+
+extern unsigned long empty_zero_page[2048];
+EXPORT_SYMBOL(empty_zero_page);

EXPORT_SYMBOL(__copy_tofrom_user);
+EXPORT_SYMBOL(__clear_user);
EXPORT_SYMBOL(memset);
diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
index 828a291..f8da545 100644
--- a/arch/openrisc/kernel/process.c
+++ b/arch/openrisc/kernel/process.c
@@ -90,6 +90,7 @@ void arch_cpu_idle(void)
}

void (*pm_power_off) (void) = machine_power_off;
+EXPORT_SYMBOL(pm_power_off);

/*
* When a process does an "exec", machine state like FPU and debug
--
2.9.3

2017-03-14 15:00:23

by Stafford Horne

[permalink] [raw]
Subject: [PATCH 1/3] openrisc: xchg: fix `computed is not used` warning

When building allmodconfig this warning shows.

fs/ocfs2/file.c: In function 'ocfs2_file_write_iter':
./arch/openrisc/include/asm/cmpxchg.h:81:3: warning: value computed is
not used [-Wunused-value]
((typeof(*(ptr)))__xchg((unsigned long)(with), (ptr), sizeof(*(ptr))))
^

Applying the same patch logic that was done to the cmpxchg macro.

Signed-off-by: Stafford Horne <[email protected]>
---
arch/openrisc/include/asm/cmpxchg.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/openrisc/include/asm/cmpxchg.h b/arch/openrisc/include/asm/cmpxchg.h
index 5fcb9ac..f0a5d8b 100644
--- a/arch/openrisc/include/asm/cmpxchg.h
+++ b/arch/openrisc/include/asm/cmpxchg.h
@@ -77,7 +77,11 @@ static inline unsigned long __xchg(unsigned long val, volatile void *ptr,
return val;
}

-#define xchg(ptr, with) \
- ((typeof(*(ptr)))__xchg((unsigned long)(with), (ptr), sizeof(*(ptr))))
+#define xchg(ptr, with) \
+ ({ \
+ (__typeof__(*(ptr))) __xchg((unsigned long)(with), \
+ (ptr), \
+ sizeof(*(ptr))); \
+ })

#endif /* __ASM_OPENRISC_CMPXCHG_H */
--
2.9.3

2017-03-14 15:25:54

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [OpenRISC] [PATCH 3/3] openrisc: Export symbols needed by modules

Hi Stafford,

On Tue, Mar 14, 2017 at 3:56 PM, Stafford Horne <[email protected]> wrote:
> This was detected by allmodconfig, errors reported:
>
> ERROR: "empty_zero_page" [net/ceph/libceph.ko] undefined!
> ERROR: "__ucmpdi2" [lib/842/842_decompress.ko] undefined!
> ERROR: "empty_zero_page" [fs/nfs/objlayout/objlayoutdriver.ko] undefined!
> ERROR: "empty_zero_page" [fs/exofs/exofs.ko] undefined!
> ERROR: "empty_zero_page" [fs/crypto/fscrypto.ko] undefined!
> ERROR: "__ucmpdi2" [fs/btrfs/btrfs.ko] undefined!
> ERROR: "pm_power_off" [drivers/regulator/act8865-regulator.ko] undefined!
>
> Signed-off-by: Stafford Horne <[email protected]>

> --- a/arch/openrisc/kernel/or32_ksyms.c
> +++ b/arch/openrisc/kernel/or32_ksyms.c
> @@ -42,6 +42,11 @@ DECLARE_EXPORT(__muldi3);
> DECLARE_EXPORT(__ashrdi3);
> DECLARE_EXPORT(__ashldi3);
> DECLARE_EXPORT(__lshrdi3);
> +DECLARE_EXPORT(__ucmpdi2);
> +
> +extern unsigned long empty_zero_page[2048];

Can't you #include <asm/pgtable.h> instead of adding a forward
declaration?

> +EXPORT_SYMBOL(empty_zero_page);

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2017-03-14 22:17:07

by Stafford Horne

[permalink] [raw]
Subject: Re: [OpenRISC] [PATCH 3/3] openrisc: Export symbols needed by modules

On Tue, Mar 14, 2017 at 04:25:30PM +0100, Geert Uytterhoeven wrote:
> Hi Stafford,
>
> On Tue, Mar 14, 2017 at 3:56 PM, Stafford Horne <[email protected]> wrote:
> > This was detected by allmodconfig, errors reported:
> >
> > ERROR: "empty_zero_page" [net/ceph/libceph.ko] undefined!
> > ERROR: "__ucmpdi2" [lib/842/842_decompress.ko] undefined!
> > ERROR: "empty_zero_page" [fs/nfs/objlayout/objlayoutdriver.ko] undefined!
> > ERROR: "empty_zero_page" [fs/exofs/exofs.ko] undefined!
> > ERROR: "empty_zero_page" [fs/crypto/fscrypto.ko] undefined!
> > ERROR: "__ucmpdi2" [fs/btrfs/btrfs.ko] undefined!
> > ERROR: "pm_power_off" [drivers/regulator/act8865-regulator.ko] undefined!
> >
> > Signed-off-by: Stafford Horne <[email protected]>
>
> > --- a/arch/openrisc/kernel/or32_ksyms.c
> > +++ b/arch/openrisc/kernel/or32_ksyms.c
> > @@ -42,6 +42,11 @@ DECLARE_EXPORT(__muldi3);
> > DECLARE_EXPORT(__ashrdi3);
> > DECLARE_EXPORT(__ashldi3);
> > DECLARE_EXPORT(__lshrdi3);
> > +DECLARE_EXPORT(__ucmpdi2);
> > +
> > +extern unsigned long empty_zero_page[2048];
>
> Can't you #include <asm/pgtable.h> instead of adding a forward
> declaration?

Right, I can do this.

In the end I was hoping to convert empty_zero_page to be more like
parisc. which would put something like this mm/init.c

unsigned long *empty_zero_page __read_mostly;
EXPORT_SYMBOL(empty_zero_page);

in init {
empty_zero_page = get_memblock(PAGE_SIZE);
}

But I was going to wait until 4.12 for that change.

-Stafford

> > +EXPORT_SYMBOL(empty_zero_page);
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds