* Linux 4.16: Reported regressions as of Monday, 2018-02-26 (Was: Linux 4.16-rc3)
From: Thorsten Leemhuis @ 2018-02-26 10:25 UTC (permalink / raw)
To: Linus Torvalds, Linux Kernel Mailing List; +Cc: linuxppc-dev, Jonathan Corbet
In-Reply-To: <CA+55aFxk5KBxL9DvRtBivP3hKT-aOAzvSA_B47L1+y0P2GLe_A@mail.gmail.com>
On 26.02.2018 04:05, Linus Torvalds wrote:
> We're on the normal schedule for 4.16 and everything still looks very regular.
Hi! Find below my second regression report for Linux 4.16. It lists 8
regressions I'm currently aware of.
To anyone reading this: Are you aware of any other regressions that got
introduced this development cycle? Then please let me know by mail (a
simple bounce or forward to the email address is enough!).
For details see http://bit.ly/lnxregtrackid And please tell me if there
is anything in the report that shouldn't be there.
Ciao, Thorsten
== Current regressions ==
Debian kernel package tool make-kpkg stalls indefinitely during kernel
build due to commit "kconfig: remove check_stdin()"
Status: stalled after some discussions; seems nobody really cares deeply?
Note: From the discussion: "Shouldn't be a problem to back this one out
either if it turns out to cause massive amounts of pain in practice I
guess, even if it's the Debian tools doing something weird."
Reported: 2018-02-12
https://marc.info/?l=linux-kernel&m=151846414807219
Cause: d2a04648a5dbc3d1d043b35257364f0197d4d868
Linux-Regression-ID: 2fd778
Dell R640 does not boot due to SCSI/SATA failure
Reported: 2018-02-22
https://marc.info/?l=linux-kernel&m=151931128006031
Cause: 84676c1f21e8
Linux-Regression-ID: 15a115
On Nokia N900:/dev/input/event6 aka AV Jack support disappeared
Status: quite new
Reported: 2018-02-24
https://marc.info/?l=linux-omap&m=151950886524308&w=2
Cause: 14e3e295b2b9
Linux-Regression-ID: 4b650f
SD card reader stopped working
Status: quite new
Reported: 2018-02-24
https://bugzilla.kernel.org/show_bug.cgi?id=198917
Linux-Regression-ID: 9adeaf
[mm, mlock, vmscan] 9c4e6b1a70: stress-ng.hdd.ops_per_sec -7.9% regression
Status: WIP
Note: performance regression found by lkp-robot
Reported: 2018-02-25
https://marc.info/?l=linux-kernel&m=151956997301994
Cause: 9c4e6b1a7027f102990c0395296015a812525f4d
aim7.jobs-per-min -18.0% regression
Status: WIP; bisection result is doubted, but was verified
Note: performance regression found by lkp-robot
Reported: 2018-02-25
https://marc.info/?l=linux-kernel&m=151957120702272&w=2
Cause: c0cef30e4ff0dc025f4a1660b8f0ba43ed58426e
Interrupt storm after suspend causes one busy kworker
Status: quite new
Reported: 2018-02-25
https://bugzilla.kernel.org/show_bug.cgi?id=198929
Linux-Regression-ID: 41c451
== Fix heading mainline ==
Dell XPS 13 9360 keyboard no longer works
Status: Fix in the platform tree from what I've heard
Reported: 2018-02-22
https://marc.info/?l=linux-kernel&m=151927645427980
Cause: 30323fb6d552c41997baca5292bf7001366cab57
== Fixed since last report ==
DM Regression: read() returns data when it shouldn't
Status: Was fixed already when last report was compiled
Reported: 2018-02-14
https://marc.info/?l=linux-kernel&m=151861337518109&w=2
Cause: 18a25da84354c6bb655320de6072c00eda6eb602
Linux-Regression-ID: 9e195f
== Fixed before it was properly added to the report ==
kconfig.h: Include compiler types to avoid missed struct attributes
https://git.kernel.org/torvalds/c/28128c61e08e
i2c-designware: sound and s2ram broken on Broadwell-U system since
commit ca382f5b38f367b6 (add i2c gpio recovery option)
https://git.kernel.org/torvalds/c/d1fa74520dcd
^ permalink raw reply
* [PATCH] xmon: Setup xmon debugger hooks when first break-point is set
From: Vaibhav Jain @ 2018-02-26 11:36 UTC (permalink / raw)
To: linuxppc-dev, Michael Ellerman
Cc: Vaibhav Jain, Benjamin Herrenschmidt, Paul Mackerras,
Balbir Singh, Nicholas Piggin, Douglas Miller, Frederic Barrat
Presently sysrq key for xmon('x') is registered during kernel init
irrespective of the value of kernel param 'xmon'. Thus xmon is enabled
even if 'xmon=off' is passed on the kernel command line. However this
doesn't enable the kernel debugger hooks needed for instruction or data
breakpoints. Thus when a break-point is hit with xmon=off a kernel oops
of the form below is reported:
Oops: Exception in kernel mode, sig: 5 [#1]
< snip >
Trace/breakpoint trap
To fix this the patch checks and enables debugger hooks when an
instruction or data break-point is set via xmon console. It also clears
all breakpoints when xmon is disabled via debugfs.
Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
---
arch/powerpc/xmon/xmon.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 82e1a3ee6e0f..3679f5417a7e 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1295,6 +1295,7 @@ bpt_cmds(void)
switch (cmd) {
#ifndef CONFIG_PPC_8xx
static const char badaddr[] = "Only kernel addresses are permitted for breakpoints\n";
+ static const char warnxmon[] = "xmon: Enabling debugger hooks\n";
int mode;
case 'd': /* bd - hardware data breakpoint */
mode = 7;
@@ -1315,6 +1316,11 @@ bpt_cmds(void)
dabr.address &= ~HW_BRK_TYPE_DABR;
dabr.enabled = mode | BP_DABR;
}
+ /* Enable xmon hooks if needed */
+ if (!xmon_on) {
+ printf(warnxmon);
+ xmon_on = 1;
+ }
break;
case 'i': /* bi - hardware instr breakpoint */
@@ -1335,6 +1341,12 @@ bpt_cmds(void)
if (bp != NULL) {
bp->enabled |= BP_CIABR;
iabr = bp;
+
+ /* Enable xmon hooks if needed */
+ if (!xmon_on) {
+ printf(warnxmon);
+ xmon_on = 1;
+ }
}
break;
#endif
@@ -1399,8 +1411,15 @@ bpt_cmds(void)
if (!check_bp_loc(a))
break;
bp = new_breakpoint(a);
- if (bp != NULL)
+ if (bp != NULL) {
bp->enabled |= BP_TRAP;
+
+ /* Enable xmon hooks if needed */
+ if (!xmon_on) {
+ printf(warnxmon);
+ xmon_on = 1;
+ }
+ }
break;
}
}
@@ -3651,9 +3670,22 @@ device_initcall(setup_xmon_sysrq);
#ifdef CONFIG_DEBUG_FS
static int xmon_dbgfs_set(void *data, u64 val)
{
+ int i;
+
xmon_on = !!val;
xmon_init(xmon_on);
+ /* make sure all breakpoints removed when disabling */
+ if (!xmon_on) {
+ for (i = 0; i < NBPTS; ++i)
+ bpts[i].enabled = 0;
+ /* if anything set inform user that breakpoints are cleared */
+ if (iabr || dabr.enabled)
+ pr_info("xmon: All breakpoints cleared\n");
+
+ iabr = NULL;
+ dabr.enabled = 0;
+ }
return 0;
}
--
2.14.3
^ permalink raw reply related
* Re: [PATCH] powerpc/xmon: Dont register sysrq key when kernel param xmon=off
From: Vaibhav Jain @ 2018-02-26 11:46 UTC (permalink / raw)
To: Michael Ellerman, Balbir Singh
Cc: Pan Xinhui, linux-kernel@vger.kernel.org, Nicholas Piggin,
Paul Mackerras, Douglas Miller,
open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)
In-Reply-To: <877er9l6jo.fsf@concordia.ellerman.id.au>
Thanks for the feedback Mpe,
I have sent-out a new patch incorporating your review comments at
http://patchwork.ozlabs.org/patch/877792/
--
Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
Linux Technology Center, IBM India Pvt. Ltd.
^ permalink raw reply
* Re: [PATCH 15/27] cpufreq: powerenv: Don't validate the frequency table twice
From: Michael Ellerman @ 2018-02-26 11:53 UTC (permalink / raw)
To: Viresh Kumar, Rafael Wysocki, Benjamin Herrenschmidt,
Paul Mackerras
Cc: Viresh Kumar, linux-pm, Vincent Guittot, linuxppc-dev
In-Reply-To: <3120e4db4ae3bc014d198a206f46be1305ec65e8.1519620578.git.viresh.kumar@linaro.org>
Viresh Kumar <viresh.kumar@linaro.org> writes:
> Subject: Re: [PATCH 15/27] cpufreq: powerenv: Don't validate the frequency table twice
^
powernv
> The cpufreq core is already validating the CPU frequency table after
> calling the ->init() callback of the cpufreq drivers and the drivers
> don't need to do the same anymore. Though they need to set the
> policy->freq_table field directly from the ->init() callback now.
>
> Stop validating the frequency table from powerenv driver.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> drivers/cpufreq/powernv-cpufreq.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
> index 29cdec198657..0591874856d3 100644
> --- a/drivers/cpufreq/powernv-cpufreq.c
> +++ b/drivers/cpufreq/powernv-cpufreq.c
> @@ -812,7 +812,7 @@ static int powernv_cpufreq_target_index(struct cpufreq_policy *policy,
>
> static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)
> {
> - int base, i, ret;
> + int base, i;
> struct kernfs_node *kn;
> struct global_pstate_info *gpstates;
Confusingly this function has two variables called ret, but the other
one is declared inside an if block below in context not shown.
So this hunk is correct.
> @@ -848,15 +848,10 @@ static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)
> gpstates->timer.expires = jiffies +
> msecs_to_jiffies(GPSTATE_TIMER_INTERVAL);
> spin_lock_init(&gpstates->gpstate_lock);
> - ret = cpufreq_table_validate_and_show(policy, powernv_freqs);
> -
> - if (ret < 0) {
> - kfree(policy->driver_data);
> - return ret;
> - }
>
> + policy->freq_table = powernv_freqs;
> policy->fast_switch_possible = true;
> - return ret;
> + return 0;
> }
LGTM.
cheers
^ permalink raw reply
* [RESEND][PATCH 2/2] powerpc/watchdog: include linux/processor.h for spin_until_cond
From: Sudeep Holla @ 2018-02-26 12:16 UTC (permalink / raw)
To: linuxppc-dev, Michael Ellerman, Nicholas Piggin; +Cc: Sudeep Holla
In-Reply-To: <1519647376-3352-1-git-send-email-sudeep.holla@arm.com>
This implementation uses spin_until_cond in wd_smp_lock including
neither linux/processor.h nor asm/processor.h
This patch includes linux/processor.h here for spin_until_cond usage.
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
arch/powerpc/kernel/watchdog.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c
index 6256dc3b0087..f4359fde99f3 100644
--- a/arch/powerpc/kernel/watchdog.c
+++ b/arch/powerpc/kernel/watchdog.c
@@ -24,6 +24,7 @@
#include <linux/kdebug.h>
#include <linux/sched/debug.h>
#include <linux/delay.h>
+#include <linux/processor.h>
#include <linux/smp.h>
#include <asm/paca.h>
--
2.7.4
^ permalink raw reply related
* [RESEND][PATCH 1/2] powerpc/64: drop redundant defination of spin_until_cond
From: Sudeep Holla @ 2018-02-26 12:16 UTC (permalink / raw)
To: linuxppc-dev, Michael Ellerman, Nicholas Piggin; +Cc: Sudeep Holla
linux/processor.h has exactly same defination for spin_until_cond.
Drop the redundant defination in asm/processor.h
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
arch/powerpc/include/asm/processor.h | 11 -----------
1 file changed, 11 deletions(-)
Hi,
(Resending as I got some errors from the mail server today)
When I was planning to use spin_until_cond, I came across the same defination
at 2 different headers, one of which includes the other and takes care of
enabling the defination in case of undefinded condition.
I found it redundant, but I may be wrong.
Regards,
Sudeep
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 01299cdc9806..4816be3be02c 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -438,17 +438,6 @@ static inline unsigned long __pack_fe01(unsigned int fpmode)
#define spin_end() HMT_medium()
-#define spin_until_cond(cond) \
-do { \
- if (unlikely(!(cond))) { \
- spin_begin(); \
- do { \
- spin_cpu_relax(); \
- } while (!(cond)); \
- spin_end(); \
- } \
-} while (0)
-
#else
#define cpu_relax() barrier()
#endif
--
2.7.4
^ permalink raw reply related
* [PATCH V2 0/4] Add support for 4PB virtual address space on hash
From: Aneesh Kumar K.V @ 2018-02-26 14:08 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: linuxppc-dev, Aneesh Kumar K.V
This patch series extended the max virtual address space value from 512TB
to 4PB with 64K page size. We do that by allocating one vsid context for
each 512TB range. More details of that is explained in patch 3.
Aneesh Kumar K.V (4):
powerpc/mm/slice: Update documentation in the file.
powerpc/mm/slice: Reduce the stack usage in slice_get_unmapped_area
powerpc/mm: Add support for handling > 512TB address in SLB miss
powerpc/mm/hash64: Increase the VA range
arch/powerpc/include/asm/book3s/64/hash-4k.h | 6 ++
arch/powerpc/include/asm/book3s/64/hash-64k.h | 7 +-
arch/powerpc/include/asm/book3s/64/mmu-hash.h | 6 +-
arch/powerpc/include/asm/book3s/64/mmu.h | 24 +++++
arch/powerpc/include/asm/processor.h | 16 ++-
arch/powerpc/kernel/exceptions-64s.S | 12 ++-
arch/powerpc/mm/copro_fault.c | 2 +-
arch/powerpc/mm/hash_utils_64.c | 4 +-
arch/powerpc/mm/init_64.c | 6 --
arch/powerpc/mm/mmu_context_book3s64.c | 17 ++-
arch/powerpc/mm/pgtable-hash64.c | 2 +-
arch/powerpc/mm/pgtable_64.c | 5 -
arch/powerpc/mm/slb.c | 150 ++++++++++++++++++++++++++
arch/powerpc/mm/slb_low.S | 6 +-
arch/powerpc/mm/slice.c | 61 ++++++-----
arch/powerpc/mm/tlb_hash64.c | 2 +-
16 files changed, 273 insertions(+), 53 deletions(-)
--
2.14.3
^ permalink raw reply
* [PATCH V2 1/4] powerpc/mm/slice: Update documentation in the file.
From: Aneesh Kumar K.V @ 2018-02-26 14:08 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: linuxppc-dev, Aneesh Kumar K.V
In-Reply-To: <20180226140826.11641-1-aneesh.kumar@linux.vnet.ibm.com>
We will make code changes in the next patch. To make the review easier split
the documentation update in to a seperate patch.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/mm/slice.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index 98b53d48968f..259bbda9a222 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -478,7 +478,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
* already
*/
slice_mask_for_size(mm, psize, &good_mask, high_limit);
- slice_print_mask(" good_mask", good_mask);
+ slice_print_mask("Mask for page size", good_mask);
/*
* Here "good" means slices that are already the right page size,
@@ -507,15 +507,17 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
slice_or_mask(&good_mask, &compat_mask);
}
#endif
-
/* First check hint if it's valid or if we have MAP_FIXED */
if (addr != 0 || fixed) {
- /* Build a mask for the requested range */
+ /*
+ * Build a mask for the requested range
+ */
slice_range_to_mask(addr, len, &mask);
- slice_print_mask(" mask", mask);
+ slice_print_mask("Request range mask", mask);
- /* Check if we fit in the good mask. If we do, we just return,
- * nothing else to do
+ /*
+ * Check if we fit in the good mask. If we do, we just
+ * return, nothing else to do
*/
if (slice_check_fit(mm, mask, good_mask)) {
slice_dbg(" fits good !\n");
@@ -553,8 +555,8 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
return -EBUSY;
slice_dbg(" search...\n");
-
- /* If we had a hint that didn't work out, see if we can fit
+ /*
+ * If we had a hint that didn't work out, see if we can fit
* anywhere in the good area.
*/
if (addr) {
@@ -573,7 +575,16 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
psize, topdown, high_limit);
#ifdef CONFIG_PPC_64K_PAGES
+ /*
+ * If we didn't request for fixed mapping, we never looked at
+ * compat area. Now that we are not finding space, let's look
+ * at the 4K slice also.
+ */
if (addr == -ENOMEM && psize == MMU_PAGE_64K) {
+ /*
+ * mask variable is free here. Use that for compat
+ * size mask.
+ */
/* retry the search with 4k-page slices included */
slice_or_mask(&potential_mask, &compat_mask);
addr = slice_find_area(mm, len, potential_mask,
--
2.14.3
^ permalink raw reply related
* [PATCH V2 2/4] powerpc/mm/slice: Reduce the stack usage in slice_get_unmapped_area
From: Aneesh Kumar K.V @ 2018-02-26 14:08 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: linuxppc-dev, Aneesh Kumar K.V
In-Reply-To: <20180226140826.11641-1-aneesh.kumar@linux.vnet.ibm.com>
This patch kill potential_mask and compat_mask variable and instead use tmp_mask
so that we can reduce the stack usage. This is required so that we can increase
the high_slices bitmap to a larger value.
The patch does result in extra computation in final stage, where it ends up
recomputing the compat mask again.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/mm/slice.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index 259bbda9a222..832c681c341a 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -413,8 +413,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
{
struct slice_mask mask;
struct slice_mask good_mask;
- struct slice_mask potential_mask;
- struct slice_mask compat_mask;
+ struct slice_mask tmp_mask;
int fixed = (flags & MAP_FIXED);
int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT);
unsigned long page_size = 1UL << pshift;
@@ -449,11 +448,8 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
bitmap_zero(mask.high_slices, SLICE_NUM_HIGH);
/* silence stupid warning */;
- potential_mask.low_slices = 0;
- bitmap_zero(potential_mask.high_slices, SLICE_NUM_HIGH);
-
- compat_mask.low_slices = 0;
- bitmap_zero(compat_mask.high_slices, SLICE_NUM_HIGH);
+ tmp_mask.low_slices = 0;
+ bitmap_zero(tmp_mask.high_slices, SLICE_NUM_HIGH);
/* Sanity checks */
BUG_ON(mm->task_size == 0);
@@ -502,9 +498,11 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
#ifdef CONFIG_PPC_64K_PAGES
/* If we support combo pages, we can allow 64k pages in 4k slices */
if (psize == MMU_PAGE_64K) {
- slice_mask_for_size(mm, MMU_PAGE_4K, &compat_mask, high_limit);
+ slice_mask_for_size(mm, MMU_PAGE_4K, &tmp_mask, high_limit);
if (fixed)
- slice_or_mask(&good_mask, &compat_mask);
+ slice_or_mask(&good_mask, &tmp_mask);
+
+ slice_print_mask("Mask for compat page size", tmp_mask);
}
#endif
/* First check hint if it's valid or if we have MAP_FIXED */
@@ -541,11 +539,11 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
* We don't fit in the good mask, check what other slices are
* empty and thus can be converted
*/
- slice_mask_for_free(mm, &potential_mask, high_limit);
- slice_or_mask(&potential_mask, &good_mask);
- slice_print_mask(" potential", potential_mask);
+ slice_mask_for_free(mm, &tmp_mask, high_limit);
+ slice_or_mask(&tmp_mask, &good_mask);
+ slice_print_mask("Free area/potential ", tmp_mask);
- if ((addr != 0 || fixed) && slice_check_fit(mm, mask, potential_mask)) {
+ if ((addr != 0 || fixed) && slice_check_fit(mm, mask, tmp_mask)) {
slice_dbg(" fits potential !\n");
goto convert;
}
@@ -571,7 +569,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
/* Now let's see if we can find something in the existing slices
* for that size plus free slices
*/
- addr = slice_find_area(mm, len, potential_mask,
+ addr = slice_find_area(mm, len, tmp_mask,
psize, topdown, high_limit);
#ifdef CONFIG_PPC_64K_PAGES
@@ -585,9 +583,10 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
* mask variable is free here. Use that for compat
* size mask.
*/
+ slice_mask_for_size(mm, MMU_PAGE_4K, &mask, high_limit);
/* retry the search with 4k-page slices included */
- slice_or_mask(&potential_mask, &compat_mask);
- addr = slice_find_area(mm, len, potential_mask,
+ slice_or_mask(&tmp_mask, &mask);
+ addr = slice_find_area(mm, len, tmp_mask,
psize, topdown, high_limit);
}
#endif
@@ -600,8 +599,9 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
slice_print_mask(" mask", mask);
convert:
+ slice_mask_for_size(mm, MMU_PAGE_4K, &tmp_mask, high_limit);
slice_andnot_mask(&mask, &good_mask);
- slice_andnot_mask(&mask, &compat_mask);
+ slice_andnot_mask(&mask, &tmp_mask);
if (mask.low_slices || !bitmap_empty(mask.high_slices, SLICE_NUM_HIGH)) {
slice_convert(mm, mask, psize);
if (psize > MMU_PAGE_BASE)
--
2.14.3
^ permalink raw reply related
* [PATCH V2 3/4] powerpc/mm: Add support for handling > 512TB address in SLB miss
From: Aneesh Kumar K.V @ 2018-02-26 14:08 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: linuxppc-dev, Aneesh Kumar K.V
In-Reply-To: <20180226140826.11641-1-aneesh.kumar@linux.vnet.ibm.com>
For address above 512TB we allocate additonal mmu context. To make it all
easy address above 512TB is handled with IR/DR=1 and with stack frame setup.
We do the additonal context allocation in SLB miss handler. If the context is
not allocated, we enable interrupts and allocate the context and retry the
access which will again result in a SLB miss.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/book3s/64/hash-4k.h | 6 ++
arch/powerpc/include/asm/book3s/64/hash-64k.h | 5 +
arch/powerpc/include/asm/book3s/64/mmu-hash.h | 6 +-
arch/powerpc/include/asm/book3s/64/mmu.h | 24 +++++
arch/powerpc/include/asm/processor.h | 7 ++
arch/powerpc/kernel/exceptions-64s.S | 12 ++-
arch/powerpc/mm/copro_fault.c | 2 +-
arch/powerpc/mm/hash_utils_64.c | 4 +-
arch/powerpc/mm/mmu_context_book3s64.c | 17 ++-
arch/powerpc/mm/pgtable-hash64.c | 2 +-
arch/powerpc/mm/slb.c | 150 ++++++++++++++++++++++++++
arch/powerpc/mm/slb_low.S | 6 +-
arch/powerpc/mm/tlb_hash64.c | 2 +-
13 files changed, 228 insertions(+), 15 deletions(-)
diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h
index 67c5475311ee..af2ba9875f18 100644
--- a/arch/powerpc/include/asm/book3s/64/hash-4k.h
+++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h
@@ -11,6 +11,12 @@
#define H_PUD_INDEX_SIZE 9
#define H_PGD_INDEX_SIZE 9
+/*
+ * No of address bits below which we use the default context
+ * for slb allocation. For 4k this is 64TB.
+ */
+#define H_BITS_FIRST_CONTEXT 46
+
#ifndef __ASSEMBLY__
#define H_PTE_TABLE_SIZE (sizeof(pte_t) << H_PTE_INDEX_SIZE)
#define H_PMD_TABLE_SIZE (sizeof(pmd_t) << H_PMD_INDEX_SIZE)
diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h b/arch/powerpc/include/asm/book3s/64/hash-64k.h
index 3bcf269f8f55..0ee0fc1ad675 100644
--- a/arch/powerpc/include/asm/book3s/64/hash-64k.h
+++ b/arch/powerpc/include/asm/book3s/64/hash-64k.h
@@ -6,6 +6,11 @@
#define H_PMD_INDEX_SIZE 10
#define H_PUD_INDEX_SIZE 7
#define H_PGD_INDEX_SIZE 8
+/*
+ * No of address bits below which we use the default context
+ * for slb allocation. For 64k this is 512TB.
+ */
+#define H_BITS_FIRST_CONTEXT 49
/*
* 64k aligned address free up few of the lower bits of RPN for us
diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
index 50ed64fba4ae..8ee83f6e9c84 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
@@ -691,8 +691,8 @@ static inline int user_segment_size(unsigned long addr)
return MMU_SEGSIZE_256M;
}
-static inline unsigned long get_vsid(unsigned long context, unsigned long ea,
- int ssize)
+static inline unsigned long __get_vsid(unsigned long context, unsigned long ea,
+ int ssize)
{
unsigned long va_bits = VA_BITS;
unsigned long vsid_bits;
@@ -744,7 +744,7 @@ static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize)
*/
context = (ea >> 60) - KERNEL_REGION_CONTEXT_OFFSET;
- return get_vsid(context, ea, ssize);
+ return __get_vsid(context, ea, ssize);
}
unsigned htab_shift_for_mem_size(unsigned long mem_size);
diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h b/arch/powerpc/include/asm/book3s/64/mmu.h
index 0abeb0e2d616..f3fe5c772e32 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu.h
@@ -82,6 +82,12 @@ struct spinlock;
typedef struct {
mm_context_id_t id;
+ /*
+ * One context for each 512TB above the first 512TB.
+ * First 512TB context is saved in id and is also used
+ * as PIDR.
+ */
+ mm_context_id_t extended_id[(TASK_SIZE_USER64/TASK_CONTEXT_SIZE) - 1];
u16 user_psize; /* page size index */
/* Number of bits in the mm_cpumask */
@@ -174,5 +180,23 @@ extern void radix_init_pseries(void);
static inline void radix_init_pseries(void) { };
#endif
+static inline int get_esid_context(mm_context_t *ctx, unsigned long ea)
+{
+ int index = ea >> H_BITS_FIRST_CONTEXT;
+
+ if (index == 0)
+ return ctx->id;
+ return ctx->extended_id[--index];
+}
+
+static inline unsigned long get_user_vsid(mm_context_t *ctx,
+ unsigned long ea, int ssize)
+{
+ unsigned long context = get_esid_context(ctx, ea);
+
+ return __get_vsid(context, ea, ssize);
+}
+
+
#endif /* __ASSEMBLY__ */
#endif /* _ASM_POWERPC_BOOK3S_64_MMU_H_ */
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 01299cdc9806..70d65b482504 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -119,9 +119,16 @@ void release_thread(struct task_struct *);
*/
#define TASK_SIZE_USER64 TASK_SIZE_512TB
#define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_128TB
+#define TASK_CONTEXT_SIZE TASK_SIZE_512TB
#else
#define TASK_SIZE_USER64 TASK_SIZE_64TB
#define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_64TB
+/*
+ * We don't need allocate extended context id for 4K
+ * page size. We limit max address on this config to
+ * 64TB.
+ */
+#define TASK_CONTEXT_SIZE TASK_SIZE_64TB
#endif
/*
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 3ac87e53b3da..166b8c0f1830 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -620,8 +620,12 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_TYPE_RADIX)
ld r10,PACA_EXSLB+EX_LR(r13)
lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */
mtlr r10
+ /*
+ * Large address, check whether we have to allocate new
+ * contexts.
+ */
+ beq- 8f
- beq- 8f /* if bad address, make full stack frame */
bne- cr5,2f /* if unrecoverable exception, oops */
@@ -685,7 +689,7 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_TYPE_RADIX)
mr r3,r12
mfspr r11,SPRN_SRR0
mfspr r12,SPRN_SRR1
- LOAD_HANDLER(r10,bad_addr_slb)
+ LOAD_HANDLER(r10, multi_context_slb)
mtspr SPRN_SRR0,r10
ld r10,PACAKMSR(r13)
mtspr SPRN_SRR1,r10
@@ -700,7 +704,7 @@ EXC_COMMON_BEGIN(unrecov_slb)
bl unrecoverable_exception
b 1b
-EXC_COMMON_BEGIN(bad_addr_slb)
+EXC_COMMON_BEGIN(multi_context_slb)
EXCEPTION_PROLOG_COMMON(0x380, PACA_EXSLB)
RECONCILE_IRQ_STATE(r10, r11)
ld r3, PACA_EXSLB+EX_DAR(r13)
@@ -710,7 +714,7 @@ EXC_COMMON_BEGIN(bad_addr_slb)
std r10, _TRAP(r1)
2: bl save_nvgprs
addi r3, r1, STACK_FRAME_OVERHEAD
- bl slb_miss_bad_addr
+ bl handle_multi_context_slb_miss
b ret_from_except
EXC_REAL_BEGIN(hardware_interrupt, 0x500, 0x100)
diff --git a/arch/powerpc/mm/copro_fault.c b/arch/powerpc/mm/copro_fault.c
index 697b70ad1195..7d0945bd3a61 100644
--- a/arch/powerpc/mm/copro_fault.c
+++ b/arch/powerpc/mm/copro_fault.c
@@ -112,7 +112,7 @@ int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb)
return 1;
psize = get_slice_psize(mm, ea);
ssize = user_segment_size(ea);
- vsid = get_vsid(mm->context.id, ea, ssize);
+ vsid = get_user_vsid(&mm->context, ea, ssize);
vsidkey = SLB_VSID_USER;
break;
case VMALLOC_REGION_ID:
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index cf290d415dcd..d6fdf20cdd7b 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -1262,7 +1262,7 @@ int hash_page_mm(struct mm_struct *mm, unsigned long ea,
}
psize = get_slice_psize(mm, ea);
ssize = user_segment_size(ea);
- vsid = get_vsid(mm->context.id, ea, ssize);
+ vsid = get_user_vsid(&mm->context, ea, ssize);
break;
case VMALLOC_REGION_ID:
vsid = get_kernel_vsid(ea, mmu_kernel_ssize);
@@ -1527,7 +1527,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
/* Get VSID */
ssize = user_segment_size(ea);
- vsid = get_vsid(mm->context.id, ea, ssize);
+ vsid = get_user_vsid(&mm->context, ea, ssize);
if (!vsid)
return;
/*
diff --git a/arch/powerpc/mm/mmu_context_book3s64.c b/arch/powerpc/mm/mmu_context_book3s64.c
index 929d9ef7083f..9cea7f33a00c 100644
--- a/arch/powerpc/mm/mmu_context_book3s64.c
+++ b/arch/powerpc/mm/mmu_context_book3s64.c
@@ -185,6 +185,19 @@ void __destroy_context(int context_id)
}
EXPORT_SYMBOL_GPL(__destroy_context);
+void destroy_extended_context(mm_context_t *ctx)
+{
+ int index, context_id;
+
+ spin_lock(&mmu_context_lock);
+ for (index = 1; index < (TASK_SIZE_USER64/TASK_CONTEXT_SIZE); index++) {
+ context_id = ctx->extended_id[index - 1];
+ if (context_id)
+ ida_remove(&mmu_context_ida, context_id);
+ }
+ spin_unlock(&mmu_context_lock);
+}
+
#ifdef CONFIG_PPC_64K_PAGES
static void destroy_pagetable_page(struct mm_struct *mm)
{
@@ -220,8 +233,10 @@ void destroy_context(struct mm_struct *mm)
#endif
if (radix_enabled())
WARN_ON(process_tb[mm->context.id].prtb0 != 0);
- else
+ else {
subpage_prot_free(mm);
+ destroy_extended_context(&mm->context);
+ }
destroy_pagetable_page(mm);
__destroy_context(mm->context.id);
mm->context.id = MMU_NO_CONTEXT;
diff --git a/arch/powerpc/mm/pgtable-hash64.c b/arch/powerpc/mm/pgtable-hash64.c
index 469808e77e58..a87b18cf6749 100644
--- a/arch/powerpc/mm/pgtable-hash64.c
+++ b/arch/powerpc/mm/pgtable-hash64.c
@@ -320,7 +320,7 @@ void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr,
if (!is_kernel_addr(addr)) {
ssize = user_segment_size(addr);
- vsid = get_vsid(mm->context.id, addr, ssize);
+ vsid = get_user_vsid(&mm->context, addr, ssize);
WARN_ON(vsid == 0);
} else {
vsid = get_kernel_vsid(addr, mmu_kernel_ssize);
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index 13cfe413b40d..917438457b2f 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -23,6 +23,7 @@
#include <asm/smp.h>
#include <linux/compiler.h>
#include <linux/mm_types.h>
+#include <linux/context_tracking.h>
#include <asm/udbg.h>
#include <asm/code-patching.h>
@@ -340,3 +341,152 @@ void slb_initialize(void)
asm volatile("isync":::"memory");
}
+
+/*
+ * Only handle insert of 1TB slb entries.
+ */
+static void insert_slb_entry(unsigned long vsid, unsigned long ea,
+ int bpsize, int ssize)
+{
+ int slb_cache_index;
+ unsigned long flags;
+ enum slb_index index;
+ unsigned long vsid_data, esid_data;
+
+ /*
+ * We are irq disabled, hence should be safe
+ * to access PACA.
+ */
+ index = get_paca()->stab_rr;
+ /*
+ * simple round roubin replacement of slb.
+ */
+ if (index < mmu_slb_size)
+ index++;
+ else
+ index = SLB_NUM_BOLTED;
+ get_paca()->stab_rr = index;
+
+ flags = SLB_VSID_USER | mmu_psize_defs[bpsize].sllp;
+ vsid_data = (vsid << SLB_VSID_SHIFT_1T) | flags |
+ ((unsigned long) ssize << SLB_VSID_SSIZE_SHIFT);
+ esid_data = mk_esid_data(ea, mmu_highuser_ssize, index);
+
+ asm volatile("slbmte %0, %1" : : "r" (vsid_data), "r" (esid_data)
+ : "memory");
+ /*
+ * Now update slb cache entries
+ */
+ slb_cache_index = get_paca()->slb_cache_ptr;
+ if (slb_cache_index < SLB_CACHE_ENTRIES) {
+ /*
+ * We have space in slb cache for optimized switch_slb().
+ * Top 36 bits from esid_data as per ISA
+ */
+ get_paca()->slb_cache[slb_cache_index++] = esid_data >> 28;
+ }
+ /*
+ * if we are full, just increment and return.
+ */
+ get_paca()->slb_cache_ptr++;
+ return;
+}
+
+static void alloc_extended_context(struct mm_struct *mm, unsigned long ea)
+{
+ int context_id;
+
+ int index = (ea >> H_BITS_FIRST_CONTEXT) - 1;
+
+ /*
+ * we need to do locking only here. If this value was not set before
+ * we will have taken an SLB miss and will reach here. The value will
+ * be either 0 or a valid extended context. We need to make sure two
+ * parallel SLB miss don't end up allocating extended_context for the
+ * same range. The locking below ensures that. For now we take the
+ * heavy mmap_sem. But can be changed to per mm_context_t custom lock
+ * if needed.
+ */
+ down_read(&mm->mmap_sem);
+ context_id = hash__alloc_context_id();
+ if (context_id < 0) {
+ up_read(&mm->mmap_sem);
+ pagefault_out_of_memory();
+ return;
+ }
+ /* Check for parallel allocation after holding lock */
+ if (!mm->context.extended_id[index])
+ mm->context.extended_id[index] = context_id;
+ else
+ __destroy_context(context_id);
+ up_read(&mm->mmap_sem);
+ return;
+}
+
+static void __handle_multi_context_slb_miss(struct pt_regs *regs,
+ unsigned long ea)
+{
+ int context, bpsize;
+ unsigned long vsid;
+ struct mm_struct *mm = current->mm;
+
+ context = get_esid_context(&mm->context, ea);
+ if (!context) {
+ /*
+ * haven't allocated context yet for this range.
+ * Enable irq and allo context and return. We will
+ * take an slb miss on this again and come here with
+ * allocated context.
+ */
+ /* We restore the interrupt state now */
+ if (!arch_irq_disabled_regs(regs))
+ local_irq_enable();
+ return alloc_extended_context(mm, ea);
+ }
+ /*
+ * We are always above 1TB, hence use high user segment size.
+ */
+ vsid = __get_vsid(context, ea, mmu_highuser_ssize);
+ bpsize = get_slice_psize(mm, ea);
+
+ insert_slb_entry(vsid, ea, bpsize, mmu_highuser_ssize);
+ return;
+}
+
+/*
+ * exception_enter() handling? FIXME!!
+ */
+void handle_multi_context_slb_miss(struct pt_regs *regs)
+{
+ enum ctx_state prev_state = exception_enter();
+ unsigned long ea = regs->dar;
+
+ /*
+ * Kernel always runs with single context. Hence
+ * anything that request for multi context is
+ * considered bad slb request.
+ */
+ if (!user_mode(regs))
+ return bad_page_fault(regs, ea, SIGSEGV);
+
+ if (REGION_ID(ea) != USER_REGION_ID)
+ goto slb_bad_addr;
+ /*
+ * Are we beyound what the page table layout support ?
+ */
+ if ((ea & ~REGION_MASK) >= H_PGTABLE_RANGE)
+ goto slb_bad_addr;
+
+ /* Lower address should be handled by asm code */
+ if (ea <= (1UL << H_BITS_FIRST_CONTEXT))
+ goto slb_bad_addr;
+
+ __handle_multi_context_slb_miss(regs, ea);
+ exception_exit(prev_state);
+ return;
+
+slb_bad_addr:
+ _exception(SIGSEGV, regs, SEGV_BNDERR, ea);
+ exception_exit(prev_state);
+ return;
+}
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S
index 2cf5ef3fc50d..425b4c5ec1e9 100644
--- a/arch/powerpc/mm/slb_low.S
+++ b/arch/powerpc/mm/slb_low.S
@@ -75,10 +75,12 @@ ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_68_BIT_VA)
*/
_GLOBAL(slb_allocate)
/*
- * check for bad kernel/user address
+ * Check for address range for which we need to handle multi context. For
+ * the default context we allocate the slb via the fast path. For large
+ * address we branch out to C-code and look at additional context allocated.
* (ea & ~REGION_MASK) >= PGTABLE_RANGE
*/
- rldicr. r9,r3,4,(63 - H_PGTABLE_EADDR_SIZE - 4)
+ rldicr. r9,r3,4,(63 - H_BITS_FIRST_CONTEXT - 4)
bne- 8f
srdi r9,r3,60 /* get region */
diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c
index 9b23f12e863c..87d71dd25441 100644
--- a/arch/powerpc/mm/tlb_hash64.c
+++ b/arch/powerpc/mm/tlb_hash64.c
@@ -89,7 +89,7 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
/* Build full vaddr */
if (!is_kernel_addr(addr)) {
ssize = user_segment_size(addr);
- vsid = get_vsid(mm->context.id, addr, ssize);
+ vsid = get_user_vsid(&mm->context, addr, ssize);
} else {
vsid = get_kernel_vsid(addr, mmu_kernel_ssize);
ssize = mmu_kernel_ssize;
--
2.14.3
^ permalink raw reply related
* [PATCH V2 4/4] powerpc/mm/hash64: Increase the VA range
From: Aneesh Kumar K.V @ 2018-02-26 14:08 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: linuxppc-dev, Aneesh Kumar K.V
In-Reply-To: <20180226140826.11641-1-aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/book3s/64/hash-64k.h | 2 +-
arch/powerpc/include/asm/processor.h | 9 ++++++++-
arch/powerpc/mm/init_64.c | 6 ------
arch/powerpc/mm/pgtable_64.c | 5 -----
4 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h b/arch/powerpc/include/asm/book3s/64/hash-64k.h
index 0ee0fc1ad675..02098d7fe177 100644
--- a/arch/powerpc/include/asm/book3s/64/hash-64k.h
+++ b/arch/powerpc/include/asm/book3s/64/hash-64k.h
@@ -4,7 +4,7 @@
#define H_PTE_INDEX_SIZE 8
#define H_PMD_INDEX_SIZE 10
-#define H_PUD_INDEX_SIZE 7
+#define H_PUD_INDEX_SIZE 10
#define H_PGD_INDEX_SIZE 8
/*
* No of address bits below which we use the default context
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 70d65b482504..a621a068880a 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -109,6 +109,13 @@ void release_thread(struct task_struct *);
#define TASK_SIZE_64TB (0x0000400000000000UL)
#define TASK_SIZE_128TB (0x0000800000000000UL)
#define TASK_SIZE_512TB (0x0002000000000000UL)
+#define TASK_SIZE_1PB (0x0004000000000000UL)
+#define TASK_SIZE_2PB (0x0008000000000000UL)
+/*
+ * With 52 bits in the address we can support
+ * upto 4PB of range.
+ */
+#define TASK_SIZE_4PB (0x0010000000000000UL)
/*
* For now 512TB is only supported with book3s and 64K linux page size.
@@ -117,7 +124,7 @@ void release_thread(struct task_struct *);
/*
* Max value currently used:
*/
-#define TASK_SIZE_USER64 TASK_SIZE_512TB
+#define TASK_SIZE_USER64 TASK_SIZE_4PB
#define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_128TB
#define TASK_CONTEXT_SIZE TASK_SIZE_512TB
#else
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index fdb424a29f03..63470b06c502 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -68,12 +68,6 @@
#include "mmu_decl.h"
-#ifdef CONFIG_PPC_BOOK3S_64
-#if H_PGTABLE_RANGE > USER_VSID_RANGE
-#warning Limited user VSID range means pagetable space is wasted
-#endif
-#endif /* CONFIG_PPC_BOOK3S_64 */
-
phys_addr_t memstart_addr = ~0;
EXPORT_SYMBOL_GPL(memstart_addr);
phys_addr_t kernstart_addr;
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 28c980eb4422..16636bdf3331 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -57,11 +57,6 @@
#include "mmu_decl.h"
-#ifdef CONFIG_PPC_BOOK3S_64
-#if TASK_SIZE_USER64 > (1UL << (ESID_BITS + SID_SHIFT))
-#error TASK_SIZE_USER64 exceeds user VSID range
-#endif
-#endif
#ifdef CONFIG_PPC_BOOK3S_64
/*
--
2.14.3
^ permalink raw reply related
* [PATCH V2] powerpc: Don't do runtime futex_cmpxchg test
From: Aneesh Kumar K.V @ 2018-02-26 14:09 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: linuxppc-dev, Aneesh Kumar K.V
futex_detect_cmpxchg() does a cmpxchg_futex_value_locked on a NULL user addr to
runtime detect whether architecture implements atomic cmpxchg for futex. POWER
do implement the feature and hence we can enable the config instead of depending
on runtime detection.
We could possible enable this on everything. For now limitted to book3s_64
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
arch/powerpc/platforms/Kconfig.cputype | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index a429d859f15d..31bc2bd5dfd1 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -75,6 +75,7 @@ config PPC_BOOK3S_64
select ARCH_SUPPORTS_NUMA_BALANCING
select IRQ_WORK
select HAVE_KERNEL_XZ
+ select HAVE_FUTEX_CMPXCHG if FUTEX
config PPC_BOOK3E_64
bool "Embedded processors"
--
2.14.3
^ permalink raw reply related
* Re: [PATCH V2 0/4] Add support for 4PB virtual address space on hash
From: Aneesh Kumar K.V @ 2018-02-26 14:15 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: linuxppc-dev
In-Reply-To: <20180226140826.11641-1-aneesh.kumar@linux.vnet.ibm.com>
On 02/26/2018 07:38 PM, Aneesh Kumar K.V wrote:
> This patch series extended the max virtual address space value from 512TB
> to 4PB with 64K page size. We do that by allocating one vsid context for
> each 512TB range. More details of that is explained in patch 3.
>
>
> Aneesh Kumar K.V (4):
> powerpc/mm/slice: Update documentation in the file.
> powerpc/mm/slice: Reduce the stack usage in slice_get_unmapped_area
> powerpc/mm: Add support for handling > 512TB address in SLB miss
> powerpc/mm/hash64: Increase the VA range
>
> arch/powerpc/include/asm/book3s/64/hash-4k.h | 6 ++
> arch/powerpc/include/asm/book3s/64/hash-64k.h | 7 +-
> arch/powerpc/include/asm/book3s/64/mmu-hash.h | 6 +-
> arch/powerpc/include/asm/book3s/64/mmu.h | 24 +++++
> arch/powerpc/include/asm/processor.h | 16 ++-
> arch/powerpc/kernel/exceptions-64s.S | 12 ++-
> arch/powerpc/mm/copro_fault.c | 2 +-
> arch/powerpc/mm/hash_utils_64.c | 4 +-
> arch/powerpc/mm/init_64.c | 6 --
> arch/powerpc/mm/mmu_context_book3s64.c | 17 ++-
> arch/powerpc/mm/pgtable-hash64.c | 2 +-
> arch/powerpc/mm/pgtable_64.c | 5 -
> arch/powerpc/mm/slb.c | 150 ++++++++++++++++++++++++++
> arch/powerpc/mm/slb_low.S | 6 +-
> arch/powerpc/mm/slice.c | 61 ++++++-----
> arch/powerpc/mm/tlb_hash64.c | 2 +-
> 16 files changed, 273 insertions(+), 53 deletions(-)
>
Dependent patch
"[PATCH v5 1/6] powerpc/mm/slice: Remove intermediate bitmap copy"
https://marc.info/?l=linux-kernel&m=151930964805502&w=2
-aneesh
^ permalink raw reply
* Re: [PATCH 00/38] cxlflash: OpenCXL transport support
From: Matthew R. Ochs @ 2018-02-26 14:43 UTC (permalink / raw)
To: Uma Krishnan
Cc: linux-scsi, James Bottomley, Martin K. Petersen, Manoj N. Kumar,
linuxppc-dev, Andrew Donnellan, Frederic Barrat,
Christophe Lombard
In-Reply-To: <1519338010-51782-1-git-send-email-ukrishn@linux.vnet.ibm.com>
On Thu, Feb 22, 2018 at 04:20:10PM -0600, Uma Krishnan wrote:
> This patch series adds OpenCXL support to the cxlflash driver. With
> this support, new devices using the OpenCXL transport will be supported
> by the cxlflash driver along with the existing CXL devices. An effort is
> made to keep this transport specific function independent of the existing
> core driver that communicates with the AFU.
>
> The first three patches contain a minor fix and staging improvements.
>
> This series is intended for 4.17 and is bisectable.
I'm fine with the entire series and agree that the OpenCXL terminology
should be consistent throughout the kernel.
So...contingent upon a V2 with OpenCXL references being replaced by OCXL:
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
>
> Matthew R. Ochs (1):
> cxlflash: Avoid clobbering context control register value
>
> Uma Krishnan (37):
> cxlflash: Preserve number of interrupts for master contexts
> cxlflash: Add argument identifier names
> cxlflash: Introduce OpenCXL backend
> cxlflash: Hardware AFU for OpenCXL
> cxlflash: Read host function configuration
> cxlflash: Setup function acTag range
> cxlflash: Read host AFU configuration
> cxlflash: Setup AFU acTag range
> cxlflash: Setup AFU PASID
> cxlflash: Adapter context support for OpenCXL
> cxlflash: Use IDR to manage adapter contexts
> cxlflash: Support adapter file descriptors for OpenCXL
> cxlflash: Support adapter context discovery
> cxlflash: Support image reload policy modification
> cxlflash: MMIO map the AFU
> cxlflash: Support starting an adapter context
> cxlflash: Support process specific mappings
> cxlflash: Support AFU state toggling
> cxlflash: Support reading adapter VPD data
> cxlflash: Setup function OpenCXL link
> cxlflash: Setup OpenCXL transaction layer
> cxlflash: Support process element lifecycle
> cxlflash: Support AFU interrupt management
> cxlflash: Support AFU interrupt mapping and registration
> cxlflash: Support starting user contexts
> cxlflash: Support adapter context polling
> cxlflash: Support adapter context reading
> cxlflash: Support adapter context mmap and release
> cxlflash: Support file descriptor mapping
> cxlflash: Introduce object handle fop
> cxlflash: Setup LISNs for user contexts
> cxlflash: Setup LISNs for master contexts
> cxlflash: Update synchronous interrupt status bits
> cxlflash: Introduce OCXL context state machine
> cxlflash: Register for translation errors
> cxlflash: Support AFU reset
> cxlflash: Enable OpenCXL operations
>
> drivers/scsi/cxlflash/Kconfig | 2 +-
> drivers/scsi/cxlflash/Makefile | 2 +-
> drivers/scsi/cxlflash/backend.h | 50 +-
> drivers/scsi/cxlflash/common.h | 10 +-
> drivers/scsi/cxlflash/cxl_hw.c | 13 +
> drivers/scsi/cxlflash/main.c | 55 +-
> drivers/scsi/cxlflash/main.h | 1 +
> drivers/scsi/cxlflash/ocxl_hw.c | 1428 +++++++++++++++++++++++++++++++++++++
> drivers/scsi/cxlflash/ocxl_hw.h | 76 ++
> drivers/scsi/cxlflash/sislite.h | 41 +-
> drivers/scsi/cxlflash/superpipe.c | 14 +
> 11 files changed, 1644 insertions(+), 48 deletions(-)
> create mode 100644 drivers/scsi/cxlflash/ocxl_hw.c
> create mode 100644 drivers/scsi/cxlflash/ocxl_hw.h
>
> --
> 2.1.0
>
^ permalink raw reply
* Re: [PATCH 01/21] powerpc: Remove warning on array size when empty
From: Andy Shevchenko @ 2018-02-26 14:44 UTC (permalink / raw)
To: Mathieu Malaterre
Cc: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Jiri Slaby, open list:LINUX FOR POWERPC PA SEMI PWRFICIENT,
Linux Kernel Mailing List
In-Reply-To: <20180225172236.29650-2-malat@debian.org>
On Sun, Feb 25, 2018 at 7:22 PM, Mathieu Malaterre <malat@debian.org> wrote=
:
> When neither CONFIG_ALTIVEC, nor CONFIG_VSX or CONFIG_PPC64 is defined, t=
he
> array feature_properties is defined as an empty array, which in turn
> triggers the following warning (treated as error on W=3D1):
>
> CC arch/powerpc/kernel/prom.o
> arch/powerpc/kernel/prom.c: In function =E2=80=98check_cpu_feature_proper=
ties=E2=80=99:
> arch/powerpc/kernel/prom.c:298:16: error: comparison of unsigned expressi=
on < 0 is always false [-Werror=3Dtype-limits]
> for (i =3D 0; i < ARRAY_SIZE(feature_properties); ++i, ++fp) {
> ^
> cc1: all warnings being treated as errors
>
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
> ---
> arch/powerpc/kernel/prom.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 4dffef947b8a..6e8e4122820e 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -291,11 +291,10 @@ static inline void identical_pvr_fixup(unsigned lon=
g node)
>
> static void __init check_cpu_feature_properties(unsigned long node)
> {
> - unsigned long i;
> struct feature_property *fp =3D feature_properties;
> const __be32 *prop;
>
Much simpler is just add
if (ARRAY_SIZE() =3D=3D 0)
return;
> - for (i =3D 0; i < ARRAY_SIZE(feature_properties); ++i, ++fp) {
> + for (; fp !=3D feature_properties + ARRAY_SIZE(feature_properties=
); ++fp) {
> prop =3D of_get_flat_dt_prop(node, fp->name, NULL);
> if (prop && be32_to_cpup(prop) >=3D fp->min_value) {
> cur_cpu_spec->cpu_features |=3D fp->cpu_feature;
> --
> 2.11.0
>
--=20
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH 01/21] powerpc: Remove warning on array size when empty
From: Andy Shevchenko @ 2018-02-26 14:45 UTC (permalink / raw)
To: Mathieu Malaterre
Cc: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Jiri Slaby, open list:LINUX FOR POWERPC PA SEMI PWRFICIENT,
Linux Kernel Mailing List
In-Reply-To: <CAHp75Vdpdr-0-vdvo0SBx2XcM=HePrUbbb4SM9+ExT_i-1B69Q@mail.gmail.com>
On Mon, Feb 26, 2018 at 4:44 PM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Sun, Feb 25, 2018 at 7:22 PM, Mathieu Malaterre <malat@debian.org> wrote:
>> static void __init check_cpu_feature_properties(unsigned long node)
>> {
>> - unsigned long i;
>> struct feature_property *fp = feature_properties;
>> const __be32 *prop;
>>
>
> Much simpler is just add
>
> if (ARRAY_SIZE() == 0)
> return;
>
>> - for (i = 0; i < ARRAY_SIZE(feature_properties); ++i, ++fp) {
>> + for (; fp != feature_properties + ARRAY_SIZE(feature_properties); ++fp) {
...or convert to while(), which will be more readable.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* [PATCH 1/2] crypto: talitos - don't persistently map req_ctx->hw_context and req_ctx->buf
From: Christophe Leroy @ 2018-02-26 16:40 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Horia Geanta
Cc: linux-crypto, linux-kernel, linuxppc-dev
Commit 49f9783b0cea ("crypto: talitos - do hw_context DMA mapping
outside the requests") introduced a persistent dma mapping of
req_ctx->hw_context
Commit 37b5e8897eb5 ("crypto: talitos - chain in buffered data for ahash
on SEC1") introduced a persistent dma mapping of req_ctx->buf
As there is no destructor for req_ctx (the request context), the
associated dma handlers where set in ctx (the tfm context). This is
wrong as several hash operations can run with the same ctx.
This patch removes this persistent mapping.
Reported-by: Horia Geanta <horia.geanta@nxp.com>
Fixes: 49f9783b0cea ("crypto: talitos - do hw_context DMA mapping outside the requests")
Fixes: 37b5e8897eb5 ("crypto: talitos - chain in buffered data for ahash on SEC1")
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
drivers/crypto/talitos.c | 132 ++++++++++++++++-------------------------------
1 file changed, 44 insertions(+), 88 deletions(-)
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 6882fa2f8bad..bb44df1c1f2d 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -832,8 +832,6 @@ struct talitos_ctx {
unsigned int keylen;
unsigned int enckeylen;
unsigned int authkeylen;
- dma_addr_t dma_buf;
- dma_addr_t dma_hw_context;
};
#define HASH_MAX_BLOCK_SIZE SHA512_BLOCK_SIZE
@@ -1690,9 +1688,30 @@ static void common_nonsnoop_hash_unmap(struct device *dev,
struct ahash_request *areq)
{
struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
+ struct talitos_private *priv = dev_get_drvdata(dev);
+ bool is_sec1 = has_ftr_sec1(priv);
+ struct talitos_desc *desc = &edesc->desc;
+ struct talitos_desc *desc2 = desc + 1;
+
+ unmap_single_talitos_ptr(dev, &edesc->desc.ptr[5], DMA_FROM_DEVICE);
+ if (desc->next_desc &&
+ desc->ptr[5].ptr != desc2->ptr[5].ptr)
+ unmap_single_talitos_ptr(dev, &desc2->ptr[5], DMA_FROM_DEVICE);
talitos_sg_unmap(dev, edesc, req_ctx->psrc, NULL, 0, 0);
+ /* When using hashctx-in, must unmap it. */
+ if (from_talitos_ptr_len(&edesc->desc.ptr[1], is_sec1))
+ unmap_single_talitos_ptr(dev, &edesc->desc.ptr[1],
+ DMA_TO_DEVICE);
+ else if (desc->next_desc)
+ unmap_single_talitos_ptr(dev, &desc2->ptr[1],
+ DMA_TO_DEVICE);
+
+ if (is_sec1 && req_ctx->nbuf)
+ unmap_single_talitos_ptr(dev, &desc->ptr[3],
+ DMA_TO_DEVICE);
+
if (edesc->dma_len)
dma_unmap_single(dev, edesc->dma_link_tbl, edesc->dma_len,
DMA_BIDIRECTIONAL);
@@ -1766,8 +1785,10 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc,
/* hash context in */
if (!req_ctx->first || req_ctx->swinit) {
- to_talitos_ptr(&desc->ptr[1], ctx->dma_hw_context,
- req_ctx->hw_context_size, is_sec1);
+ map_single_talitos_ptr(dev, &desc->ptr[1],
+ req_ctx->hw_context_size,
+ (char *)req_ctx->hw_context,
+ DMA_TO_DEVICE);
req_ctx->swinit = 0;
}
/* Indicate next op is not the first. */
@@ -1793,10 +1814,9 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc,
* data in
*/
if (is_sec1 && req_ctx->nbuf) {
- dma_addr_t dma_buf = ctx->dma_buf + req_ctx->buf_idx *
- HASH_MAX_BLOCK_SIZE;
-
- to_talitos_ptr(&desc->ptr[3], dma_buf, req_ctx->nbuf, is_sec1);
+ map_single_talitos_ptr(dev, &desc->ptr[3], req_ctx->nbuf,
+ req_ctx->buf[req_ctx->buf_idx],
+ DMA_TO_DEVICE);
} else {
sg_count = talitos_sg_map(dev, req_ctx->psrc, length, edesc,
&desc->ptr[3], sg_count, offset, 0);
@@ -1812,8 +1832,9 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc,
crypto_ahash_digestsize(tfm),
areq->result, DMA_FROM_DEVICE);
else
- to_talitos_ptr(&desc->ptr[5], ctx->dma_hw_context,
- req_ctx->hw_context_size, is_sec1);
+ map_single_talitos_ptr(dev, &desc->ptr[5],
+ req_ctx->hw_context_size,
+ req_ctx->hw_context, DMA_FROM_DEVICE);
/* last DWORD empty */
@@ -1832,9 +1853,14 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc,
desc->hdr |= DESC_HDR_MODE0_MDEU_CONT;
desc->hdr &= ~DESC_HDR_DONE_NOTIFY;
- to_talitos_ptr(&desc2->ptr[1], ctx->dma_hw_context,
- req_ctx->hw_context_size, is_sec1);
-
+ if (desc->ptr[1].ptr)
+ copy_talitos_ptr(&desc2->ptr[1], &desc->ptr[1],
+ is_sec1);
+ else
+ map_single_talitos_ptr(dev, &desc2->ptr[1],
+ req_ctx->hw_context_size,
+ req_ctx->hw_context,
+ DMA_TO_DEVICE);
copy_talitos_ptr(&desc2->ptr[2], &desc->ptr[2], is_sec1);
sg_count = talitos_sg_map(dev, req_ctx->psrc, length, edesc,
&desc2->ptr[3], sg_count, offset, 0);
@@ -1842,8 +1868,10 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc,
sync_needed = true;
copy_talitos_ptr(&desc2->ptr[5], &desc->ptr[5], is_sec1);
if (req_ctx->last)
- to_talitos_ptr(&desc->ptr[5], ctx->dma_hw_context,
- req_ctx->hw_context_size, is_sec1);
+ map_single_talitos_ptr(dev, &desc->ptr[5],
+ req_ctx->hw_context_size,
+ req_ctx->hw_context,
+ DMA_FROM_DEVICE);
next_desc = dma_map_single(dev, &desc2->hdr1, TALITOS_DESC_SIZE,
DMA_BIDIRECTIONAL);
@@ -1881,12 +1909,8 @@ static struct talitos_edesc *ahash_edesc_alloc(struct ahash_request *areq,
static int ahash_init(struct ahash_request *areq)
{
struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
- struct talitos_ctx *ctx = crypto_ahash_ctx(tfm);
- struct device *dev = ctx->dev;
struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
unsigned int size;
- struct talitos_private *priv = dev_get_drvdata(dev);
- bool is_sec1 = has_ftr_sec1(priv);
/* Initialize the context */
req_ctx->buf_idx = 0;
@@ -1898,18 +1922,6 @@ static int ahash_init(struct ahash_request *areq)
: TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512;
req_ctx->hw_context_size = size;
- if (ctx->dma_hw_context)
- dma_unmap_single(dev, ctx->dma_hw_context, size,
- DMA_BIDIRECTIONAL);
- ctx->dma_hw_context = dma_map_single(dev, req_ctx->hw_context, size,
- DMA_BIDIRECTIONAL);
- if (ctx->dma_buf)
- dma_unmap_single(dev, ctx->dma_buf, sizeof(req_ctx->buf),
- DMA_TO_DEVICE);
- if (is_sec1)
- ctx->dma_buf = dma_map_single(dev, req_ctx->buf,
- sizeof(req_ctx->buf),
- DMA_TO_DEVICE);
return 0;
}
@@ -1920,9 +1932,6 @@ static int ahash_init(struct ahash_request *areq)
static int ahash_init_sha224_swinit(struct ahash_request *areq)
{
struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
- struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
- struct talitos_ctx *ctx = crypto_ahash_ctx(tfm);
- struct device *dev = ctx->dev;
ahash_init(areq);
req_ctx->swinit = 1;/* prevent h/w initting context with sha256 values*/
@@ -1940,9 +1949,6 @@ static int ahash_init_sha224_swinit(struct ahash_request *areq)
req_ctx->hw_context[8] = 0;
req_ctx->hw_context[9] = 0;
- dma_sync_single_for_device(dev, ctx->dma_hw_context,
- req_ctx->hw_context_size, DMA_TO_DEVICE);
-
return 0;
}
@@ -2046,13 +2052,6 @@ static int ahash_process_req(struct ahash_request *areq, unsigned int nbytes)
/* request SEC to INIT hash. */
if (req_ctx->first && !req_ctx->swinit)
edesc->desc.hdr |= DESC_HDR_MODE0_MDEU_INIT;
- if (is_sec1) {
- dma_addr_t dma_buf = ctx->dma_buf + req_ctx->buf_idx *
- HASH_MAX_BLOCK_SIZE;
-
- dma_sync_single_for_device(dev, dma_buf,
- req_ctx->nbuf, DMA_TO_DEVICE);
- }
/* When the tfm context has a keylen, it's an HMAC.
* A first or last (ie. not middle) descriptor must request HMAC.
@@ -2106,12 +2105,7 @@ static int ahash_export(struct ahash_request *areq, void *out)
{
struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
struct talitos_export_state *export = out;
- struct crypto_ahash *ahash = crypto_ahash_reqtfm(areq);
- struct talitos_ctx *ctx = crypto_ahash_ctx(ahash);
- struct device *dev = ctx->dev;
- dma_sync_single_for_cpu(dev, ctx->dma_hw_context,
- req_ctx->hw_context_size, DMA_FROM_DEVICE);
memcpy(export->hw_context, req_ctx->hw_context,
req_ctx->hw_context_size);
memcpy(export->buf, req_ctx->buf[req_ctx->buf_idx], req_ctx->nbuf);
@@ -2130,31 +2124,14 @@ static int ahash_import(struct ahash_request *areq, const void *in)
struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
const struct talitos_export_state *export = in;
unsigned int size;
- struct talitos_ctx *ctx = crypto_ahash_ctx(tfm);
- struct device *dev = ctx->dev;
- struct talitos_private *priv = dev_get_drvdata(dev);
- bool is_sec1 = has_ftr_sec1(priv);
memset(req_ctx, 0, sizeof(*req_ctx));
size = (crypto_ahash_digestsize(tfm) <= SHA256_DIGEST_SIZE)
? TALITOS_MDEU_CONTEXT_SIZE_MD5_SHA1_SHA256
: TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512;
req_ctx->hw_context_size = size;
- if (ctx->dma_hw_context)
- dma_unmap_single(dev, ctx->dma_hw_context, size,
- DMA_BIDIRECTIONAL);
-
memcpy(req_ctx->hw_context, export->hw_context, size);
- ctx->dma_hw_context = dma_map_single(dev, req_ctx->hw_context, size,
- DMA_BIDIRECTIONAL);
- if (ctx->dma_buf)
- dma_unmap_single(dev, ctx->dma_buf, sizeof(req_ctx->buf),
- DMA_TO_DEVICE);
memcpy(req_ctx->buf[0], export->buf, export->nbuf);
- if (is_sec1)
- ctx->dma_buf = dma_map_single(dev, req_ctx->buf,
- sizeof(req_ctx->buf),
- DMA_TO_DEVICE);
req_ctx->swinit = export->swinit;
req_ctx->first = export->first;
req_ctx->last = export->last;
@@ -3064,27 +3041,6 @@ static void talitos_cra_exit(struct crypto_tfm *tfm)
dma_unmap_single(dev, ctx->dma_key, ctx->keylen, DMA_TO_DEVICE);
}
-static void talitos_cra_exit_ahash(struct crypto_tfm *tfm)
-{
- struct talitos_ctx *ctx = crypto_tfm_ctx(tfm);
- struct device *dev = ctx->dev;
- unsigned int size;
-
- talitos_cra_exit(tfm);
-
- size = (crypto_ahash_digestsize(__crypto_ahash_cast(tfm)) <=
- SHA256_DIGEST_SIZE)
- ? TALITOS_MDEU_CONTEXT_SIZE_MD5_SHA1_SHA256
- : TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512;
-
- if (ctx->dma_hw_context)
- dma_unmap_single(dev, ctx->dma_hw_context, size,
- DMA_BIDIRECTIONAL);
- if (ctx->dma_buf)
- dma_unmap_single(dev, ctx->dma_buf, HASH_MAX_BLOCK_SIZE * 2,
- DMA_TO_DEVICE);
-}
-
/*
* given the alg's descriptor header template, determine whether descriptor
* type and primary/secondary execution units required match the hw
@@ -3183,7 +3139,7 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
case CRYPTO_ALG_TYPE_AHASH:
alg = &t_alg->algt.alg.hash.halg.base;
alg->cra_init = talitos_cra_init_ahash;
- alg->cra_exit = talitos_cra_exit_ahash;
+ alg->cra_exit = talitos_cra_exit;
alg->cra_type = &crypto_ahash_type;
t_alg->algt.alg.hash.init = ahash_init;
t_alg->algt.alg.hash.update = ahash_update;
--
2.13.3
^ permalink raw reply related
* [PATCH 2/2] crypto: talitos - do not perform unnecessary dma synchronisation
From: Christophe Leroy @ 2018-02-26 16:40 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Horia Geanta
Cc: linux-crypto, linux-kernel, linuxppc-dev
In-Reply-To: <7c934f0788d60bd82fb1cb51d712c9ab1ea7fcb4.1519660621.git.christophe.leroy@c-s.fr>
req_ctx->hw_context is mainly used only by the HW. So it is not needed
to sync the HW and the CPU each time hw_context in DMA mapped.
This patch modifies the DMA mapping in order to limit synchronisation
to necessary situations.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
drivers/crypto/talitos.c | 85 +++++++++++++++++++++++++++++++++++-------------
1 file changed, 63 insertions(+), 22 deletions(-)
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index bb44df1c1f2d..447cb8b1b16a 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -104,16 +104,34 @@ static void to_talitos_ptr_ext_or(struct talitos_ptr *ptr, u8 val, bool is_sec1)
/*
* map virtual single (contiguous) pointer to h/w descriptor pointer
*/
+static void __map_single_talitos_ptr(struct device *dev,
+ struct talitos_ptr *ptr,
+ unsigned int len, void *data,
+ enum dma_data_direction dir,
+ unsigned long attrs)
+{
+ dma_addr_t dma_addr = dma_map_single_attrs(dev, data, len, dir, attrs);
+ struct talitos_private *priv = dev_get_drvdata(dev);
+ bool is_sec1 = has_ftr_sec1(priv);
+
+ to_talitos_ptr(ptr, dma_addr, len, is_sec1);
+}
+
static void map_single_talitos_ptr(struct device *dev,
struct talitos_ptr *ptr,
unsigned int len, void *data,
enum dma_data_direction dir)
{
- dma_addr_t dma_addr = dma_map_single(dev, data, len, dir);
- struct talitos_private *priv = dev_get_drvdata(dev);
- bool is_sec1 = has_ftr_sec1(priv);
+ __map_single_talitos_ptr(dev, ptr, len, data, dir, 0);
+}
- to_talitos_ptr(ptr, dma_addr, len, is_sec1);
+static void map_single_talitos_ptr_nosync(struct device *dev,
+ struct talitos_ptr *ptr,
+ unsigned int len, void *data,
+ enum dma_data_direction dir)
+{
+ __map_single_talitos_ptr(dev, ptr, len, data, dir,
+ DMA_ATTR_SKIP_CPU_SYNC);
}
/*
@@ -1785,10 +1803,10 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc,
/* hash context in */
if (!req_ctx->first || req_ctx->swinit) {
- map_single_talitos_ptr(dev, &desc->ptr[1],
- req_ctx->hw_context_size,
- (char *)req_ctx->hw_context,
- DMA_TO_DEVICE);
+ map_single_talitos_ptr_nosync(dev, &desc->ptr[1],
+ req_ctx->hw_context_size,
+ req_ctx->hw_context,
+ DMA_TO_DEVICE);
req_ctx->swinit = 0;
}
/* Indicate next op is not the first. */
@@ -1832,9 +1850,10 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc,
crypto_ahash_digestsize(tfm),
areq->result, DMA_FROM_DEVICE);
else
- map_single_talitos_ptr(dev, &desc->ptr[5],
- req_ctx->hw_context_size,
- req_ctx->hw_context, DMA_FROM_DEVICE);
+ map_single_talitos_ptr_nosync(dev, &desc->ptr[5],
+ req_ctx->hw_context_size,
+ req_ctx->hw_context,
+ DMA_FROM_DEVICE);
/* last DWORD empty */
@@ -1857,10 +1876,10 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc,
copy_talitos_ptr(&desc2->ptr[1], &desc->ptr[1],
is_sec1);
else
- map_single_talitos_ptr(dev, &desc2->ptr[1],
- req_ctx->hw_context_size,
- req_ctx->hw_context,
- DMA_TO_DEVICE);
+ map_single_talitos_ptr_nosync(dev, &desc2->ptr[1],
+ req_ctx->hw_context_size,
+ req_ctx->hw_context,
+ DMA_TO_DEVICE);
copy_talitos_ptr(&desc2->ptr[2], &desc->ptr[2], is_sec1);
sg_count = talitos_sg_map(dev, req_ctx->psrc, length, edesc,
&desc2->ptr[3], sg_count, offset, 0);
@@ -1868,10 +1887,10 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc,
sync_needed = true;
copy_talitos_ptr(&desc2->ptr[5], &desc->ptr[5], is_sec1);
if (req_ctx->last)
- map_single_talitos_ptr(dev, &desc->ptr[5],
- req_ctx->hw_context_size,
- req_ctx->hw_context,
- DMA_FROM_DEVICE);
+ map_single_talitos_ptr_nosync(dev, &desc->ptr[5],
+ req_ctx->hw_context_size,
+ req_ctx->hw_context,
+ DMA_FROM_DEVICE);
next_desc = dma_map_single(dev, &desc2->hdr1, TALITOS_DESC_SIZE,
DMA_BIDIRECTIONAL);
@@ -1909,8 +1928,11 @@ static struct talitos_edesc *ahash_edesc_alloc(struct ahash_request *areq,
static int ahash_init(struct ahash_request *areq)
{
struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
+ struct talitos_ctx *ctx = crypto_ahash_ctx(tfm);
+ struct device *dev = ctx->dev;
struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
unsigned int size;
+ dma_addr_t dma;
/* Initialize the context */
req_ctx->buf_idx = 0;
@@ -1922,6 +1944,10 @@ static int ahash_init(struct ahash_request *areq)
: TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512;
req_ctx->hw_context_size = size;
+ dma = dma_map_single(dev, req_ctx->hw_context, req_ctx->hw_context_size,
+ DMA_TO_DEVICE);
+ dma_unmap_single(dev, dma, req_ctx->hw_context_size, DMA_TO_DEVICE);
+
return 0;
}
@@ -1933,9 +1959,6 @@ static int ahash_init_sha224_swinit(struct ahash_request *areq)
{
struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
- ahash_init(areq);
- req_ctx->swinit = 1;/* prevent h/w initting context with sha256 values*/
-
req_ctx->hw_context[0] = SHA224_H0;
req_ctx->hw_context[1] = SHA224_H1;
req_ctx->hw_context[2] = SHA224_H2;
@@ -1949,6 +1972,9 @@ static int ahash_init_sha224_swinit(struct ahash_request *areq)
req_ctx->hw_context[8] = 0;
req_ctx->hw_context[9] = 0;
+ ahash_init(areq);
+ req_ctx->swinit = 1;/* prevent h/w initting context with sha256 values*/
+
return 0;
}
@@ -2105,6 +2131,14 @@ static int ahash_export(struct ahash_request *areq, void *out)
{
struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
struct talitos_export_state *export = out;
+ struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
+ struct talitos_ctx *ctx = crypto_ahash_ctx(tfm);
+ struct device *dev = ctx->dev;
+ dma_addr_t dma;
+
+ dma = dma_map_single(dev, req_ctx->hw_context, req_ctx->hw_context_size,
+ DMA_FROM_DEVICE);
+ dma_unmap_single(dev, dma, req_ctx->hw_context_size, DMA_FROM_DEVICE);
memcpy(export->hw_context, req_ctx->hw_context,
req_ctx->hw_context_size);
@@ -2122,8 +2156,11 @@ static int ahash_import(struct ahash_request *areq, const void *in)
{
struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
+ struct talitos_ctx *ctx = crypto_ahash_ctx(tfm);
+ struct device *dev = ctx->dev;
const struct talitos_export_state *export = in;
unsigned int size;
+ dma_addr_t dma;
memset(req_ctx, 0, sizeof(*req_ctx));
size = (crypto_ahash_digestsize(tfm) <= SHA256_DIGEST_SIZE)
@@ -2138,6 +2175,10 @@ static int ahash_import(struct ahash_request *areq, const void *in)
req_ctx->to_hash_later = export->to_hash_later;
req_ctx->nbuf = export->nbuf;
+ dma = dma_map_single(dev, req_ctx->hw_context, req_ctx->hw_context_size,
+ DMA_TO_DEVICE);
+ dma_unmap_single(dev, dma, req_ctx->hw_context_size, DMA_TO_DEVICE);
+
return 0;
}
--
2.13.3
^ permalink raw reply related
* Re: [PATCH v8 18/24] mm: Provide speculative fault infrastructure
From: Daniel Jordan @ 2018-02-26 17:16 UTC (permalink / raw)
To: Laurent Dufour, paulmck, peterz, akpm, kirill, ak, mhocko, dave,
jack, Matthew Wilcox, benh, mpe, paulus, Thomas Gleixner,
Ingo Molnar, hpa, Will Deacon, Sergey Senozhatsky,
Andrea Arcangeli, Alexei Starovoitov, kemi.wang,
sergey.senozhatsky.work, Daniel Jordan
Cc: linux-kernel, linux-mm, haren, khandual, npiggin, bsingharora,
Tim Chen, linuxppc-dev, x86
In-Reply-To: <1518794738-4186-19-git-send-email-ldufour@linux.vnet.ibm.com>
Hi Laurent,
This series doesn't build for me[*] when CONFIG_TRANSPARENT_HUGEPAGE is unset.
The problem seems to be that the BUILD_BUG() version of pmd_same is called in pte_map_lock:
On 02/16/2018 10:25 AM, Laurent Dufour wrote:
> +static bool pte_map_lock(struct vm_fault *vmf)
> +{
...snip...
> + if (!pmd_same(pmdval, vmf->orig_pmd))
> + goto out;
Since SPF can now call pmd_same without THP, maybe the way to fix it is just
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 2cfa3075d148..e130692db24a 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -375,7 +375,8 @@ static inline int pte_unused(pte_t pte)
#endif
#ifndef __HAVE_ARCH_PMD_SAME
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || \
+ defined(CONFIG_SPECULATIVE_PAGE_FAULT)
static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
{
return pmd_val(pmd_a) == pmd_val(pmd_b);
?
Daniel
[*] The errors are:
In file included from /home/dmjordan/src/linux/include/linux/kernel.h:10:0,
from /home/dmjordan/src/linux/include/linux/list.h:9,
from /home/dmjordan/src/linux/include/linux/smp.h:12,
from /home/dmjordan/src/linux/include/linux/kernel_stat.h:5,
from /home/dmjordan/src/linux/mm/memory.c:41:
In function ‘pmd_same.isra.104’,
inlined from ‘pte_map_lock’ at /home/dmjordan/src/linux/mm/memory.c:2380:7:
/home/dmjordan/src/linux/include/linux/compiler.h:324:38: error: call to ‘__compiletime_assert_391’ declared with attribute error: BUILD_BUG failed
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
/home/dmjordan/src/linux/include/linux/compiler.h:304:4: note: in definition of macro ‘__compiletime_assert’
prefix ## suffix(); \
^~~~~~
/home/dmjordan/src/linux/include/linux/compiler.h:324:2: note: in expansion of macro ‘_compiletime_assert’
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
/home/dmjordan/src/linux/include/linux/build_bug.h:45:37: note: in expansion of macro ‘compiletime_assert’
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
/home/dmjordan/src/linux/include/linux/build_bug.h:79:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
^~~~~~~~~~~~~~~~
/home/dmjordan/src/linux/include/asm-generic/pgtable.h:391:2: note: in expansion of macro ‘BUILD_BUG’
BUILD_BUG();
^~~~~~~~~
CC block/elevator.o
CC crypto/crypto_wq.o
In function ‘pmd_same.isra.104’,
inlined from ‘pte_spinlock’ at /home/dmjordan/src/linux/mm/memory.c:2326:7,
inlined from ‘handle_pte_fault’ at /home/dmjordan/src/linux/mm/memory.c:4181:7:
/home/dmjordan/src/linux/include/linux/compiler.h:324:38: error: call to ‘__compiletime_assert_391’ declared with attribute error: BUILD_BUG failed
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
/home/dmjordan/src/linux/include/linux/compiler.h:304:4: note: in definition of macro ‘__compiletime_assert’
prefix ## suffix(); \
^~~~~~
/home/dmjordan/src/linux/include/linux/compiler.h:324:2: note: in expansion of macro ‘_compiletime_assert’
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
/home/dmjordan/src/linux/include/linux/build_bug.h:45:37: note: in expansion of macro ‘compiletime_assert’
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
/home/dmjordan/src/linux/include/linux/build_bug.h:79:21: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
^~~~~~~~~~~~~~~~
/home/dmjordan/src/linux/include/asm-generic/pgtable.h:391:2: note: in expansion of macro ‘BUILD_BUG’
BUILD_BUG();
^~~~~~~~~
...
make[2]: *** [/home/dmjordan/src/linux/scripts/Makefile.build:316: mm/memory.o] Error 1
make[1]: *** [/home/dmjordan/src/linux/Makefile:1047: mm] Error 2
^ permalink raw reply related
* Re: [PATCH 06/21] powerpc: Avoid comparison of unsigned long >= 0 in __access_ok
From: Mathieu Malaterre @ 2018-02-26 17:50 UTC (permalink / raw)
To: Christophe LEROY
Cc: Michael Ellerman, LKML, Paul Mackerras, Jiri Slaby, linuxppc-dev
In-Reply-To: <CA+7wUswNE1ydgeESpG8Dqtz4SGFjZZJJiPp+SHN8Z1qtBtPLLQ@mail.gmail.com>
On Mon, Feb 26, 2018 at 8:44 AM, Mathieu Malaterre <malat@debian.org> wrote=
:
> On Mon, Feb 26, 2018 at 7:50 AM, Christophe LEROY
> <christophe.leroy@c-s.fr> wrote:
>>
>>
>> Le 26/02/2018 =C3=A0 07:34, Christophe LEROY a =C3=A9crit :
>>>
>>>
>>>
>>> Le 25/02/2018 =C3=A0 18:22, Mathieu Malaterre a =C3=A9crit :
>>>>
>>>> Rewrite check size - 1 <=3D Y as size < Y since `size` is unsigned val=
ue.
>>>> Fix warning (treated as error in W=3D1):
>>>>
>>>> CC arch/powerpc/kernel/signal_32.o
>>>> In file included from ./include/linux/uaccess.h:14:0,
>>>> from ./include/asm-generic/termios-base.h:8,
>>>> from ./arch/powerpc/include/asm/termios.h:20,
>>>> from ./include/uapi/linux/termios.h:6,
>>>> from ./include/linux/tty.h:7,
>>>> from arch/powerpc/kernel/signal_32.c:36:
>>>> ./include/asm-generic/termios-base.h: In function
>>>> =E2=80=98user_termio_to_kernel_termios=E2=80=99:
>>>> ./arch/powerpc/include/asm/uaccess.h:52:35: error: comparison of unsig=
ned
>>>> expression >=3D 0 is always true [-Werror=3Dtype-limits]
>>>> (((size) =3D=3D 0) || (((size) - 1) <=3D ((segment).seg - (addr)))=
))
>>>> ^
>>>> ./arch/powerpc/include/asm/uaccess.h:58:3: note: in expansion of macro
>>>> =E2=80=98__access_ok=E2=80=99
>>>> __access_ok((__force unsigned long)(addr), (size), get_fs()))
>>>> ^~~~~~~~~~~
>>>> ./arch/powerpc/include/asm/uaccess.h:262:6: note: in expansion of macr=
o
>>>> =E2=80=98access_ok=E2=80=99
>>>> if (access_ok(VERIFY_READ, __gu_addr, (size))) \
>>>> ^~~~~~~~~
>>>> ./arch/powerpc/include/asm/uaccess.h:80:2: note: in expansion of macro
>>>> =E2=80=98__get_user_check=E2=80=99
>>>> __get_user_check((x), (ptr), sizeof(*(ptr)))
>>>> ^~~~~~~~~~~~~~~~
>>>> ./include/asm-generic/termios-base.h:36:6: note: in expansion of macro
>>>> =E2=80=98get_user=E2=80=99
>>>> if (get_user(termios->c_line, &termio->c_line) < 0)
>>>> ^~~~~~~~
>>>> [...]
>>>> cc1: all warnings being treated as errors
>>>>
>>>> Signed-off-by: Mathieu Malaterre <malat@debian.org>
>>>> ---
>>>> arch/powerpc/include/asm/uaccess.h | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/arch/powerpc/include/asm/uaccess.h
>>>> b/arch/powerpc/include/asm/uaccess.h
>>>> index 51bfeb8777f0..fadc406bd39d 100644
>>>> --- a/arch/powerpc/include/asm/uaccess.h
>>>> +++ b/arch/powerpc/include/asm/uaccess.h
>>>> @@ -49,7 +49,7 @@
>>>> #define __access_ok(addr, size, segment) \
>>>> (((addr) <=3D (segment).seg) && \
>>>> - (((size) =3D=3D 0) || (((size) - 1) <=3D ((segment).seg - (addr)=
))))
>>>> + (((size) =3D=3D 0) || ((size) < ((segment).seg - (addr)))))
>>>
>>>
>>> IIUC, ((2 - 1) <=3D 1) is the same as (2 < 1) ?????
>>
>
> The whole series was pretty mediocre, but this one was actually pretty
> destructive. Thanks for catching this.
>
>>
>> Note that I already try to submit a fix for this warning 3 years ago
>> (https://patchwork.ozlabs.org/patch/418075/) and it was rejected with th=
e
>> following comment:
Tested again today with gcc 6.3.0 and gcc is still producing the
original warning (treated as error).
>> Again, I don't think Linux enables this warning. What did you do to
>> produce this? In any case, it's a bad warning that doesn't take macros
>> into account, and the answer is not to make the code less clear by hidin=
g
>> the fact that zero is a special case.
>
> Right. I'll try to see how to make W=3D1 run without error with an
> alternate solution.
So the other alternative is to update a bunch of ppc32 defconfig(s)
with: CONFIG_PPC_DISABLE_WERROR=3Dy.
Would that be preferable ?
>> Christophe
>>
>>
>>>
>>> Christophe
>>>
>>>> #endif
>>>>
>>
^ permalink raw reply
* Re: [PATCH V2 4/4] powerpc/mm/hash64: Increase the VA range
From: Murilo Opsfelder Araujo @ 2018-02-26 18:11 UTC (permalink / raw)
To: Aneesh Kumar K.V, benh, paulus, mpe; +Cc: linuxppc-dev
In-Reply-To: <20180226140826.11641-5-aneesh.kumar@linux.vnet.ibm.com>
On 02/26/2018 11:08 AM, Aneesh Kumar K.V wrote:
> ---
> arch/powerpc/include/asm/book3s/64/hash-64k.h | 2 +-
> arch/powerpc/include/asm/processor.h | 9 ++++++++-
> arch/powerpc/mm/init_64.c | 6 ------
> arch/powerpc/mm/pgtable_64.c | 5 -----
> 4 files changed, 9 insertions(+), 13 deletions(-)
Hi, Aneesh.
This patch is missing Signed-off-by: line. You're encouraged to run
checkpatch.pl to inspect your patches.
You may also want to add a brief paragraph in the commit message
explaining the "why" of this change.
Cheers
Murilo
^ permalink raw reply
* Re: [PATCH 06/21] powerpc: Avoid comparison of unsigned long >= 0 in __access_ok
From: christophe leroy @ 2018-02-26 20:00 UTC (permalink / raw)
To: Mathieu Malaterre, Segher Boessenkool
Cc: Michael Ellerman, LKML, Paul Mackerras, Jiri Slaby, linuxppc-dev
In-Reply-To: <CA+7wUsx047shRJ92PJ+cvg24HNhMnYzM0t5zUdEOaSE00sXkSg@mail.gmail.com>
Le 26/02/2018 à 18:50, Mathieu Malaterre a écrit :
> On Mon, Feb 26, 2018 at 8:44 AM, Mathieu Malaterre <malat@debian.org> wrote:
>> On Mon, Feb 26, 2018 at 7:50 AM, Christophe LEROY
>> <christophe.leroy@c-s.fr> wrote:
>>>
>>>
>>> Le 26/02/2018 à 07:34, Christophe LEROY a écrit :
>>>>
>>>>
>>>>
>>>> Le 25/02/2018 à 18:22, Mathieu Malaterre a écrit :
>>>>>
>>>>> Rewrite check size - 1 <= Y as size < Y since `size` is unsigned value.
>>>>> Fix warning (treated as error in W=1):
>>>>>
>>>>> CC arch/powerpc/kernel/signal_32.o
>>>>> In file included from ./include/linux/uaccess.h:14:0,
>>>>> from ./include/asm-generic/termios-base.h:8,
>>>>> from ./arch/powerpc/include/asm/termios.h:20,
>>>>> from ./include/uapi/linux/termios.h:6,
>>>>> from ./include/linux/tty.h:7,
>>>>> from arch/powerpc/kernel/signal_32.c:36:
>>>>> ./include/asm-generic/termios-base.h: In function
>>>>> ‘user_termio_to_kernel_termios’:
>>>>> ./arch/powerpc/include/asm/uaccess.h:52:35: error: comparison of unsigned
>>>>> expression >= 0 is always true [-Werror=type-limits]
>>>>> (((size) == 0) || (((size) - 1) <= ((segment).seg - (addr)))))
>>>>> ^
>>>>> ./arch/powerpc/include/asm/uaccess.h:58:3: note: in expansion of macro
>>>>> ‘__access_ok’
>>>>> __access_ok((__force unsigned long)(addr), (size), get_fs()))
>>>>> ^~~~~~~~~~~
>>>>> ./arch/powerpc/include/asm/uaccess.h:262:6: note: in expansion of macro
>>>>> ‘access_ok’
>>>>> if (access_ok(VERIFY_READ, __gu_addr, (size))) \
>>>>> ^~~~~~~~~
>>>>> ./arch/powerpc/include/asm/uaccess.h:80:2: note: in expansion of macro
>>>>> ‘__get_user_check’
>>>>> __get_user_check((x), (ptr), sizeof(*(ptr)))
>>>>> ^~~~~~~~~~~~~~~~
>>>>> ./include/asm-generic/termios-base.h:36:6: note: in expansion of macro
>>>>> ‘get_user’
>>>>> if (get_user(termios->c_line, &termio->c_line) < 0)
>>>>> ^~~~~~~~
>>>>> [...]
>>>>> cc1: all warnings being treated as errors
>>>>>
>>>>> Signed-off-by: Mathieu Malaterre <malat@debian.org>
>>>>> ---
>>>>> arch/powerpc/include/asm/uaccess.h | 2 +-
>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/arch/powerpc/include/asm/uaccess.h
>>>>> b/arch/powerpc/include/asm/uaccess.h
>>>>> index 51bfeb8777f0..fadc406bd39d 100644
>>>>> --- a/arch/powerpc/include/asm/uaccess.h
>>>>> +++ b/arch/powerpc/include/asm/uaccess.h
>>>>> @@ -49,7 +49,7 @@
>>>>> #define __access_ok(addr, size, segment) \
>>>>> (((addr) <= (segment).seg) && \
>>>>> - (((size) == 0) || (((size) - 1) <= ((segment).seg - (addr)))))
>>>>> + (((size) == 0) || ((size) < ((segment).seg - (addr)))))
>>>>
>>>>
>>>> IIUC, ((2 - 1) <= 1) is the same as (2 < 1) ?????
>>>
>>
>> The whole series was pretty mediocre, but this one was actually pretty
>> destructive. Thanks for catching this.
>>
>>>
>>> Note that I already try to submit a fix for this warning 3 years ago
>>> (https://patchwork.ozlabs.org/patch/418075/) and it was rejected with the
>>> following comment:
>
> Tested again today with gcc 6.3.0 and gcc is still producing the
> original warning (treated as error).
That's right, it seems that recent versions of gcc are not happy anymore
with that change.
Maybe Segher has a suggestion for that one ?
>
>>> Again, I don't think Linux enables this warning. What did you do to
>>> produce this? In any case, it's a bad warning that doesn't take macros
>>> into account, and the answer is not to make the code less clear by hiding
>>> the fact that zero is a special case.
>>
>> Right. I'll try to see how to make W=1 run without error with an
>> alternate solution.
>
> So the other alternative is to update a bunch of ppc32 defconfig(s)
> with: CONFIG_PPC_DISABLE_WERROR=y.
>
> Would that be preferable ?
No I don't think it is the solution. PPC is built with WERROR in order
to catch warnings on real problems.
You could disable it selectively when you want to run 'make W=1' and see
all possible warnings, then select by yourself which warnings are worth
fixing up.
Christophe
>
>>> Christophe
>>>
>>>
>>>>
>>>> Christophe
>>>>
>>>>> #endif
>>>>>
>>>
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
^ permalink raw reply
* [RFC v2 0/3] powerpc/hotplug: Fix affinity assoc for LPAR migration
From: Michael Bringmann @ 2018-02-26 20:51 UTC (permalink / raw)
To: linuxppc-dev
Cc: Michael Bringmann, Nathan Fontenot, John Allen, Tyrel Datwyler,
Thomas Falcon
The migration of LPARs across Power systems affects many attributes
including that of the associativity of memory blocks and CPUs. The
patches in this set execute when a system is coming up fresh upon a
migration target. They are intended to,
* Recognize changes to the associativity of memory and CPUs recorded
in internal data structures when compared to the latest copies in
the device tree (e.g. ibm,dynamic-memory, ibm,dynamic-memory-v2,
cpus),
* Recognize changes to the associativity mapping (e.g. ibm,
associativity-lookup-arrays), locate all assigned memory blocks
corresponding to each changed row, and readd all such blocks.
* Generate calls to other code layers to reset the data structures
related to associativity of the CPUs and memory.
* Re-register the 'changed' entities into the target system.
Re-registration of CPUs and memory blocks mostly entails acting as
if they have been newly hot-added into the target system.
Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>
Michael Bringmann (3):
hotplug/mobility: Apply assoc lookup updates for Post Migration Topo
postmigration/memory: Review assoc lookup array changes
postmigration/memory: Associativity & 'ibm,dynamic-memory-v2'
---
Changes in RFC:
-- Rename pseries_update_drconf_cpu to pseries_update_cpu
-- Simplify code to update CPU nodes during mobility checks.
Remove functions to generate extra HP_ELOG messages in favor
of direct function calls to dlpar_cpu_readd_by_index, or
dlpar_memory_readd_by_index.
-- Make use of drmem accessor functions to read dynamic memory
properties.
-- Change section of a support function + variable from __init
to normal runtime to make them visible to migration code.
^ permalink raw reply
* [RFC v2 1/3] hotplug/mobility: Apply assoc updates for Post Migration Topo
From: Michael Bringmann @ 2018-02-26 20:52 UTC (permalink / raw)
To: linuxppc-dev
Cc: Michael Bringmann, Nathan Fontenot, John Allen, Tyrel Datwyler,
Thomas Falcon
In-Reply-To: <9cf9df97-6934-c9b5-4f07-417fad6e43d1@linux.vnet.ibm.com>
hotplug/mobility: Recognize more changes to the associativity of
memory blocks described by the 'ibm,dynamic-memory' and 'cpu'
properties when processing the topology of LPARS in Post Migration
events. Previous efforts only recognized whether a memory block's
assignment had changed in the property. Changes here include:
* Checking the aa_index values of the old/new properties and 'readd'
any block for which the setting has changed.
* Checking for changes in cpu associativity and making 'readd' calls
when differences are observed.
Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>
---
Changes in RFC:
-- Simplify code to update CPU nodes during mobility checks.
Remove functions to generate extra HP_ELOG messages in favor
of direct function calls to dlpar_cpu_readd_by_index.
-- Move check for "cpu" node type from pseries_update_cpu to
pseries_smp_notifier in 'hotplug-cpu.c'
-- Remove functions 'pseries_memory_readd_by_index' and
'pseries_cpu_readd_by_index' as no longer needed outside of
'mobility.c'.
---
arch/powerpc/platforms/pseries/hotplug-cpu.c | 69 +++++++++++++++++++++++
arch/powerpc/platforms/pseries/hotplug-memory.c | 6 ++
2 files changed, 75 insertions(+)
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index a7d14aa7..91ef22a 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -636,6 +636,27 @@ static int dlpar_cpu_remove_by_index(u32 drc_index)
return rc;
}
+static int dlpar_cpu_readd_by_index(u32 drc_index)
+{
+ int rc = 0;
+
+ pr_info("Attempting to update CPU, drc index %x\n", drc_index);
+
+ if (dlpar_cpu_remove_by_index(drc_index))
+ rc = -EINVAL;
+ else if (dlpar_cpu_add(drc_index))
+ rc = -EINVAL;
+
+ if (rc)
+ pr_info("Failed to update cpu at drc_index %lx\n",
+ (unsigned long int)drc_index);
+ else
+ pr_info("CPU at drc_index %lx was updated\n",
+ (unsigned long int)drc_index);
+
+ return rc;
+}
+
static int find_dlpar_cpus_to_remove(u32 *cpu_drcs, int cpus_to_remove)
{
struct device_node *dn;
@@ -826,6 +847,9 @@ int dlpar_cpu(struct pseries_hp_errorlog *hp_elog)
else
rc = -EINVAL;
break;
+ case PSERIES_HP_ELOG_ACTION_READD:
+ rc = dlpar_cpu_readd_by_index(drc_index);
+ break;
default:
pr_err("Invalid action (%d) specified\n", hp_elog->action);
rc = -EINVAL;
@@ -876,12 +900,53 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
+static int pseries_update_cpu(struct of_reconfig_data *pr)
+{
+ u32 old_entries, new_entries;
+ __be32 *p, *old_assoc, *new_assoc;
+ int rc = 0;
+
+ /* So far, we only handle the 'ibm,associativity' property,
+ * here.
+ * The first int of the property is the number of domains
+ * described. This is followed by an array of level values.
+ */
+ p = (__be32 *) pr->old_prop->value;
+ if (!p)
+ return -EINVAL;
+ old_entries = be32_to_cpu(*p++);
+ old_assoc = p;
+
+ p = (__be32 *)pr->prop->value;
+ if (!p)
+ return -EINVAL;
+ new_entries = be32_to_cpu(*p++);
+ new_assoc = p;
+
+ if (old_entries == new_entries) {
+ int sz = old_entries * sizeof(int);
+
+ if (!memcmp(old_assoc, new_assoc, sz))
+ rc = dlpar_cpu_readd_by_index(
+ be32_to_cpu(pr->dn->phandle));
+
+ } else {
+ rc = dlpar_cpu_readd_by_index(
+ be32_to_cpu(pr->dn->phandle));
+ }
+
+ return rc;
+}
+
static int pseries_smp_notifier(struct notifier_block *nb,
unsigned long action, void *data)
{
struct of_reconfig_data *rd = data;
int err = 0;
+ if (strcmp(rd->dn->type, "cpu"))
+ return notifier_from_errno(err);
+
switch (action) {
case OF_RECONFIG_ATTACH_NODE:
err = pseries_add_processor(rd->dn);
@@ -889,6 +954,10 @@ static int pseries_smp_notifier(struct notifier_block *nb,
case OF_RECONFIG_DETACH_NODE:
pseries_remove_processor(rd->dn);
break;
+ case OF_RECONFIG_UPDATE_PROPERTY:
+ if (!strcmp(rd->prop->name, "ibm,associativity"))
+ err = pseries_update_cpu(rd);
+ break;
}
return notifier_from_errno(err);
}
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index c1578f5..2341eae 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -1040,6 +1040,12 @@ static int pseries_update_drconf_memory(struct of_reconfig_data *pr)
memblock_size);
rc = (rc < 0) ? -EINVAL : 0;
break;
+ } else if ((be32_to_cpu(old_drmem[i].aa_index) !=
+ be32_to_cpu(new_drmem[i].aa_index)) &&
+ (be32_to_cpu(new_drmem[i].flags) &
+ DRCONF_MEM_ASSIGNED)) {
+ rc = dlpar_memory_readd_by_index(
+ be32_to_cpu(new_drmem[i].drc_index));
}
}
return rc;
^ permalink raw reply related
* [RFC v2 2/3] postmigration/memory: Review assoc lookup array changes
From: Michael Bringmann @ 2018-02-26 20:53 UTC (permalink / raw)
To: linuxppc-dev
Cc: Michael Bringmann, Nathan Fontenot, John Allen, Tyrel Datwyler,
Thomas Falcon
In-Reply-To: <9cf9df97-6934-c9b5-4f07-417fad6e43d1@linux.vnet.ibm.com>
postmigration/memory: In an LPAR migration scenario, the property
"ibm,associativity-lookup-arrays" may change. In the event that a
row of the array differs, locate all assigned memory blocks with that
'aa_index' and 're-add' them to the system memory block data structures.
In the process of the 're-add', the appropriate entry of the property
'ibm,dynamic-memory' would be updated as well as any other applicable
system data structures.
Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>
---
Changes in RFC v2:
-- Simplify code to update memory nodes during mobility checks.
Remove functions to generate extra HP_ELOG messages in favor
of direct function calls to dlpar_memory_readd_by_index.
---
arch/powerpc/platforms/pseries/hotplug-memory.c | 120 +++++++++++++++++++++++
1 file changed, 120 insertions(+)
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 2341eae..b63181d 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -1051,6 +1051,123 @@ static int pseries_update_drconf_memory(struct of_reconfig_data *pr)
return rc;
}
+struct assoc_arrays {
+ u32 n_arrays;
+ u32 array_sz;
+ const __be32 *arrays;
+};
+
+static int pseries_update_ala_memory_aai(int aa_index,
+ struct property *dmprop)
+{
+ struct of_drconf_cell *drmem;
+ u32 entries;
+ __be32 *p;
+ int i;
+ int rc = 0;
+
+ p = (__be32 *) dmprop->value;
+ if (!p)
+ return -EINVAL;
+
+ /* The first int of the property is the number of lmb's
+ * described by the property. This is followed by an array
+ * of of_drconf_cell entries. Get the number of entries
+ * and skip to the array of of_drconf_cell's.
+ */
+ entries = be32_to_cpu(*p++);
+ drmem = (struct of_drconf_cell *)p;
+
+ for (i = 0; i < entries; i++) {
+ if ((be32_to_cpu(drmem[i].aa_index) != aa_index) &&
+ (be32_to_cpu(drmem[i].flags) & DRCONF_MEM_ASSIGNED)) {
+ rc = dlpar_memory_readd_by_index(
+ be32_to_cpu(drmem[i].drc_index));
+ }
+ }
+
+ return rc;
+}
+
+static int pseries_update_ala_memory(struct of_reconfig_data *pr)
+{
+ struct assoc_arrays new_ala, old_ala;
+ struct device_node *dn;
+ struct property *dmprop;
+ __be32 *p;
+ int i, lim;
+
+ if (rtas_hp_event)
+ return 0;
+
+ dn = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
+ if (!dn)
+ return -ENODEV;
+
+ dmprop = of_find_property(dn, "ibm,dynamic-memory", NULL);
+ if (!dmprop) {
+ of_node_put(dn);
+ return -ENODEV;
+ }
+
+ /*
+ * The layout of the ibm,associativity-lookup-arrays
+ * property is a number N indicating the number of
+ * associativity arrays, followed by a number M
+ * indicating the size of each associativity array,
+ * followed by a list of N associativity arrays.
+ */
+
+ p = (__be32 *) pr->old_prop->value;
+ if (!p) {
+ of_node_put(dn);
+ return -EINVAL;
+ }
+ old_ala.n_arrays = of_read_number(p++, 1);
+ old_ala.array_sz = of_read_number(p++, 1);
+ old_ala.arrays = p;
+
+ p = (__be32 *) pr->prop->value;
+ if (!p) {
+ of_node_put(dn);
+ return -EINVAL;
+ }
+ new_ala.n_arrays = of_read_number(p++, 1);
+ new_ala.array_sz = of_read_number(p++, 1);
+ new_ala.arrays = p;
+
+ lim = (new_ala.n_arrays > old_ala.n_arrays) ? old_ala.n_arrays :
+ new_ala.n_arrays;
+
+ if (old_ala.array_sz == new_ala.array_sz) {
+
+ for (i = 0; i < lim; i++) {
+ int index = (i * new_ala.array_sz);
+
+ if (!memcmp(&old_ala.arrays[index],
+ &new_ala.arrays[index],
+ new_ala.array_sz))
+ continue;
+
+ pseries_update_ala_memory_aai(i, dmprop);
+ }
+
+ for (i = lim; i < new_ala.n_arrays; i++)
+ pseries_update_ala_memory_aai(i, dmprop);
+
+ } else {
+ /* Update all entries representing these rows;
+ * as all rows have different sizes, none can
+ * have equivalent values.
+ */
+ for (i = 0; i < lim; i++)
+ pseries_update_ala_memory_aai(i, dmprop);
+ }
+
+ of_node_put(dn);
+ return 0;
+}
+
static int pseries_memory_notifier(struct notifier_block *nb,
unsigned long action, void *data)
{
@@ -1067,6 +1184,9 @@ static int pseries_memory_notifier(struct notifier_block *nb,
case OF_RECONFIG_UPDATE_PROPERTY:
if (!strcmp(rd->prop->name, "ibm,dynamic-memory"))
err = pseries_update_drconf_memory(rd);
+ if (!strcmp(rd->prop->name,
+ "ibm,associativity-lookup-arrays"))
+ err = pseries_update_ala_memory(rd);
break;
}
return notifier_from_errno(err);
^ permalink raw reply related
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