* Re: powerpc: use time64_t in read_persistent_clock
From: Arnd Bergmann @ 2018-06-18 13:38 UTC (permalink / raw)
To: Mathieu Malaterre
Cc: Benjamin Herrenschmidt, Michael Ellerman, linuxppc-dev,
Meelis Roos
In-Reply-To: <CA+7wUsyy7tC7k1FT-ZpS=wW_NQ=PnYjTj0R-hbHuFY5m+55+RQ@mail.gmail.com>
On Thu, Jun 14, 2018 at 9:03 PM, Mathieu Malaterre <malat@debian.org> wrote:
> On Thu, Jun 14, 2018 at 1:46 PM Arnd Bergmann <arnd@arndb.de> wrote:
>> On Wed, Jun 13, 2018 at 10:24 PM, Mathieu Malaterre <malat@debian.org> wrote:
>
>> Can you confirm that this patch addresses your problem?
>
> Yes !
>
> Before:
> [ 5.986710] rtc-generic rtc-generic: hctosys: unable to read the
> hardware clock
>
> After:
> [ 5.579611] rtc-generic rtc-generic: setting system clock to
> 2018-06-14 18:57:00 UTC (1529002620)
>
> So for the above:
>
> Tested-by: Mathieu Malaterre <malat@debian.org>
Thanks a lot!
>> --- a/arch/powerpc/platforms/powermac/time.c
>> +++ b/arch/powerpc/platforms/powermac/time.c
>> @@ -88,7 +88,7 @@ long __init pmac_time_init(void)
>> static time64_t cuda_get_time(void)
>> {
>> struct adb_request req;
>> - time64_t now;
>> + u32 now;
>>
>> if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0)
>> return 0;
>> @@ -132,7 +132,7 @@ static int cuda_set_rtc_time(struct rtc_time *tm)
>> static time64_t pmu_get_time(void)
>> {
>> struct adb_request req;
>> - time64_t now;
>> + u32 now;
>>
>> if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0)
>> return 0;
>>
>> On the upside, this would possibly extend the life of some machines
>> by another 66 years, on the downside it might cause issues when
>> an empty RTC battery causes the initial system time to be
>> above the 32-bit TIME_T_MAX (instead of going back to 1904).
>
> I would submit the first patch and add the above as comment. I doubt
> anyone would still have a running system by then.
I was about to send a similar patch to the first one for m68k macs, which have
basically the same code. My patch had the same bug, so I'm glad I had
not sent it yet, but I also noticed that I made the opposite decision on m68k
as that code had already been using 'unsigned long' in the conversion (but
then of course would wrap it during the conversion to 'time_t). I've picked
the same approach for both now, using the 1904..2040 range.
Arnd
^ permalink raw reply
* Re: [PATCH 0/3] Resolve -Wattribute-alias warnings from SYSCALL_DEFINEx()
From: Arnd Bergmann @ 2018-06-18 13:05 UTC (permalink / raw)
To: Paul Burton
Cc: Linux Kbuild mailing list, Mauro Carvalho Chehab,
open list:RALINK MIPS ARCHITECTURE, Ingo Molnar, Matthew Wilcox,
Thomas Gleixner, Douglas Anderson, Josh Poimboeuf, Andrew Morton,
Matthias Kaehlcke, He Zhe, Benjamin Herrenschmidt, Michal Marek,
Khem Raj, Christophe Leroy, Al Viro, Stafford Horne,
Gideon Israel Dsouza, Masahiro Yamada, Kees Cook,
Michael Ellerman, Heiko Carstens, Linux Kernel Mailing List,
Paul Mackerras, linuxppc-dev
In-Reply-To: <20180616005323.7938-1-paul.burton@mips.com>
On Sat, Jun 16, 2018 at 2:53 AM, Paul Burton <paul.burton@mips.com> wrote:
> This series introduces infrastructure allowing compiler diagnostics to
> be disabled or their severity modified for specific pieces of code, with
> suitable abstractions to prevent that code from becoming tied to a
> specific compiler.
>
> This infrastructure is then used to disable the -Wattribute-alias
> warning around syscall definitions, which rely on type mismatches to
> sanitize arguments.
>
> Finally PowerPC-specific #pragma's are removed now that the generic code
> is handling this.
>
> The series takes Arnd's RFC patches & addresses the review comments they
> received. The most notable effect of this series to to avoid warnings &
> build failures caused by -Wattribute-alias when compiling the kernel
> with GCC 8.
>
> Applies cleanly atop master as of 9215310cf13b ("Merge
> git://git.kernel.org/pub/scm/linux/kernel/git/davem/net").
>
Sorry I dropped the ball on this earlier, and thanks a lot for picking
it up again! From what I can tell, your version addresses all issues
I was aware of, so we should merge that.
Arnd
^ permalink raw reply
* [PATCH] powerpc/fsl: Sanitize the syscall table for NXP PowerPC 32 bit platforms
From: Diana Craciun @ 2018-06-18 12:17 UTC (permalink / raw)
To: linuxppc-dev; +Cc: mpe, oss, leoyang.li, bharat.bhushan, Diana Craciun
Used barrier_nospec to sanitize the syscall table.
Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
---
arch/powerpc/kernel/entry_32.S | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index eb8d01b..e3ff9ace 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -33,6 +33,7 @@
#include <asm/unistd.h>
#include <asm/ptrace.h>
#include <asm/export.h>
+#include <asm/barrier.h>
/*
* MSR_KERNEL is > 0x10000 on 4xx/Book-E since it include MSR_CE.
@@ -358,6 +359,15 @@ syscall_dotrace_cont:
ori r10,r10,sys_call_table@l
slwi r0,r0,2
bge- 66f
+
+ barrier_nospec_asm
+ /*
+ * Prevent the load of the handler below (based on the user-passed
+ * system call number) being speculatively executed until the test
+ * against NR_syscalls and branch to .66f above has
+ * committed.
+ */
+
lwzx r10,r10,r0 /* Fetch system call handler [ptr] */
mtlr r10
addi r9,r1,STACK_FRAME_OVERHEAD
--
2.5.5
^ permalink raw reply related
* [PATCH] ocxl: Fix page fault handler in case of fault on dying process
From: Frederic Barrat @ 2018-06-18 12:14 UTC (permalink / raw)
To: andrew.donnellan, alastair, linuxppc-dev; +Cc: clombard, vaibhav
If a process exits without doing proper cleanup, there's a window
where an opencapi device can try to access the memory of the dying
process and may trigger a page fault. That's an expected scenario and
the ocxl driver holds a reference on the mm_struct of the process
until the opencapi device is notified of the process exiting.
However, if mm_users is already at 0, i.e. the address space of the
process has already been destroyed, the driver shouldn't try resolving
the page fault, as it will fail, but it can also try accessing already
freed data.
It is fixed by only calling the bottom half of the page fault handler
if mm_users is greater than 0 and get a reference on mm_users instead
of mm_count. Otherwise, we can safely return a translation fault to
the device, as its associated memory context is being removed. The
opencapi device will be properly cleaned up shortly after when closing
the file descriptors.
Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices")
Cc: stable@vger.kernel.org # v4.16+
Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
---
drivers/misc/ocxl/link.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/misc/ocxl/link.c b/drivers/misc/ocxl/link.c
index f30790582dc0..2aeaf34e7eda 100644
--- a/drivers/misc/ocxl/link.c
+++ b/drivers/misc/ocxl/link.c
@@ -136,7 +136,7 @@ static void xsl_fault_handler_bh(struct work_struct *fault_work)
int rc;
/*
- * We need to release a reference on the mm whenever exiting this
+ * We must release a reference on mm_users whenever exiting this
* function (taken in the memory fault interrupt handler)
*/
rc = copro_handle_mm_fault(fault->pe_data.mm, fault->dar, fault->dsisr,
@@ -172,7 +172,7 @@ static void xsl_fault_handler_bh(struct work_struct *fault_work)
}
r = RESTART;
ack:
- mmdrop(fault->pe_data.mm);
+ mmput(fault->pe_data.mm);
ack_irq(spa, r);
}
@@ -184,6 +184,7 @@ static irqreturn_t xsl_fault_handler(int irq, void *data)
struct pe_data *pe_data;
struct ocxl_process_element *pe;
int lpid, pid, tid;
+ bool schedule = false;
read_irq(spa, &dsisr, &dar, &pe_handle);
trace_ocxl_fault(spa->spa_mem, pe_handle, dsisr, dar, -1);
@@ -226,14 +227,19 @@ static irqreturn_t xsl_fault_handler(int irq, void *data)
}
WARN_ON(pe_data->mm->context.id != pid);
- spa->xsl_fault.pe = pe_handle;
- spa->xsl_fault.dar = dar;
- spa->xsl_fault.dsisr = dsisr;
- spa->xsl_fault.pe_data = *pe_data;
- mmgrab(pe_data->mm); /* mm count is released by bottom half */
-
+ if (mmget_not_zero(pe_data->mm)) {
+ spa->xsl_fault.pe = pe_handle;
+ spa->xsl_fault.dar = dar;
+ spa->xsl_fault.dsisr = dsisr;
+ spa->xsl_fault.pe_data = *pe_data;
+ schedule = true;
+ /* mm_users count released by bottom half */
+ }
rcu_read_unlock();
- schedule_work(&spa->xsl_fault.fault_work);
+ if (schedule)
+ schedule_work(&spa->xsl_fault.fault_work);
+ else
+ ack_irq(spa, ADDRESS_ERROR);
return IRQ_HANDLED;
}
--
2.17.1
^ permalink raw reply related
* [PATCH] powerpc: xmon: use ktime_get_coarse_boottime64
From: Arnd Bergmann @ 2018-06-18 9:56 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: y2038, Arnd Bergmann, Balbir Singh, Nicholas Piggin, Vaibhav Jain,
linuxppc-dev, linux-kernel
get_monotonic_boottime() is deprecated, and may not be safe to call in
every context, as it has to read a hardware clocksource.
This changes xmon to print the time using ktime_get_coarse_boottime64()
instead, which avoids the old timespec type and the HW access.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/powerpc/xmon/xmon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 47166ad2a669..45e3d0ec1246 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -918,13 +918,13 @@ static void remove_cpu_bpts(void)
static void
show_uptime(void)
{
- struct timespec uptime;
+ struct timespec64 uptime;
if (setjmp(bus_error_jmp) == 0) {
catch_memory_errors = 1;
sync();
- get_monotonic_boottime(&uptime);
+ ktime_get_coarse_boottime_ts64(&uptime);
printf("Uptime: %lu.%.2lu seconds\n", (unsigned long)uptime.tv_sec,
((unsigned long)uptime.tv_nsec / (NSEC_PER_SEC/100)));
--
2.9.0
^ permalink raw reply related
* Re: Build regressions/improvements in v4.18-rc1
From: Geert Uytterhoeven @ 2018-06-18 9:28 UTC (permalink / raw)
To: Linux Kernel Mailing List
Cc: Andrew Morton, sparclinux, linux-ia64, Linux MIPS Mailing List,
linuxppc-dev, Linux-sh list
In-Reply-To: <20180618091729.11091-1-geert@linux-m68k.org>
On Mon, Jun 18, 2018 at 11:18 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> Below is the list of build error/warning regressions/improvements in
> v4.18-rc1[1] compared to v4.17[2].
>
> Summarized:
> - build errors: +11/-1
> [1] http://kisskb.ellerman.id.au/kisskb/head/ce397d215ccd07b8ae3f71db689a=
edb85d56ab40/ (233 out of 244 configs)
> [2] http://kisskb.ellerman.id.au/kisskb/head/29dcea88779c856c7dc92040a0c0=
1233263101d4/ (all 244 configs)
> 11 error regressions:
> + /kisskb/src/drivers/ata/pata_ali.c: error: implicit declaration of fu=
nction 'pci_domain_nr' [-Werror=3Dimplicit-function-declaration]: =3D> 469=
:38
sparc64/sparc-allmodconfig
> + /kisskb/src/mm/memblock.c: error: redefinition of 'memblock_virt_allo=
c_try_nid': =3D> 1413:15
> + /kisskb/src/mm/memblock.c: error: redefinition of 'memblock_virt_allo=
c_try_nid_nopanic': =3D> 1377:15
> + /kisskb/src/mm/memblock.c: error: redefinition of 'memblock_virt_allo=
c_try_nid_raw': =3D> 1340:15
ia64/ia64-defconfig
mips/bigsur_defconfig
mips/cavium_octeon_defconfig
mips/ip22_defconfig
mips/ip27_defconfig
mips/ip32_defconfig
mips/malta_defconfig
mips/mips-allmodconfig
mips/mips-allnoconfig
mips/mips-defconfig
mipsel/mips-allmodconfig
mipsel/mips-allnoconfig
mipsel/mips-defconfig
> + error: ".radix__flush_pwc_lpid" [arch/powerpc/kvm/kvm-hv.ko] undefine=
d!: =3D> N/A
> + error: ".radix__flush_tlb_lpid_page" [arch/powerpc/kvm/kvm-hv.ko] und=
efined!: =3D> N/A
> + error: ".radix__local_flush_tlb_lpid_guest" [arch/powerpc/kvm/kvm-hv.=
ko] undefined!: =3D> N/A
> + error: "radix__flush_pwc_lpid" [arch/powerpc/kvm/kvm-hv.ko] undefined=
!: =3D> N/A
> + error: "radix__flush_tlb_lpid_page" [arch/powerpc/kvm/kvm-hv.ko] unde=
fined!: =3D> N/A
> + error: "radix__local_flush_tlb_lpid_guest" [arch/powerpc/kvm/kvm-hv.k=
o] undefined!: =3D> N/A
powerpc/ppc64_defconfig+NO_RADIX
ppc64le/powernv_defconfig+NO_RADIX (what's in a name ;-)
> + {standard input}: Error: offset to unaligned destination: =3D> 2268,=
2316, 1691, 1362, 1455, 1598, 2502, 1645, 1988, 1927, 1409, 2615, 1548, 24=
09, 1268, 2363, 1314, 1208, 1785, 2034, 2222, 2661, 1880, 2552, 1161, 2082,=
1833, 2455, 2176, 2129, 1501, 1738
sh4/sh-randconfig (doesn't seem to be a new issue, seen before on v4.12-rc3=
)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k=
.org
In personal conversations with technical people, I call myself a hacker. Bu=
t
when I'm talking to journalists I just say "programmer" or something like t=
hat.
-- Linus Torvalds
^ permalink raw reply
* Constant ata messages on console with commit 28361c403683 ("libata: add extra internal command") (was Re: [GIT PULL 2/2] libata changes for v4.18-rc1)
From: Michael Ellerman @ 2018-06-18 7:33 UTC (permalink / raw)
To: Tejun Heo, Jens Axboe
Cc: linux-kernel, linux-ide, Linus Torvalds, linuxppc-dev
In-Reply-To: <20180605191525.GF1351649@devbig577.frc2.facebook.com>
Tejun Heo <tj@kernel.org> writes:
...
> Jens Axboe (10):
> libata: introduce notion of separate hardware tags
> libata: convert core and drivers to ->hw_tag usage
> libata: bump ->qc_active to a 64-bit type
> libata: use ata_tag_internal() consistently
> libata: remove assumption that ATA_MAX_QUEUE - 1 is the max
> sata_nv: set host can_queue count appropriately
> libata: add extra internal command
Replying here because I can't find the original mail.
The above commit is causing one of my machines to constantly spew ata
messages on the console, according to bisect:
# first bad commit: [28361c403683c2b00d4f5e76045f3ccd299bf99d] libata: add extra internal command
To get it to boot I have to also apply:
88e10092f6a6 ("sata_fsl: use the right type for tag bitshift")
The system boots OK and seems fine, except that it's just printing
multiple of these per second:
ata2: Signature Update detected @ 0 msecs
ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata2.00: configured for UDMA/100
ata2: Signature Update detected @ 0 msecs
ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata2.00: configured for UDMA/100
ata2: Signature Update detected @ 0 msecs
ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata2.00: configured for UDMA/100
ata2: Signature Update detected @ 0 msecs
ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata2.00: configured for UDMA/100
ata2: Signature Update detected @ 0 msecs
And it never seems to stop.
The machine is a Freescale/NXP P5020ds, using the sata_fsl driver
presumably. Any ideas?
cheers
^ permalink raw reply
* Re: [PATCH v2] powerpc/cell: fix build failure by disabling attribute-alias warning
From: Christophe LEROY @ 2018-06-18 7:20 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, arnd
Cc: linuxppc-dev, linux-kernel, Paul Burton
In-Reply-To: <dec3cf2521a8e5dfc78953363b1f55aaa261a052.1527609833.git.christophe.leroy@c-s.fr>
Le 29/05/2018 à 18:06, Christophe Leroy a écrit :
> Latest GCC version emit the following warnings
>
> As arch/powerpc code is built with -Werror, this breaks build with
> GCC 8.1
>
> This patch inhibits those warnings
>
> CC arch/powerpc/platforms/cell/spu_syscalls.o
> In file included from arch/powerpc/platforms/cell/spu_syscalls.c:26:
> ./include/linux/syscalls.h:233:18: error: 'sys_spu_create' alias between functions of incompatible types 'long int(const char *, unsigned int, umode_t, int)' {aka 'long int(const char *, unsigned int, short unsigned int, int)'} and 'long int(long int, long int, long int, long int)' [-Werror=attribute-alias]
> asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
> ^~~
> ./include/linux/syscalls.h:222:2: note: in expansion of macro '__SYSCALL_DEFINEx'
> __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
> ^~~~~~~~~~~~~~~~~
> ./include/linux/syscalls.h:214:36: note: in expansion of macro 'SYSCALL_DEFINEx'
> #define SYSCALL_DEFINE4(name, ...) SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
> ^~~~~~~~~~~~~~~
> arch/powerpc/platforms/cell/spu_syscalls.c:70:1: note: in expansion of macro 'SYSCALL_DEFINE4'
> SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
> ^~~~~~~~~~~~~~~
> ./include/linux/syscalls.h:238:18: note: aliased declaration here
> asmlinkage long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
> ^~~~~~~~
> ./include/linux/syscalls.h:222:2: note: in expansion of macro '__SYSCALL_DEFINEx'
> __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
> ^~~~~~~~~~~~~~~~~
> ./include/linux/syscalls.h:214:36: note: in expansion of macro 'SYSCALL_DEFINEx'
> #define SYSCALL_DEFINE4(name, ...) SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
> ^~~~~~~~~~~~~~~
> arch/powerpc/platforms/cell/spu_syscalls.c:70:1: note: in expansion of macro 'SYSCALL_DEFINE4'
> SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
> ^~~~~~~~~~~~~~~
> ./include/linux/syscalls.h:233:18: error: 'sys_spu_run' alias between functions of incompatible types 'long int(int, __u32 *, __u32 *)' {aka 'long int(int, unsigned int *, unsigned int *)'} and 'long int(long int, long int, long int)' [-Werror=attribute-alias]
> asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
> ^~~
> ./include/linux/syscalls.h:222:2: note: in expansion of macro '__SYSCALL_DEFINEx'
> __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
> ^~~~~~~~~~~~~~~~~
> ./include/linux/syscalls.h:213:36: note: in expansion of macro 'SYSCALL_DEFINEx'
> #define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
> ^~~~~~~~~~~~~~~
> arch/powerpc/platforms/cell/spu_syscalls.c:94:1: note: in expansion of macro 'SYSCALL_DEFINE3'
> SYSCALL_DEFINE3(spu_run,int, fd, __u32 __user *, unpc, __u32 __user *, ustatus)
> ^~~~~~~~~~~~~~~
> ./include/linux/syscalls.h:238:18: note: aliased declaration here
> asmlinkage long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
> ^~~~~~~~
> ./include/linux/syscalls.h:222:2: note: in expansion of macro '__SYSCALL_DEFINEx'
> __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
> ^~~~~~~~~~~~~~~~~
> ./include/linux/syscalls.h:213:36: note: in expansion of macro 'SYSCALL_DEFINEx'
> #define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
> ^~~~~~~~~~~~~~~
> arch/powerpc/platforms/cell/spu_syscalls.c:94:1: note: in expansion of macro 'SYSCALL_DEFINE3'
> SYSCALL_DEFINE3(spu_run,int, fd, __u32 __user *, unpc, __u32 __user *, ustatus)
> ^~~~~~~~~~~~~~~
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
If the serie from Paul Burton
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=50442
goes in, this patch won't be necessary.
Christophe
> ---
> v2: added '#pragma GCC diagnostic ignored "-Wpragmas"' to avoid build failure on old GCC
>
> arch/powerpc/platforms/cell/spu_syscalls.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
> index 263413a34823..7862279a82e4 100644
> --- a/arch/powerpc/platforms/cell/spu_syscalls.c
> +++ b/arch/powerpc/platforms/cell/spu_syscalls.c
> @@ -67,6 +67,9 @@ static inline void spufs_calls_put(struct spufs_calls *calls) { }
>
> #endif /* CONFIG_SPU_FS_MODULE */
>
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Wpragmas"
> +#pragma GCC diagnostic ignored "-Wattribute-alias"
> SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
> umode_t, mode, int, neighbor_fd)
> {
> @@ -111,6 +114,7 @@ SYSCALL_DEFINE3(spu_run,int, fd, __u32 __user *, unpc, __u32 __user *, ustatus)
> spufs_calls_put(calls);
> return ret;
> }
> +#pragma GCC diagnostic pop
>
> #ifdef CONFIG_COREDUMP
> int elf_coredump_extra_notes_size(void)
>
^ permalink raw reply
* Re: [PATCH kernel 2/2] powerpc/powernv: Define PHB4 type and enable sketchy bypass on POWER9
From: Alexey Kardashevskiy @ 2018-06-18 7:20 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Alistair Popple, Russell Currey
In-Reply-To: <82ebaedf4279dce05a7cd6bdb0d9b84bdf232a02.camel@kernel.crashing.org>
On Mon, 18 Jun 2018 14:44:56 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Mon, 2018-06-18 at 12:13 +1000, Alexey Kardashevskiy wrote:
> > On Sat, 16 Jun 2018 11:05:19 +1000
> > Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> >
> > > On Fri, 2018-06-01 at 18:10 +1000, Alexey Kardashevskiy wrote:
> > > > These are found in POWER9 chips. Right now these PHBs have unknown type
> > > > so changing it to PHB4 won't make much of a difference except enabling
> > > > sketchy bypass for POWER9 as this does below.
> > >
> > > And that will break on multi-chip systems since P9 doesn't have the
> > > memory contiguous (it has the chip ID in the top bits).
> >
> >
> > This did not break mine and it is hard to see why it would break at all
> > if we use 1G pages and the maximum we need to cover is 48 bits (this
> > is what we are trying to support here - all these gpus, right?), or is
> > it more now? If so, I have posted v2 of tce multilevel dynamic
> > allocation which helps with enormous tce tables.
>
> The whole point of sketchy bypass is to deal with devices with small
> amount of DMA bits... most Radeon's have 40 for example. So that won't
> work terribly well.
40 with 1GB pages needs 40-30=10 bits i.e. (1<<10)*8 = 8KB for the
entire TCE table. I am definitely missing something here, what is it?
>
> Cheers,
> Ben.
>
> >
> >
> > >
> > > Russell is working on a different implementation that should be much
> > > more imune to the system physical memory layout.
> > >
> > > > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > > > ---
> > > > arch/powerpc/platforms/powernv/pci.h | 1 +
> > > > arch/powerpc/platforms/powernv/pci-ioda.c | 5 ++++-
> > > > 2 files changed, 5 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
> > > > index eada4b6..1408247 100644
> > > > --- a/arch/powerpc/platforms/powernv/pci.h
> > > > +++ b/arch/powerpc/platforms/powernv/pci.h
> > > > @@ -23,6 +23,7 @@ enum pnv_phb_model {
> > > > PNV_PHB_MODEL_UNKNOWN,
> > > > PNV_PHB_MODEL_P7IOC,
> > > > PNV_PHB_MODEL_PHB3,
> > > > + PNV_PHB_MODEL_PHB4,
> > > > PNV_PHB_MODEL_NPU,
> > > > PNV_PHB_MODEL_NPU2,
> > > > };
> > > > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> > > > index 9239142..66c2804 100644
> > > > --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> > > > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> > > > @@ -1882,7 +1882,8 @@ static int pnv_pci_ioda_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
> > > > if (dma_mask >> 32 &&
> > > > dma_mask > (memory_hotplug_max() + (1ULL << 32)) &&
> > > > pnv_pci_ioda_pe_single_vendor(pe) &&
> > > > - phb->model == PNV_PHB_MODEL_PHB3) {
> > > > + (phb->model == PNV_PHB_MODEL_PHB3 ||
> > > > + phb->model == PNV_PHB_MODEL_PHB4)) {
> > > > /* Configure the bypass mode */
> > > > rc = pnv_pci_ioda_dma_64bit_bypass(pe);
> > > > if (rc)
> > > > @@ -3930,6 +3931,8 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
> > > > phb->model = PNV_PHB_MODEL_P7IOC;
> > > > else if (of_device_is_compatible(np, "ibm,power8-pciex"))
> > > > phb->model = PNV_PHB_MODEL_PHB3;
> > > > + else if (of_device_is_compatible(np, "ibm,power9-pciex"))
> > > > + phb->model = PNV_PHB_MODEL_PHB4;
> > > > else if (of_device_is_compatible(np, "ibm,power8-npu-pciex"))
> > > > phb->model = PNV_PHB_MODEL_NPU;
> > > > else if (of_device_is_compatible(np, "ibm,power9-npu-pciex"))
> >
> >
> >
> > --
> > Alexey
--
Alexey
^ permalink raw reply
* Re: [PATCH] powerpc/eeh: Avoid misleading message "EEH: no capable adapters found"
From: Venkat Rao B @ 2018-06-18 7:17 UTC (permalink / raw)
To: Russell Currey, Mauro S. M. Rodrigues, linuxppc-dev, benh, paulus,
mpe
Cc: kernel
In-Reply-To: <1524789288.2096.0.camel@russell.cc>
On Friday 27 April 2018 06:04 AM, Russell Currey wrote:
> On Thu, 2018-03-22 at 23:10 -0300, Mauro S. M. Rodrigues wrote:
>> Due to recent refactoring in EEH in:
>> commit b9fde58db7e5 ("powerpc/powernv: Rework EEH initialization on
>> powernv")
>> a misleading message was seen in the kernel message buffer:
>>
>> [ 0.108431] EEH: PowerNV platform initialized
>> [ 0.589979] EEH: No capable adapters found
>>
>> This happened due to the removal of the initialization delay for
>> powernv
>> platform.
>>
>> Even though the EEH infrastructure for the devices is eventually
>> initialized and still works just fine the eeh device probe step is
>> postponed in order to assure the PEs are created. Later
>> pnv_eeh_post_init does the probe devices job but at that point the
>> message was already shown right after eeh_init flow.
>>
>> This patch introduces a new flag EEH_POSTPONED_PROBE to represent
>> that
>> temporary state and avoid the message mentioned above and showing the
>> follow one instead:
>>
>> [ 0.107724] EEH: PowerNV platform initialized
>> [ 4.844825] EEH: PCI Enhanced I/O Error Handling Enabled
>>
>> Signed-off-by: Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com>
>
> Good idea, thanks for the patch.
>
> Acked-by: Russell Currey <ruscur@russell.cc>
>
Hi Mauro,
I got a chance to test your patch, I applied your patch on top of
mainline kernel commit:8efcf34a263965e471e3999904f94d1f6799d42a and
booted and I don't see the message "No capable adapters found" instead I
see "EEH: PCI Enhanced I/O Error Handling Enabled" as desired. But I
have not injected any EEH.Hope this should qualify your patch.
Tested-by:Venkat Rao B <vrbagal1@linux.vnet.ibm.com>
Regards,
Venkat.
^ permalink raw reply
* Re: [PATCH 3/3] Revert "powerpc: fix build failure by disabling attribute-alias warning in pci_32"
From: Christophe LEROY @ 2018-06-18 7:01 UTC (permalink / raw)
To: Paul Burton, linux-kbuild
Cc: Mauro Carvalho Chehab, linux-mips, Arnd Bergmann, Ingo Molnar,
Matthew Wilcox, Thomas Gleixner, Douglas Anderson, Josh Poimboeuf,
Andrew Morton, Matthias Kaehlcke, He Zhe, Benjamin Herrenschmidt,
Michal Marek, Khem Raj, Al Viro, Stafford Horne,
Gideon Israel Dsouza, Masahiro Yamada, Kees Cook,
Michael Ellerman, Heiko Carstens, linux-kernel, Paul Mackerras,
linuxppc-dev
In-Reply-To: <20180616005323.7938-4-paul.burton@mips.com>
Le 16/06/2018 à 02:53, Paul Burton a écrit :
> With SYSCALL_DEFINEx() disabling -Wattribute-alias generically, there's
> no need to duplicate that for PowerPC's pciconfig_iobase syscall.
>
> This reverts commit 415520373975 ("powerpc: fix build failure by
> disabling attribute-alias warning in pci_32").
>
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Cc: Michal Marek <michal.lkml@markovi.net>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Matthew Wilcox <matthew@wil.cx>
> Cc: Matthias Kaehlcke <mka@chromium.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Gideon Israel Dsouza <gidisrael@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@c-s.fr>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Stafford Horne <shorne@gmail.com>
> Cc: Khem Raj <raj.khem@gmail.com>
> Cc: He Zhe <zhe.he@windriver.com>
> Cc: linux-kbuild@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: linuxppc-dev@lists.ozlabs.org
Acked-by: Christophe Leroy <christophe.leroy@c-s.fr>
>
> ---
>
> arch/powerpc/kernel/pci_32.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
> index 4f861055a852..d63b488d34d7 100644
> --- a/arch/powerpc/kernel/pci_32.c
> +++ b/arch/powerpc/kernel/pci_32.c
> @@ -285,9 +285,6 @@ pci_bus_to_hose(int bus)
> * Note that the returned IO or memory base is a physical address
> */
>
> -#pragma GCC diagnostic push
> -#pragma GCC diagnostic ignored "-Wpragmas"
> -#pragma GCC diagnostic ignored "-Wattribute-alias"
> SYSCALL_DEFINE3(pciconfig_iobase, long, which,
> unsigned long, bus, unsigned long, devfn)
> {
> @@ -313,4 +310,3 @@ SYSCALL_DEFINE3(pciconfig_iobase, long, which,
>
> return result;
> }
> -#pragma GCC diagnostic pop
>
^ permalink raw reply
* Re: [PATCH 2/3] disable -Wattribute-alias warning for SYSCALL_DEFINEx()
From: Christophe LEROY @ 2018-06-18 7:01 UTC (permalink / raw)
To: Paul Burton, linux-kbuild
Cc: Mauro Carvalho Chehab, linux-mips, Arnd Bergmann, Ingo Molnar,
Matthew Wilcox, Thomas Gleixner, Douglas Anderson, Josh Poimboeuf,
Andrew Morton, Matthias Kaehlcke, He Zhe, Benjamin Herrenschmidt,
Michal Marek, Khem Raj, Al Viro, Stafford Horne,
Gideon Israel Dsouza, Masahiro Yamada, Kees Cook,
Michael Ellerman, Heiko Carstens, linux-kernel, Paul Mackerras,
linuxppc-dev
In-Reply-To: <20180616005323.7938-3-paul.burton@mips.com>
Le 16/06/2018 à 02:53, Paul Burton a écrit :
> From: Arnd Bergmann <arnd@arndb.de>
>
> gcc-8 warns for every single definition of a system call entry
> point, e.g.:
>
> include/linux/compat.h:56:18: error: 'compat_sys_rt_sigprocmask' alias between functions of incompatible types 'long int(int, compat_sigset_t *, compat_sigset_t *, compat_size_t)' {aka 'long int(int, struct <anonymous> *, struct <anonymous> *, unsigned int)'} and 'long int(long int, long int, long int, long int)' [-Werror=attribute-alias]
> asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\
> ^~~~~~~~~~
> include/linux/compat.h:45:2: note: in expansion of macro 'COMPAT_SYSCALL_DEFINEx'
> COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
> ^~~~~~~~~~~~~~~~~~~~~~
> kernel/signal.c:2601:1: note: in expansion of macro 'COMPAT_SYSCALL_DEFINE4'
> COMPAT_SYSCALL_DEFINE4(rt_sigprocmask, int, how, compat_sigset_t __user *, nset,
> ^~~~~~~~~~~~~~~~~~~~~~
> include/linux/compat.h:60:18: note: aliased declaration here
> asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
> ^~~~~~~~~~
>
> The new warning seems reasonable in principle, but it doesn't
> help us here, since we rely on the type mismatch to sanitize the
> system call arguments. After I reported this as GCC PR82435, a new
> -Wno-attribute-alias option was added that could be used to turn the
> warning off globally on the command line, but I'd prefer to do it a
> little more fine-grained.
>
> Interestingly, turning a warning off and on again inside of
> a single macro doesn't always work, in this case I had to add
> an extra statement inbetween and decided to copy the __SC_TEST
> one from the native syscall to the compat syscall macro. See
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83256 for more details
> about this.
>
> [paul.burton@mips.com:
> - Rebase atop current master.
> - Split GCC & version arguments to __diag_ignore() in order to match
> changes to the preceding patch.
> - Add the comment argument to match the preceding patch.]
>
> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82435
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Cc: Michal Marek <michal.lkml@markovi.net>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Matthew Wilcox <matthew@wil.cx>
> Cc: Matthias Kaehlcke <mka@chromium.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Gideon Israel Dsouza <gidisrael@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@c-s.fr>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Stafford Horne <shorne@gmail.com>
> Cc: Khem Raj <raj.khem@gmail.com>
> Cc: He Zhe <zhe.he@windriver.com>
> Cc: linux-kbuild@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: linuxppc-dev@lists.ozlabs.org
Tested-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>
> include/linux/compat.h | 8 +++++++-
> include/linux/syscalls.h | 4 ++++
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/compat.h b/include/linux/compat.h
> index b1a5562b3215..c68acc47da57 100644
> --- a/include/linux/compat.h
> +++ b/include/linux/compat.h
> @@ -72,6 +72,9 @@
> */
> #ifndef COMPAT_SYSCALL_DEFINEx
> #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
> + __diag_push(); \
> + __diag_ignore(GCC, 8, "-Wattribute-alias", \
> + "Type aliasing is used to sanitize syscall arguments");\
> asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
> asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
> __attribute__((alias(__stringify(__se_compat_sys##name)))); \
> @@ -80,8 +83,11 @@
> asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
> asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
> { \
> - return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
> + long ret = __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
> + __MAP(x,__SC_TEST,__VA_ARGS__); \
> + return ret; \
> } \
> + __diag_pop(); \
> static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
> #endif /* COMPAT_SYSCALL_DEFINEx */
>
> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
> index 73810808cdf2..a368a68cb667 100644
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -231,6 +231,9 @@ static inline int is_syscall_trace_event(struct trace_event_call *tp_event)
> */
> #ifndef __SYSCALL_DEFINEx
> #define __SYSCALL_DEFINEx(x, name, ...) \
> + __diag_push(); \
> + __diag_ignore(GCC, 8, "-Wattribute-alias", \
> + "Type aliasing is used to sanitize syscall arguments");\
> asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
> __attribute__((alias(__stringify(__se_sys##name)))); \
> ALLOW_ERROR_INJECTION(sys##name, ERRNO); \
> @@ -243,6 +246,7 @@ static inline int is_syscall_trace_event(struct trace_event_call *tp_event)
> __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \
> return ret; \
> } \
> + __diag_pop(); \
> static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
> #endif /* __SYSCALL_DEFINEx */
>
>
^ permalink raw reply
* Re: [PATCH 1/3] kbuild: add macro for controlling warnings to linux/compiler.h
From: Christophe LEROY @ 2018-06-18 7:01 UTC (permalink / raw)
To: Paul Burton, linux-kbuild
Cc: Mauro Carvalho Chehab, linux-mips, Arnd Bergmann, Ingo Molnar,
Matthew Wilcox, Thomas Gleixner, Douglas Anderson, Josh Poimboeuf,
Andrew Morton, Matthias Kaehlcke, He Zhe, Benjamin Herrenschmidt,
Michal Marek, Khem Raj, Al Viro, Stafford Horne,
Gideon Israel Dsouza, Masahiro Yamada, Kees Cook,
Michael Ellerman, Heiko Carstens, linux-kernel, Paul Mackerras,
linuxppc-dev
In-Reply-To: <20180616005323.7938-2-paul.burton@mips.com>
Le 16/06/2018 à 02:53, Paul Burton a écrit :
> From: Arnd Bergmann <arnd@arndb.de>
>
> I have occasionally run into a situation where it would make sense to
> control a compiler warning from a source file rather than doing so from
> a Makefile using the $(cc-disable-warning, ...) or $(cc-option, ...)
> helpers.
>
> The approach here is similar to what glibc uses, using __diag() and
> related macros to encapsulate a _Pragma("GCC diagnostic ...") statement
> that gets turned into the respective "#pragma GCC diagnostic ..." by
> the preprocessor when the macro gets expanded.
>
> Like glibc, I also have an argument to pass the affected compiler
> version, but decided to actually evaluate that one. For now, this
> supports GCC_4_6, GCC_4_7, GCC_4_8, GCC_4_9, GCC_5, GCC_6, GCC_7,
> GCC_8 and GCC_9. Adding support for CLANG_5 and other interesting
> versions is straightforward here. GNU compilers starting with gcc-4.2
> could support it in principle, but "#pragma GCC diagnostic push"
> was only added in gcc-4.6, so it seems simpler to not deal with those
> at all. The same versions show a large number of warnings already,
> so it seems easier to just leave it at that and not do a more
> fine-grained control for them.
>
> The use cases I found so far include:
>
> - turning off the gcc-8 -Wattribute-alias warning inside of the
> SYSCALL_DEFINEx() macro without having to do it globally.
>
> - Reducing the build time for a simple re-make after a change,
> once we move the warnings from ./Makefile and
> ./scripts/Makefile.extrawarn into linux/compiler.h
>
> - More control over the warnings based on other configurations,
> using preprocessor syntax instead of Makefile syntax. This should make
> it easier for the average developer to understand and change things.
>
> - Adding an easy way to turn the W=1 option on unconditionally
> for a subdirectory or a specific file. This has been requested
> by several developers in the past that want to have their subsystems
> W=1 clean.
>
> - Integrating clang better into the build systems. Clang supports
> more warnings than GCC, and we probably want to classify them
> as default, W=1, W=2 etc, but there are cases in which the
> warnings should be classified differently due to excessive false
> positives from one or the other compiler.
>
> - Adding a way to turn the default warnings into errors (e.g. using
> a new "make E=0" tag) while not also turning the W=1 warnings into
> errors.
>
> This patch for now just adds the minimal infrastructure in order to
> do the first of the list above. As the #pragma GCC diagnostic
> takes precedence over command line options, the next step would be
> to convert a lot of the individual Makefiles that set nonstandard
> options to use __diag() instead.
>
> [paul.burton@mips.com:
> - Rebase atop current master.
> - Add __diag_GCC, or more generally __diag_<compiler>, abstraction to
> avoid code outside of linux/compiler-gcc.h needing to duplicate
> knowledge about different GCC versions.
> - Add a comment argument to __diag_{ignore,warn,error} which isn't
> used in the expansion of the macros but serves to push people to
> document the reason for using them - per feedback from Kees Cook.]
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Cc: Michal Marek <michal.lkml@markovi.net>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Matthew Wilcox <matthew@wil.cx>
> Cc: Matthias Kaehlcke <mka@chromium.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Gideon Israel Dsouza <gidisrael@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@c-s.fr>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Stafford Horne <shorne@gmail.com>
> Cc: Khem Raj <raj.khem@gmail.com>
> Cc: He Zhe <zhe.he@windriver.com>
> Cc: linux-kbuild@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: linuxppc-dev@lists.ozlabs.org
Tested-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>
> include/linux/compiler-gcc.h | 66 ++++++++++++++++++++++++++++++++++
> include/linux/compiler_types.h | 18 ++++++++++
> 2 files changed, 84 insertions(+)
>
> diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> index f1a7492a5cc8..aba64a2912d8 100644
> --- a/include/linux/compiler-gcc.h
> +++ b/include/linux/compiler-gcc.h
> @@ -347,3 +347,69 @@
> #if GCC_VERSION >= 50100
> #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
> #endif
> +
> +/*
> + * turn individual warnings and errors on and off locally, depending
> + * on version.
> + */
> +#define __diag_GCC(version, s) __diag_GCC_ ## version(s)
> +
> +#if GCC_VERSION >= 40600
> +#define __diag_str1(s) #s
> +#define __diag_str(s) __diag_str1(s)
> +#define __diag(s) _Pragma(__diag_str(GCC diagnostic s))
> +
> +/* compilers before gcc-4.6 do not understand "#pragma GCC diagnostic push" */
> +#define __diag_GCC_4_6(s) __diag(s)
> +#else
> +#define __diag(s)
> +#define __diag_GCC_4_6(s)
> +#endif
> +
> +#if GCC_VERSION >= 40700
> +#define __diag_GCC_4_7(s) __diag(s)
> +#else
> +#define __diag_GCC_4_7(s)
> +#endif
> +
> +#if GCC_VERSION >= 40800
> +#define __diag_GCC_4_8(s) __diag(s)
> +#else
> +#define __diag_GCC_4_8(s)
> +#endif
> +
> +#if GCC_VERSION >= 40900
> +#define __diag_GCC_4_9(s) __diag(s)
> +#else
> +#define __diag_GCC_4_9(s)
> +#endif
> +
> +#if GCC_VERSION >= 50000
> +#define __diag_GCC_5(s) __diag(s)
> +#else
> +#define __diag_GCC_5(s)
> +#endif
> +
> +#if GCC_VERSION >= 60000
> +#define __diag_GCC_6(s) __diag(s)
> +#else
> +#define __diag_GCC_6(s)
> +#endif
> +
> +#if GCC_VERSION >= 70000
> +#define __diag_GCC_7(s) __diag(s)
> +#else
> +#define __diag_GCC_7(s)
> +#endif
> +
> +#if GCC_VERSION >= 80000
> +#define __diag_GCC_8(s) __diag(s)
> +#else
> +#define __diag_GCC_8(s)
> +#endif
> +
> +#if GCC_VERSION >= 90000
> +#define __diag_GCC_9(s) __diag(s)
> +#else
> +#define __diag_GCC_9(s)
> +#endif
> diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
> index 6b79a9bba9a7..313a2ad884e0 100644
> --- a/include/linux/compiler_types.h
> +++ b/include/linux/compiler_types.h
> @@ -271,4 +271,22 @@ struct ftrace_likely_data {
> # define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
> #endif
>
> +#ifndef __diag
> +#define __diag(string)
> +#endif
> +
> +#ifndef __diag_GCC
> +#define __diag_GCC(string)
> +#endif
> +
> +#define __diag_push() __diag(push)
> +#define __diag_pop() __diag(pop)
> +
> +#define __diag_ignore(compiler, version, option, comment) \
> + __diag_ ## compiler(version, ignored option)
> +#define __diag_warn(compiler, version, option, comment) \
> + __diag_ ## compiler(version, warning option)
> +#define __diag_error(compiler, version, option, comment) \
> + __diag_ ## compiler(version, error option)
> +
> #endif /* __LINUX_COMPILER_TYPES_H */
>
^ permalink raw reply
* Re: [PATCH 0/3] Resolve -Wattribute-alias warnings from SYSCALL_DEFINEx()
From: Christophe LEROY @ 2018-06-18 7:00 UTC (permalink / raw)
To: Paul Burton, linux-kbuild
Cc: Mauro Carvalho Chehab, linux-mips, Arnd Bergmann, Ingo Molnar,
Matthew Wilcox, Thomas Gleixner, Douglas Anderson, Josh Poimboeuf,
Andrew Morton, Matthias Kaehlcke, He Zhe, Benjamin Herrenschmidt,
Michal Marek, Khem Raj, Al Viro, Stafford Horne,
Gideon Israel Dsouza, Masahiro Yamada, Kees Cook,
Michael Ellerman, Heiko Carstens, linux-kernel, Paul Mackerras,
linuxppc-dev
In-Reply-To: <20180616005323.7938-1-paul.burton@mips.com>
Le 16/06/2018 à 02:53, Paul Burton a écrit :
> This series introduces infrastructure allowing compiler diagnostics to
> be disabled or their severity modified for specific pieces of code, with
> suitable abstractions to prevent that code from becoming tied to a
> specific compiler.
>
> This infrastructure is then used to disable the -Wattribute-alias
> warning around syscall definitions, which rely on type mismatches to
> sanitize arguments.
>
> Finally PowerPC-specific #pragma's are removed now that the generic code
> is handling this.
>
> The series takes Arnd's RFC patches & addresses the review comments they
> received. The most notable effect of this series to to avoid warnings &
> build failures caused by -Wattribute-alias when compiling the kernel
> with GCC 8.
>
> Applies cleanly atop master as of 9215310cf13b ("Merge
> git://git.kernel.org/pub/scm/linux/kernel/git/davem/net").
>
> Thanks,
> Paul
>
> Arnd Bergmann (2):
> kbuild: add macro for controlling warnings to linux/compiler.h
> disable -Wattribute-alias warning for SYSCALL_DEFINEx()
>
> Paul Burton (1):
> Revert "powerpc: fix build failure by disabling attribute-alias
> warning in pci_32"
>
> arch/powerpc/kernel/pci_32.c | 4 ---
> include/linux/compat.h | 8 ++++-
> include/linux/compiler-gcc.h | 66 ++++++++++++++++++++++++++++++++++
> include/linux/compiler_types.h | 18 ++++++++++
> include/linux/syscalls.h | 4 +++
> 5 files changed, 95 insertions(+), 5 deletions(-)
>
Works well, thanks.
You can then also revert 2479bfc9bc600dcce7f932d52dcfa8d677c41f93
("powerpc: Fix build by disabling attribute-alias warning for
SYSCALL_DEFINEx")
Christophe
^ permalink raw reply
* Re: [PATCH kernel 2/2] powerpc/powernv: Define PHB4 type and enable sketchy bypass on POWER9
From: Benjamin Herrenschmidt @ 2018-06-18 4:44 UTC (permalink / raw)
To: Alexey Kardashevskiy; +Cc: linuxppc-dev, Alistair Popple, Russell Currey
In-Reply-To: <20180618121307.199cd998@aik.ozlabs.ibm.com>
On Mon, 2018-06-18 at 12:13 +1000, Alexey Kardashevskiy wrote:
> On Sat, 16 Jun 2018 11:05:19 +1000
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
> > On Fri, 2018-06-01 at 18:10 +1000, Alexey Kardashevskiy wrote:
> > > These are found in POWER9 chips. Right now these PHBs have unknown type
> > > so changing it to PHB4 won't make much of a difference except enabling
> > > sketchy bypass for POWER9 as this does below.
> >
> > And that will break on multi-chip systems since P9 doesn't have the
> > memory contiguous (it has the chip ID in the top bits).
>
>
> This did not break mine and it is hard to see why it would break at all
> if we use 1G pages and the maximum we need to cover is 48 bits (this
> is what we are trying to support here - all these gpus, right?), or is
> it more now? If so, I have posted v2 of tce multilevel dynamic
> allocation which helps with enormous tce tables.
The whole point of sketchy bypass is to deal with devices with small
amount of DMA bits... most Radeon's have 40 for example. So that won't
work terribly well.
Cheers,
Ben.
>
>
> >
> > Russell is working on a different implementation that should be much
> > more imune to the system physical memory layout.
> >
> > > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > > ---
> > > arch/powerpc/platforms/powernv/pci.h | 1 +
> > > arch/powerpc/platforms/powernv/pci-ioda.c | 5 ++++-
> > > 2 files changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
> > > index eada4b6..1408247 100644
> > > --- a/arch/powerpc/platforms/powernv/pci.h
> > > +++ b/arch/powerpc/platforms/powernv/pci.h
> > > @@ -23,6 +23,7 @@ enum pnv_phb_model {
> > > PNV_PHB_MODEL_UNKNOWN,
> > > PNV_PHB_MODEL_P7IOC,
> > > PNV_PHB_MODEL_PHB3,
> > > + PNV_PHB_MODEL_PHB4,
> > > PNV_PHB_MODEL_NPU,
> > > PNV_PHB_MODEL_NPU2,
> > > };
> > > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> > > index 9239142..66c2804 100644
> > > --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> > > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> > > @@ -1882,7 +1882,8 @@ static int pnv_pci_ioda_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
> > > if (dma_mask >> 32 &&
> > > dma_mask > (memory_hotplug_max() + (1ULL << 32)) &&
> > > pnv_pci_ioda_pe_single_vendor(pe) &&
> > > - phb->model == PNV_PHB_MODEL_PHB3) {
> > > + (phb->model == PNV_PHB_MODEL_PHB3 ||
> > > + phb->model == PNV_PHB_MODEL_PHB4)) {
> > > /* Configure the bypass mode */
> > > rc = pnv_pci_ioda_dma_64bit_bypass(pe);
> > > if (rc)
> > > @@ -3930,6 +3931,8 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
> > > phb->model = PNV_PHB_MODEL_P7IOC;
> > > else if (of_device_is_compatible(np, "ibm,power8-pciex"))
> > > phb->model = PNV_PHB_MODEL_PHB3;
> > > + else if (of_device_is_compatible(np, "ibm,power9-pciex"))
> > > + phb->model = PNV_PHB_MODEL_PHB4;
> > > else if (of_device_is_compatible(np, "ibm,power8-npu-pciex"))
> > > phb->model = PNV_PHB_MODEL_NPU;
> > > else if (of_device_is_compatible(np, "ibm,power9-npu-pciex"))
>
>
>
> --
> Alexey
^ permalink raw reply
* Re: linux-next: build failure in Linus' tree
From: Stephen Rothwell @ 2018-06-18 3:50 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: Linux-Next Mailing List, Linux Kernel Mailing List, David Miller,
Networking, Michael Ellerman, Benjamin Herrenschmidt, PowerPC
In-Reply-To: <20180612122640.534118ed@canb.auug.org.au>
[-- Attachment #1: Type: text/plain, Size: 659 bytes --]
Hi all,
On Tue, 12 Jun 2018 12:26:40 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Building Linus' tree, today's linux-next build (powerpc allyesconfig)
> failed like this:
>
> ld: net/bpfilter/bpfilter_umh.o: compiled for a little endian system and target is big endian
> ld: failed to merge target specific data of file net/bpfilter/bpfilter_umh.o
>
> This has come to light since I started using a native compiler (i.e. one
> that can build executables, not just the kernel) for my PowerPC builds
> on a powerpcle host.
>
> I have switched back to my limited compiler.
Any progress on this?
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Re: [powerpc/powervmc]kernel BUG at arch/powerpc/mm/pgtable-book3s64.c:414!
From: Aneesh Kumar K.V @ 2018-06-18 3:15 UTC (permalink / raw)
To: Venkat Rao B, Michael Ellerman, linuxppc-dev; +Cc: sachinp, Nicholas Piggin
In-Reply-To: <4d3ad051-2423-3570-7ef6-90f47a83f157@linux.vnet.ibm.com>
On 06/17/2018 01:22 PM, Venkat Rao B wrote:
>
>
> On Friday 15 June 2018 07:14 PM, Michael Ellerman wrote:
>> vrbagal1 <vrbagal1@linux.vnet.ibm.com> writes:
>>
>>> Hi,
>>>
>>> Observing kernel bug followed by kernel oops and system reboots, while
>>> running kselftest on Power8 LPAR.
>>>
>>> Machine Details: Power8 LPAR
>>> Git Tree:
>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>>> Commit ID: f5b7769eb0400ec5217a47e41148a9f816ca1f9f
>>> Kernel version: 4.17.0-autotest
>>> GCC version: (gcc version 6.3.1 20161221 (Red Hat 6.3.1-1) (GCC))
>>>
>>
>> This is fixed by your patch Aneesh?
>>
>> http://patchwork.ozlabs.org/patch/929325/
>
> Yes, this patch fixes the issue.
>
I missed adding Reported-by:Venkat Rao B <vrbagal1@linux.vnet.ibm.com>
and Tested-by:Venkat Rao B <vrbagal1@linux.vnet.ibm.com>
Michael,
Can you add that when applying the patch?
-aneesh
^ permalink raw reply
* Re: [PATCH kernel 2/2] powerpc/powernv: Define PHB4 type and enable sketchy bypass on POWER9
From: Alexey Kardashevskiy @ 2018-06-18 2:13 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Alistair Popple, Russell Currey
In-Reply-To: <fa34ce6fa30554e7cede85a5d71fa822dcdfeb01.camel@kernel.crashing.org>
On Sat, 16 Jun 2018 11:05:19 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Fri, 2018-06-01 at 18:10 +1000, Alexey Kardashevskiy wrote:
> > These are found in POWER9 chips. Right now these PHBs have unknown type
> > so changing it to PHB4 won't make much of a difference except enabling
> > sketchy bypass for POWER9 as this does below.
>
> And that will break on multi-chip systems since P9 doesn't have the
> memory contiguous (it has the chip ID in the top bits).
This did not break mine and it is hard to see why it would break at all
if we use 1G pages and the maximum we need to cover is 48 bits (this
is what we are trying to support here - all these gpus, right?), or is
it more now? If so, I have posted v2 of tce multilevel dynamic
allocation which helps with enormous tce tables.
>
> Russell is working on a different implementation that should be much
> more imune to the system physical memory layout.
>
> > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > ---
> > arch/powerpc/platforms/powernv/pci.h | 1 +
> > arch/powerpc/platforms/powernv/pci-ioda.c | 5 ++++-
> > 2 files changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
> > index eada4b6..1408247 100644
> > --- a/arch/powerpc/platforms/powernv/pci.h
> > +++ b/arch/powerpc/platforms/powernv/pci.h
> > @@ -23,6 +23,7 @@ enum pnv_phb_model {
> > PNV_PHB_MODEL_UNKNOWN,
> > PNV_PHB_MODEL_P7IOC,
> > PNV_PHB_MODEL_PHB3,
> > + PNV_PHB_MODEL_PHB4,
> > PNV_PHB_MODEL_NPU,
> > PNV_PHB_MODEL_NPU2,
> > };
> > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> > index 9239142..66c2804 100644
> > --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> > @@ -1882,7 +1882,8 @@ static int pnv_pci_ioda_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
> > if (dma_mask >> 32 &&
> > dma_mask > (memory_hotplug_max() + (1ULL << 32)) &&
> > pnv_pci_ioda_pe_single_vendor(pe) &&
> > - phb->model == PNV_PHB_MODEL_PHB3) {
> > + (phb->model == PNV_PHB_MODEL_PHB3 ||
> > + phb->model == PNV_PHB_MODEL_PHB4)) {
> > /* Configure the bypass mode */
> > rc = pnv_pci_ioda_dma_64bit_bypass(pe);
> > if (rc)
> > @@ -3930,6 +3931,8 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
> > phb->model = PNV_PHB_MODEL_P7IOC;
> > else if (of_device_is_compatible(np, "ibm,power8-pciex"))
> > phb->model = PNV_PHB_MODEL_PHB3;
> > + else if (of_device_is_compatible(np, "ibm,power9-pciex"))
> > + phb->model = PNV_PHB_MODEL_PHB4;
> > else if (of_device_is_compatible(np, "ibm,power8-npu-pciex"))
> > phb->model = PNV_PHB_MODEL_NPU;
> > else if (of_device_is_compatible(np, "ibm,power9-npu-pciex"))
--
Alexey
^ permalink raw reply
* Re: [PATCH] Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends"
From: Eric Dumazet @ 2018-06-17 22:54 UTC (permalink / raw)
To: Andreas Schwab
Cc: Mathieu Malaterre, David S. Miller, Eric Dumazet, LKML,
Christophe LEROY, Meelis Roos, netdev, linuxppc-dev
In-Reply-To: <m2tvq1672p.fsf@linux-m68k.org>
On 06/17/2018 03:27 AM, Andreas Schwab wrote:
>
> That doesn't change anything.
OK, thanks !
Oh this is silly, please try :
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index c642304f178ce0a4e1358d59e45032a39f76fb3f..54dd9c18ecad817812898d6f335e1794a07dabbe 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1845,10 +1845,9 @@ EXPORT_SYMBOL(___pskb_trim);
int pskb_trim_rcsum_slow(struct sk_buff *skb, unsigned int len)
{
if (skb->ip_summed == CHECKSUM_COMPLETE) {
- int delta = skb->len - len;
+ __wsum csumdiff = skb_checksum(skb, len, skb->len - len, 0);
- skb->csum = csum_sub(skb->csum,
- skb_checksum(skb, len, delta, 0));
+ skb->csum = csum_block_sub(skb->csum, csumdiff, len);
}
return __pskb_trim(skb, len);
}
^ permalink raw reply related
* [PATCH] powerpc: wii: Remove outdated comment about memory fixups
From: Jonathan Neuschäfer @ 2018-06-17 12:49 UTC (permalink / raw)
To: linuxppc-dev
Cc: Jonathan Neuschäfer, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman, linux-kernel
The workaround has been removed. What stays is just code to find the
memory hole so the BATs can be configured properly in the function below.
Fixes: 57deb8fea01f ("powerpc/wii: Don't rely on the reserved memory hack")
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
arch/powerpc/platforms/embedded6xx/wii.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
index fc00d82691e1..a133b70bfe6f 100644
--- a/arch/powerpc/platforms/embedded6xx/wii.c
+++ b/arch/powerpc/platforms/embedded6xx/wii.c
@@ -68,16 +68,6 @@ void __init wii_memory_fixups(void)
{
struct memblock_region *p = memblock.memory.regions;
- /*
- * This is part of a workaround to allow the use of two
- * discontinuous RAM ranges on the Wii, even if this is
- * currently unsupported on 32-bit PowerPC Linux.
- *
- * We coalesce the two memory ranges of the Wii into a
- * single range, then create a reservation for the "hole"
- * between both ranges.
- */
-
BUG_ON(memblock.memory.cnt != 2);
BUG_ON(!page_aligned(p[0].base) || !page_aligned(p[1].base));
--
2.17.1
^ permalink raw reply related
* Re: [PATCH] powerpc/64s: Report SLB multi-hit rather than parity error
From: Nicholas Piggin @ 2018-06-17 12:07 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <87muvw9t78.fsf@concordia.ellerman.id.au>
On Fri, 15 Jun 2018 21:37:15 +1000
Michael Ellerman <mpe@ellerman.id.au> wrote:
> Nicholas Piggin <npiggin@gmail.com> writes:
> > On Wed, 13 Jun 2018 23:24:14 +1000
> > Michael Ellerman <mpe@ellerman.id.au> wrote:
> >
> >> When we take an SLB multi-hit on bare metal, we see both the multi-hit
> >> and parity error bits set in DSISR. The user manuals indicates this is
> >> expected to always happen on Power8, whereas on Power9 it says a
> >> multi-hit will "usually" also cause a parity error.
> >>
> >> We decide what to do based on the various error tables in mce_power.c,
> >> and because we process them in order and only report the first, we
> >> currently always report a parity error but not the multi-hit, eg:
> >>
> >> Severe Machine check interrupt [Recovered]
> >> Initiator: CPU
> >> Error type: SLB [Parity]
> >> Effective address: c000000ffffd4300
> >>
> >> Although this is correct, it leaves the user wondering why they got a
> >> parity error. It would be clearer instead if we reported the
> >> multi-hit because that is more likely to be simply a software bug,
> >> whereas a true parity error is possibly an indication of a bad core.
> >>
> >> We can do that simply by reordering the error tables so that multi-hit
> >> appears before parity. That doesn't affect the error recovery at all,
> >> because we flush the SLB either way.
> >
> > Yeah this is a good idea. I wonder if there are any other conditions
> > like this that should be reordered.
>
> Yeah good point, this one just caught my eye because I was testing it.
> Ideally it wouldn't matter and we could actually report multiple, but
> that would be a bit of a bigger change.
Yep this patch looks fine for a minimal fix.
>
> > I think the i-side should not have to be changed here because it
> > matches the value not bits, so that shouldn't matter.
>
> Ah OK, will check.
>
> > A bit of a shame we don't report i/d side, and ideally we'd be able
> > to report multiple conditions. The reporting APIs really want to be
> > massaged a bit, but for now this is a good step.
>
> Ah snap, yep, more detail & multiple conditions would be nice.
>
> I don't really understand the way we do the reporting now. The
> struct machine_check_event is all carefully laid out with reserved
> fields and a version number and everything as if it's an ABI. But AFAICS
> it's purely internal to the kernel.
>
> And then we have struct mce_error_info, but that's a separate thing and
> struct machine_check_event doesn't contain one of them?
Yeah I noticed that too a while back, was it an old OPAL API or maybe a
proposed new API that was never implemented? I would like to end up
doing most MCE decoding in firmware at some point, but I don't think
it's worth keeping this existing ABI thing around for it.
Thanks,
Nick
^ permalink raw reply
* [PATCH kernel v2 5/6] powerpc/powernv: Rework TCE level allocation
From: Alexey Kardashevskiy @ 2018-06-17 11:14 UTC (permalink / raw)
To: linuxppc-dev
Cc: Alexey Kardashevskiy, David Gibson, kvm-ppc, Alex Williamson,
Benjamin Herrenschmidt, Russell Currey
In-Reply-To: <20180617111428.24349-1-aik@ozlabs.ru>
This moves actual pages allocation to a separate function which is going
to be reused later in on-demand TCE allocation.
While we are at it, remove unnecessary level size round up as the caller
does this already.
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
arch/powerpc/platforms/powernv/pci-ioda-tce.c | 30 +++++++++++++++++----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda-tce.c b/arch/powerpc/platforms/powernv/pci-ioda-tce.c
index f14b282..36c2eb0 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda-tce.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda-tce.c
@@ -31,6 +31,23 @@ void pnv_pci_setup_iommu_table(struct iommu_table *tbl,
tbl->it_type = TCE_PCI;
}
+static __be64 *pnv_alloc_tce_level(int nid, unsigned int shift)
+{
+ struct page *tce_mem = NULL;
+ __be64 *addr;
+
+ tce_mem = alloc_pages_node(nid, GFP_KERNEL, shift - PAGE_SHIFT);
+ if (!tce_mem) {
+ pr_err("Failed to allocate a TCE memory, level shift=%d\n",
+ shift);
+ return NULL;
+ }
+ addr = page_address(tce_mem);
+ memset(addr, 0, 1UL << shift);
+
+ return addr;
+}
+
static __be64 *pnv_tce(struct iommu_table *tbl, bool user, long idx)
{
__be64 *tmp = user ? tbl->it_userspace : (__be64 *) tbl->it_base;
@@ -165,21 +182,12 @@ static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int nid, unsigned int shift,
unsigned int levels, unsigned long limit,
unsigned long *current_offset, unsigned long *total_allocated)
{
- struct page *tce_mem = NULL;
__be64 *addr, *tmp;
- unsigned int order = max_t(unsigned int, shift, PAGE_SHIFT) -
- PAGE_SHIFT;
- unsigned long allocated = 1UL << (order + PAGE_SHIFT);
+ unsigned long allocated = 1UL << shift;
unsigned int entries = 1UL << (shift - 3);
long i;
- tce_mem = alloc_pages_node(nid, GFP_KERNEL, order);
- if (!tce_mem) {
- pr_err("Failed to allocate a TCE memory, order=%d\n", order);
- return NULL;
- }
- addr = page_address(tce_mem);
- memset(addr, 0, allocated);
+ addr = pnv_alloc_tce_level(nid, shift);
*total_allocated += allocated;
--levels;
--
2.11.0
^ permalink raw reply related
* [PATCH kernel v2 3/6] KVM: PPC: Make iommu_table::it_userspace big endian
From: Alexey Kardashevskiy @ 2018-06-17 11:14 UTC (permalink / raw)
To: linuxppc-dev
Cc: Alexey Kardashevskiy, David Gibson, kvm-ppc, Alex Williamson,
Benjamin Herrenschmidt, Russell Currey
In-Reply-To: <20180617111428.24349-1-aik@ozlabs.ru>
We are going to reuse multilevel TCE code for the userspace copy of
the TCE table and since it is big endian, let's make the copy big endian
too.
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
arch/powerpc/include/asm/iommu.h | 2 +-
arch/powerpc/kvm/book3s_64_vio.c | 11 ++++++-----
arch/powerpc/kvm/book3s_64_vio_hv.c | 10 +++++-----
drivers/vfio/vfio_iommu_spapr_tce.c | 19 +++++++++----------
4 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
index 20febe0..803ac70 100644
--- a/arch/powerpc/include/asm/iommu.h
+++ b/arch/powerpc/include/asm/iommu.h
@@ -117,7 +117,7 @@ struct iommu_table {
unsigned long *it_map; /* A simple allocation bitmap for now */
unsigned long it_page_shift;/* table iommu page size */
struct list_head it_group_list;/* List of iommu_table_group_link */
- unsigned long *it_userspace; /* userspace view of the table */
+ __be64 *it_userspace; /* userspace view of the table */
struct iommu_table_ops *it_ops;
struct kref it_kref;
};
diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
index 80ead38..1dbca4b 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -378,19 +378,19 @@ static long kvmppc_tce_iommu_mapped_dec(struct kvm *kvm,
{
struct mm_iommu_table_group_mem_t *mem = NULL;
const unsigned long pgsize = 1ULL << tbl->it_page_shift;
- unsigned long *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl, entry);
+ __be64 *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl, entry);
if (!pua)
/* it_userspace allocation might be delayed */
return H_TOO_HARD;
- mem = mm_iommu_lookup(kvm->mm, *pua, pgsize);
+ mem = mm_iommu_lookup(kvm->mm, be64_to_cpu(*pua), pgsize);
if (!mem)
return H_TOO_HARD;
mm_iommu_mapped_dec(mem);
- *pua = 0;
+ *pua = cpu_to_be64(0);
return H_SUCCESS;
}
@@ -437,7 +437,8 @@ long kvmppc_tce_iommu_do_map(struct kvm *kvm, struct iommu_table *tbl,
enum dma_data_direction dir)
{
long ret;
- unsigned long hpa, *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl, entry);
+ unsigned long hpa;
+ __be64 *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl, entry);
struct mm_iommu_table_group_mem_t *mem;
if (!pua)
@@ -464,7 +465,7 @@ long kvmppc_tce_iommu_do_map(struct kvm *kvm, struct iommu_table *tbl,
if (dir != DMA_NONE)
kvmppc_tce_iommu_mapped_dec(kvm, tbl, entry);
- *pua = ua;
+ *pua = cpu_to_be64(ua);
return 0;
}
diff --git a/arch/powerpc/kvm/book3s_64_vio_hv.c b/arch/powerpc/kvm/book3s_64_vio_hv.c
index 635f3ca..18109f3 100644
--- a/arch/powerpc/kvm/book3s_64_vio_hv.c
+++ b/arch/powerpc/kvm/book3s_64_vio_hv.c
@@ -200,7 +200,7 @@ static long kvmppc_rm_tce_iommu_mapped_dec(struct kvm *kvm,
{
struct mm_iommu_table_group_mem_t *mem = NULL;
const unsigned long pgsize = 1ULL << tbl->it_page_shift;
- unsigned long *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl, entry);
+ __be64 *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl, entry);
if (!pua)
/* it_userspace allocation might be delayed */
@@ -210,13 +210,13 @@ static long kvmppc_rm_tce_iommu_mapped_dec(struct kvm *kvm,
if (WARN_ON_ONCE_RM(!pua))
return H_HARDWARE;
- mem = mm_iommu_lookup_rm(kvm->mm, *pua, pgsize);
+ mem = mm_iommu_lookup_rm(kvm->mm, be64_to_cpu(*pua), pgsize);
if (!mem)
return H_TOO_HARD;
mm_iommu_mapped_dec(mem);
- *pua = 0;
+ *pua = cpu_to_be64(0);
return H_SUCCESS;
}
@@ -268,7 +268,7 @@ static long kvmppc_rm_tce_iommu_do_map(struct kvm *kvm, struct iommu_table *tbl,
{
long ret;
unsigned long hpa = 0;
- unsigned long *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl, entry);
+ __be64 *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl, entry);
struct mm_iommu_table_group_mem_t *mem;
if (!pua)
@@ -302,7 +302,7 @@ static long kvmppc_rm_tce_iommu_do_map(struct kvm *kvm, struct iommu_table *tbl,
if (dir != DMA_NONE)
kvmppc_rm_tce_iommu_mapped_dec(kvm, tbl, entry);
- *pua = ua;
+ *pua = cpu_to_be64(ua);
return 0;
}
diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c
index 451284e0..8283a4a 100644
--- a/drivers/vfio/vfio_iommu_spapr_tce.c
+++ b/drivers/vfio/vfio_iommu_spapr_tce.c
@@ -231,7 +231,7 @@ static long tce_iommu_userspace_view_alloc(struct iommu_table *tbl,
decrement_locked_vm(mm, cb >> PAGE_SHIFT);
return -ENOMEM;
}
- tbl->it_userspace = uas;
+ tbl->it_userspace = (__be64 *) uas;
return 0;
}
@@ -490,20 +490,20 @@ static void tce_iommu_unuse_page_v2(struct tce_container *container,
struct mm_iommu_table_group_mem_t *mem = NULL;
int ret;
unsigned long hpa = 0;
- unsigned long *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl, entry);
+ __be64 *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl, entry);
if (!pua)
return;
- ret = tce_iommu_prereg_ua_to_hpa(container, *pua, IOMMU_PAGE_SIZE(tbl),
- &hpa, &mem);
+ ret = tce_iommu_prereg_ua_to_hpa(container, be64_to_cpu(*pua),
+ IOMMU_PAGE_SIZE(tbl), &hpa, &mem);
if (ret)
- pr_debug("%s: tce %lx at #%lx was not cached, ret=%d\n",
- __func__, *pua, entry, ret);
+ pr_debug("%s: tce %llx at #%lx was not cached, ret=%d\n",
+ __func__, be64_to_cpu(*pua), entry, ret);
if (mem)
mm_iommu_mapped_dec(mem);
- *pua = 0;
+ *pua = cpu_to_be64(0);
}
static int tce_iommu_clear(struct tce_container *container,
@@ -612,8 +612,7 @@ static long tce_iommu_build_v2(struct tce_container *container,
for (i = 0; i < pages; ++i) {
struct mm_iommu_table_group_mem_t *mem = NULL;
- unsigned long *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl,
- entry + i);
+ __be64 *pua = IOMMU_TABLE_USERSPACE_ENTRY(tbl, entry + i);
ret = tce_iommu_prereg_ua_to_hpa(container,
tce, IOMMU_PAGE_SIZE(tbl), &hpa, &mem);
@@ -646,7 +645,7 @@ static long tce_iommu_build_v2(struct tce_container *container,
if (dirtmp != DMA_NONE)
tce_iommu_unuse_page_v2(container, tbl, entry + i);
- *pua = tce;
+ *pua = cpu_to_be64(tce);
tce += IOMMU_PAGE_SIZE(tbl);
}
--
2.11.0
^ permalink raw reply related
* [PATCH kernel v2 1/6] powerpc/powernv: Remove useless wrapper
From: Alexey Kardashevskiy @ 2018-06-17 11:14 UTC (permalink / raw)
To: linuxppc-dev
Cc: Alexey Kardashevskiy, David Gibson, kvm-ppc, Alex Williamson,
Benjamin Herrenschmidt, Russell Currey
In-Reply-To: <20180617111428.24349-1-aik@ozlabs.ru>
This gets rid of a useless wrapper around
pnv_pci_ioda2_table_free_pages().
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
arch/powerpc/platforms/powernv/pci-ioda.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 29f798c..d4c60b6 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -2206,11 +2206,6 @@ static void pnv_ioda2_tce_free(struct iommu_table *tbl, long index,
pnv_pci_ioda2_tce_invalidate(tbl, index, npages, false);
}
-static void pnv_ioda2_table_free(struct iommu_table *tbl)
-{
- pnv_pci_ioda2_table_free_pages(tbl);
-}
-
static struct iommu_table_ops pnv_ioda2_iommu_ops = {
.set = pnv_ioda2_tce_build,
#ifdef CONFIG_IOMMU_API
@@ -2219,7 +2214,7 @@ static struct iommu_table_ops pnv_ioda2_iommu_ops = {
#endif
.clear = pnv_ioda2_tce_free,
.get = pnv_tce_get,
- .free = pnv_ioda2_table_free,
+ .free = pnv_pci_ioda2_table_free_pages,
};
static int pnv_pci_ioda_dev_dma_weight(struct pci_dev *dev, void *data)
--
2.11.0
^ permalink raw reply related
* [PATCH kernel v2 0/6] powerpc/powernv/iommu: Optimize memory use
From: Alexey Kardashevskiy @ 2018-06-17 11:14 UTC (permalink / raw)
To: linuxppc-dev
Cc: Alexey Kardashevskiy, David Gibson, kvm-ppc, Alex Williamson,
Benjamin Herrenschmidt, Russell Currey
This patchset aims to reduce actual memory use for guests with
sparse memory. The pseries guest uses dynamic DMA windows to map
the entire guest RAM but it only actually maps onlined memory
which may be not be contiguous. I hit this when tried passing
through NVLink2-connected GPU RAM of NVIDIA V100 and trying to
map this RAM at the same offset as in the real hardware
forced me to rework I handle these windows.
This moves userspace-to-host-physical translation table
(iommu_table::it_userspace) from VFIO TCE IOMMU subdriver to
the platform code and reuses the already existing multilevel
TCE table code which we have for the hardware tables.
At last in 6/6 I switch to on-demand allocation so we do not
allocate huge chunks of the table if we do not have to;
there is some math in 6/6.
Changes:
v2:
* bugfix and error handling in 6/6
Please comment. Thanks.
Alexey Kardashevskiy (6):
powerpc/powernv: Remove useless wrapper
powerpc/powernv: Move TCE manupulation code to its own file
KVM: PPC: Make iommu_table::it_userspace big endian
powerpc/powernv: Add indirect levels to it_userspace
powerpc/powernv: Rework TCE level allocation
powerpc/powernv/ioda: Allocate indirect TCE levels on demand
arch/powerpc/platforms/powernv/Makefile | 2 +-
arch/powerpc/include/asm/iommu.h | 11 +-
arch/powerpc/platforms/powernv/pci.h | 44 ++-
arch/powerpc/kvm/book3s_64_vio.c | 11 +-
arch/powerpc/kvm/book3s_64_vio_hv.c | 18 +-
arch/powerpc/platforms/powernv/pci-ioda-tce.c | 395 ++++++++++++++++++++++++++
arch/powerpc/platforms/powernv/pci-ioda.c | 192 ++-----------
arch/powerpc/platforms/powernv/pci.c | 158 -----------
drivers/vfio/vfio_iommu_spapr_tce.c | 65 +----
9 files changed, 482 insertions(+), 414 deletions(-)
create mode 100644 arch/powerpc/platforms/powernv/pci-ioda-tce.c
--
2.11.0
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox