* [PATCH 4/7] powerpc/64s/radix: Allow mm_cpumask trimming from external sources
From: Nicholas Piggin @ 2020-12-17 13:47 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Nicholas Piggin
In-Reply-To: <20201217134731.488135-1-npiggin@gmail.com>
mm_cpumask trimming is currently restricted to be issued by the current
thread of a single-threaded mm. This patch relaxes that and allows the
mask to be trimmed from any context.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/mm/book3s64/radix_tlb.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
index 5b62e2e7371c..7b199bee4baa 100644
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
@@ -657,20 +657,16 @@ static void do_exit_flush_lazy_tlb(void *arg)
}
/*
- * This IPI is only initiated from a CPU which is running mm which
- * is a single-threaded process, so there will not be another racing
- * IPI coming in where we would find our cpumask already clear.
- *
- * Nothing else clears our bit in the cpumask except CPU offlining,
- * in which case we should not be taking IPIs here. However check
- * this just in case the logic is wrong somewhere, and don't underflow
- * the active_cpus count.
+ * This IPI may be initiated from any source including those not
+ * running the mm, so there may be a racing IPI that comes after
+ * this one which finds the cpumask already clear. Check and avoid
+ * underflowing the active_cpus count in that case. The race should
+ * not otherwise be a problem, but the TLB must be flushed because
+ * that's what the caller expects.
*/
if (cpumask_test_cpu(cpu, mm_cpumask(mm))) {
atomic_dec(&mm->context.active_cpus);
cpumask_clear_cpu(cpu, mm_cpumask(mm));
- } else {
- WARN_ON_ONCE(1);
}
out_flush:
--
2.23.0
^ permalink raw reply related
* [PATCH 3/7] powerpc/64s/radix: Check for no TLB flush required
From: Nicholas Piggin @ 2020-12-17 13:47 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Nicholas Piggin
In-Reply-To: <20201217134731.488135-1-npiggin@gmail.com>
If there are no CPUs in mm_cpumask, no TLB flush is required at all.
This patch adds a check for this case.
Currently it's not tested for, in fact mm_is_thread_local() returns
false if the current CPU is not in mm_cpumask, so it's treated as a
global flush.
This can come up in some cases like exec failure before the new mm has
ever been switched to. This patch reduces TLBIE instructions required
to build a kernel from about 120,000 to 45,000. Another situation it
could help is page reclaim, KSM, THP, etc., (i.e., asynch operations
external to the process) where the process is sleeping and has all TLBs
flushed out of all CPUs.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/mm/book3s64/radix_tlb.c | 38 ++++++++++++++++++----------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
index 12481c864ab6..5b62e2e7371c 100644
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
@@ -694,13 +694,19 @@ static inline void exit_flush_lazy_tlbs(struct mm_struct *mm) { }
#endif /* CONFIG_SMP */
enum tlb_flush_type {
+ FLUSH_TYPE_NONE,
FLUSH_TYPE_LOCAL,
FLUSH_TYPE_GLOBAL,
};
static enum tlb_flush_type flush_type_needed(struct mm_struct *mm, bool fullmm)
{
- if (mm_is_thread_local(mm))
+ int active_cpus = atomic_read(&mm->context.active_cpus);
+ int cpu = smp_processor_id();
+
+ if (active_cpus == 0)
+ return FLUSH_TYPE_NONE;
+ if (active_cpus == 1 && cpumask_test_cpu(cpu, mm_cpumask(mm)))
return FLUSH_TYPE_LOCAL;
/* Coprocessors require TLBIE to invalidate nMMU. */
@@ -754,7 +760,9 @@ void radix__flush_tlb_mm(struct mm_struct *mm)
*/
smp_mb();
type = flush_type_needed(mm, false);
- if (type == FLUSH_TYPE_GLOBAL) {
+ if (type == FLUSH_TYPE_LOCAL) {
+ _tlbiel_pid(pid, RIC_FLUSH_TLB);
+ } else if (type == FLUSH_TYPE_GLOBAL) {
if (!mmu_has_feature(MMU_FTR_GTSE)) {
unsigned long tgt = H_RPTI_TARGET_CMMU;
@@ -770,8 +778,6 @@ void radix__flush_tlb_mm(struct mm_struct *mm)
} else {
_tlbiel_pid_multicast(mm, pid, RIC_FLUSH_TLB);
}
- } else {
- _tlbiel_pid(pid, RIC_FLUSH_TLB);
}
preempt_enable();
}
@@ -789,7 +795,9 @@ static void __flush_all_mm(struct mm_struct *mm, bool fullmm)
preempt_disable();
smp_mb(); /* see radix__flush_tlb_mm */
type = flush_type_needed(mm, fullmm);
- if (type == FLUSH_TYPE_GLOBAL) {
+ if (type == FLUSH_TYPE_LOCAL) {
+ _tlbiel_pid(pid, RIC_FLUSH_ALL);
+ } else if (type == FLUSH_TYPE_GLOBAL) {
if (!mmu_has_feature(MMU_FTR_GTSE)) {
unsigned long tgt = H_RPTI_TARGET_CMMU;
unsigned long type = H_RPTI_TYPE_TLB | H_RPTI_TYPE_PWC |
@@ -803,8 +811,6 @@ static void __flush_all_mm(struct mm_struct *mm, bool fullmm)
_tlbie_pid(pid, RIC_FLUSH_ALL);
else
_tlbiel_pid_multicast(mm, pid, RIC_FLUSH_ALL);
- } else {
- _tlbiel_pid(pid, RIC_FLUSH_ALL);
}
preempt_enable();
}
@@ -828,7 +834,9 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
preempt_disable();
smp_mb(); /* see radix__flush_tlb_mm */
type = flush_type_needed(mm, false);
- if (type == FLUSH_TYPE_GLOBAL) {
+ if (type == FLUSH_TYPE_LOCAL) {
+ _tlbiel_va(vmaddr, pid, psize, RIC_FLUSH_TLB);
+ } else if (type == FLUSH_TYPE_GLOBAL) {
if (!mmu_has_feature(MMU_FTR_GTSE)) {
unsigned long tgt, pg_sizes, size;
@@ -845,8 +853,6 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
_tlbie_va(vmaddr, pid, psize, RIC_FLUSH_TLB);
else
_tlbiel_va_multicast(mm, vmaddr, pid, psize, RIC_FLUSH_TLB);
- } else {
- _tlbiel_va(vmaddr, pid, psize, RIC_FLUSH_TLB);
}
preempt_enable();
}
@@ -935,6 +941,8 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
preempt_disable();
smp_mb(); /* see radix__flush_tlb_mm */
type = flush_type_needed(mm, fullmm);
+ if (type == FLUSH_TYPE_NONE)
+ goto out;
if (fullmm)
flush_pid = true;
@@ -999,6 +1007,7 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
hstart, hend, pid, PMD_SIZE, MMU_PAGE_2M, false);
}
}
+out:
preempt_enable();
}
@@ -1123,6 +1132,8 @@ static __always_inline void __radix__flush_tlb_range_psize(struct mm_struct *mm,
preempt_disable();
smp_mb(); /* see radix__flush_tlb_mm */
type = flush_type_needed(mm, fullmm);
+ if (type == FLUSH_TYPE_NONE)
+ goto out;
if (fullmm)
flush_pid = true;
@@ -1166,6 +1177,7 @@ static __always_inline void __radix__flush_tlb_range_psize(struct mm_struct *mm,
_tlbiel_va_range_multicast(mm,
start, end, pid, page_size, psize, also_pwc);
}
+out:
preempt_enable();
}
@@ -1203,7 +1215,9 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
preempt_disable();
smp_mb(); /* see radix__flush_tlb_mm */
type = flush_type_needed(mm, false);
- if (type == FLUSH_TYPE_GLOBAL) {
+ if (type == FLUSH_TYPE_LOCAL) {
+ _tlbiel_va_range(addr, end, pid, PAGE_SIZE, mmu_virtual_psize, true);
+ } else if (type == FLUSH_TYPE_GLOBAL) {
if (!mmu_has_feature(MMU_FTR_GTSE)) {
unsigned long tgt, type, pg_sizes;
@@ -1221,8 +1235,6 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
else
_tlbiel_va_range_multicast(mm,
addr, end, pid, PAGE_SIZE, mmu_virtual_psize, true);
- } else {
- _tlbiel_va_range(addr, end, pid, PAGE_SIZE, mmu_virtual_psize, true);
}
preempt_enable();
--
2.23.0
^ permalink raw reply related
* [PATCH 2/7] powerpc/64s/radix: refactor TLB flush type selection
From: Nicholas Piggin @ 2020-12-17 13:47 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Nicholas Piggin
In-Reply-To: <20201217134731.488135-1-npiggin@gmail.com>
The logic to decide what kind of TLB flush is required (local, global,
or IPI) is spread multiple times over the several kinds of TLB flushes.
Move it all into a single function which may issue IPIs if necessary,
and also returns a flush type that is to be used.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/mm/book3s64/radix_tlb.c | 176 ++++++++++++++-------------
1 file changed, 94 insertions(+), 82 deletions(-)
diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
index 5f09e0cd0016..12481c864ab6 100644
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
@@ -618,15 +618,6 @@ void radix__local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmadd
}
EXPORT_SYMBOL(radix__local_flush_tlb_page);
-static bool mm_is_singlethreaded(struct mm_struct *mm)
-{
- if (atomic_read(&mm->context.copros) > 0)
- return false;
- if (atomic_read(&mm->mm_users) <= 1 && current->mm == mm)
- return true;
- return false;
-}
-
static bool mm_needs_flush_escalation(struct mm_struct *mm)
{
/*
@@ -698,10 +689,58 @@ static void exit_flush_lazy_tlbs(struct mm_struct *mm)
smp_call_function_many(mm_cpumask(mm), do_exit_flush_lazy_tlb,
(void *)mm, 1);
}
+#else /* CONFIG_SMP */
+static inline void exit_flush_lazy_tlbs(struct mm_struct *mm) { }
+#endif /* CONFIG_SMP */
+
+enum tlb_flush_type {
+ FLUSH_TYPE_LOCAL,
+ FLUSH_TYPE_GLOBAL,
+};
+
+static enum tlb_flush_type flush_type_needed(struct mm_struct *mm, bool fullmm)
+{
+ if (mm_is_thread_local(mm))
+ return FLUSH_TYPE_LOCAL;
+
+ /* Coprocessors require TLBIE to invalidate nMMU. */
+ if (atomic_read(&mm->context.copros) > 0)
+ return FLUSH_TYPE_GLOBAL;
+
+ /*
+ * In the fullmm case there's no point doing the exit_flush_lazy_tlbs
+ * because the mm is being taken down anyway, and a TLBIE tends to
+ * be faster than an IPI+TLBIEL.
+ */
+ if (fullmm)
+ return FLUSH_TYPE_GLOBAL;
+
+ /*
+ * If we are running the only thread of a single-threaded process,
+ * then we should almost always be able to trim off the rest of the
+ * CPU mask (except in the case of use_mm() races), so always try
+ * trimming the mask.
+ */
+ if (atomic_read(&mm->mm_users) <= 1 && current->mm == mm) {
+ exit_flush_lazy_tlbs(mm);
+ /*
+ * use_mm() race could prevent IPIs from being able to clear
+ * the cpumask here, however those users are established
+ * after our first check (and so after the PTEs are removed),
+ * and the TLB still gets flushed by the IPI, so this CPU
+ * will only require a local flush.
+ */
+ return FLUSH_TYPE_LOCAL;
+ }
+
+ return FLUSH_TYPE_GLOBAL;
+}
+#ifdef CONFIG_SMP
void radix__flush_tlb_mm(struct mm_struct *mm)
{
unsigned long pid;
+ enum tlb_flush_type type;
pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT))
@@ -709,16 +748,13 @@ void radix__flush_tlb_mm(struct mm_struct *mm)
preempt_disable();
/*
- * Order loads of mm_cpumask vs previous stores to clear ptes before
- * the invalidate. See barrier in switch_mm_irqs_off
+ * Order loads of mm_cpumask (in flush_type_needed) vs previous
+ * stores to clear ptes before the invalidate. See barrier in
+ * switch_mm_irqs_off
*/
smp_mb();
- if (!mm_is_thread_local(mm)) {
- if (unlikely(mm_is_singlethreaded(mm))) {
- exit_flush_lazy_tlbs(mm);
- goto local;
- }
-
+ type = flush_type_needed(mm, false);
+ if (type == FLUSH_TYPE_GLOBAL) {
if (!mmu_has_feature(MMU_FTR_GTSE)) {
unsigned long tgt = H_RPTI_TARGET_CMMU;
@@ -735,7 +771,6 @@ void radix__flush_tlb_mm(struct mm_struct *mm)
_tlbiel_pid_multicast(mm, pid, RIC_FLUSH_TLB);
}
} else {
-local:
_tlbiel_pid(pid, RIC_FLUSH_TLB);
}
preempt_enable();
@@ -745,6 +780,7 @@ EXPORT_SYMBOL(radix__flush_tlb_mm);
static void __flush_all_mm(struct mm_struct *mm, bool fullmm)
{
unsigned long pid;
+ enum tlb_flush_type type;
pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT))
@@ -752,13 +788,8 @@ static void __flush_all_mm(struct mm_struct *mm, bool fullmm)
preempt_disable();
smp_mb(); /* see radix__flush_tlb_mm */
- if (!mm_is_thread_local(mm)) {
- if (unlikely(mm_is_singlethreaded(mm))) {
- if (!fullmm) {
- exit_flush_lazy_tlbs(mm);
- goto local;
- }
- }
+ type = flush_type_needed(mm, fullmm);
+ if (type == FLUSH_TYPE_GLOBAL) {
if (!mmu_has_feature(MMU_FTR_GTSE)) {
unsigned long tgt = H_RPTI_TARGET_CMMU;
unsigned long type = H_RPTI_TYPE_TLB | H_RPTI_TYPE_PWC |
@@ -773,7 +804,6 @@ static void __flush_all_mm(struct mm_struct *mm, bool fullmm)
else
_tlbiel_pid_multicast(mm, pid, RIC_FLUSH_ALL);
} else {
-local:
_tlbiel_pid(pid, RIC_FLUSH_ALL);
}
preempt_enable();
@@ -789,6 +819,7 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
int psize)
{
unsigned long pid;
+ enum tlb_flush_type type;
pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT))
@@ -796,11 +827,8 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
preempt_disable();
smp_mb(); /* see radix__flush_tlb_mm */
- if (!mm_is_thread_local(mm)) {
- if (unlikely(mm_is_singlethreaded(mm))) {
- exit_flush_lazy_tlbs(mm);
- goto local;
- }
+ type = flush_type_needed(mm, false);
+ if (type == FLUSH_TYPE_GLOBAL) {
if (!mmu_has_feature(MMU_FTR_GTSE)) {
unsigned long tgt, pg_sizes, size;
@@ -818,7 +846,6 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
else
_tlbiel_va_multicast(mm, vmaddr, pid, psize, RIC_FLUSH_TLB);
} else {
-local:
_tlbiel_va(vmaddr, pid, psize, RIC_FLUSH_TLB);
}
preempt_enable();
@@ -834,8 +861,6 @@ void radix__flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
}
EXPORT_SYMBOL(radix__flush_tlb_page);
-#else /* CONFIG_SMP */
-static inline void exit_flush_lazy_tlbs(struct mm_struct *mm) { }
#endif /* CONFIG_SMP */
static void do_tlbiel_kernel(void *info)
@@ -899,7 +924,9 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
unsigned int page_shift = mmu_psize_defs[mmu_virtual_psize].shift;
unsigned long page_size = 1UL << page_shift;
unsigned long nr_pages = (end - start) >> page_shift;
- bool local, full;
+ bool fullmm = (end == TLB_FLUSH_ALL);
+ bool flush_pid;
+ enum tlb_flush_type type;
pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT))
@@ -907,24 +934,16 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
preempt_disable();
smp_mb(); /* see radix__flush_tlb_mm */
- if (!mm_is_thread_local(mm)) {
- if (unlikely(mm_is_singlethreaded(mm))) {
- if (end != TLB_FLUSH_ALL) {
- exit_flush_lazy_tlbs(mm);
- goto is_local;
- }
- }
- local = false;
- full = (end == TLB_FLUSH_ALL ||
- nr_pages > tlb_single_page_flush_ceiling);
- } else {
-is_local:
- local = true;
- full = (end == TLB_FLUSH_ALL ||
- nr_pages > tlb_local_single_page_flush_ceiling);
- }
+ type = flush_type_needed(mm, fullmm);
+
+ if (fullmm)
+ flush_pid = true;
+ else if (type == FLUSH_TYPE_GLOBAL)
+ flush_pid = nr_pages > tlb_single_page_flush_ceiling;
+ else
+ flush_pid = nr_pages > tlb_local_single_page_flush_ceiling;
- if (!mmu_has_feature(MMU_FTR_GTSE) && !local) {
+ if (!mmu_has_feature(MMU_FTR_GTSE) && type == FLUSH_TYPE_GLOBAL) {
unsigned long tgt = H_RPTI_TARGET_CMMU;
unsigned long pg_sizes = psize_to_rpti_pgsize(mmu_virtual_psize);
@@ -934,8 +953,8 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
tgt |= H_RPTI_TARGET_NMMU;
pseries_rpt_invalidate(pid, tgt, H_RPTI_TYPE_TLB, pg_sizes,
start, end);
- } else if (full) {
- if (local) {
+ } else if (flush_pid) {
+ if (type == FLUSH_TYPE_LOCAL) {
_tlbiel_pid(pid, RIC_FLUSH_TLB);
} else {
if (cputlb_use_tlbie()) {
@@ -958,7 +977,7 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
hflush = true;
}
- if (local) {
+ if (type == FLUSH_TYPE_LOCAL) {
asm volatile("ptesync": : :"memory");
__tlbiel_va_range(start, end, pid, page_size, mmu_virtual_psize);
if (hflush)
@@ -1091,32 +1110,28 @@ static __always_inline void __radix__flush_tlb_range_psize(struct mm_struct *mm,
unsigned int page_shift = mmu_psize_defs[psize].shift;
unsigned long page_size = 1UL << page_shift;
unsigned long nr_pages = (end - start) >> page_shift;
- bool local, full;
+ bool fullmm = (end == TLB_FLUSH_ALL);
+ bool flush_pid;
+ enum tlb_flush_type type;
pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT))
return;
+ fullmm = (end == TLB_FLUSH_ALL);
+
preempt_disable();
smp_mb(); /* see radix__flush_tlb_mm */
- if (!mm_is_thread_local(mm)) {
- if (unlikely(mm_is_singlethreaded(mm))) {
- if (end != TLB_FLUSH_ALL) {
- exit_flush_lazy_tlbs(mm);
- goto is_local;
- }
- }
- local = false;
- full = (end == TLB_FLUSH_ALL ||
- nr_pages > tlb_single_page_flush_ceiling);
- } else {
-is_local:
- local = true;
- full = (end == TLB_FLUSH_ALL ||
- nr_pages > tlb_local_single_page_flush_ceiling);
- }
+ type = flush_type_needed(mm, fullmm);
- if (!mmu_has_feature(MMU_FTR_GTSE) && !local) {
+ if (fullmm)
+ flush_pid = true;
+ else if (type == FLUSH_TYPE_GLOBAL)
+ flush_pid = nr_pages > tlb_single_page_flush_ceiling;
+ else
+ flush_pid = nr_pages > tlb_local_single_page_flush_ceiling;
+
+ if (!mmu_has_feature(MMU_FTR_GTSE) && type == FLUSH_TYPE_GLOBAL) {
unsigned long tgt = H_RPTI_TARGET_CMMU;
unsigned long type = H_RPTI_TYPE_TLB;
unsigned long pg_sizes = psize_to_rpti_pgsize(psize);
@@ -1126,8 +1141,8 @@ static __always_inline void __radix__flush_tlb_range_psize(struct mm_struct *mm,
if (atomic_read(&mm->context.copros) > 0)
tgt |= H_RPTI_TARGET_NMMU;
pseries_rpt_invalidate(pid, tgt, type, pg_sizes, start, end);
- } else if (full) {
- if (local) {
+ } else if (flush_pid) {
+ if (type == FLUSH_TYPE_LOCAL) {
_tlbiel_pid(pid, also_pwc ? RIC_FLUSH_ALL : RIC_FLUSH_TLB);
} else {
if (cputlb_use_tlbie()) {
@@ -1143,7 +1158,7 @@ static __always_inline void __radix__flush_tlb_range_psize(struct mm_struct *mm,
}
} else {
- if (local)
+ if (type == FLUSH_TYPE_LOCAL)
_tlbiel_va_range(start, end, pid, page_size, psize, also_pwc);
else if (cputlb_use_tlbie())
_tlbie_va_range(start, end, pid, page_size, psize, also_pwc);
@@ -1170,6 +1185,7 @@ static void radix__flush_tlb_pwc_range_psize(struct mm_struct *mm, unsigned long
void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
{
unsigned long pid, end;
+ enum tlb_flush_type type;
pid = mm->context.id;
if (unlikely(pid == MMU_NO_CONTEXT))
@@ -1186,11 +1202,8 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
/* Otherwise first do the PWC, then iterate the pages. */
preempt_disable();
smp_mb(); /* see radix__flush_tlb_mm */
- if (!mm_is_thread_local(mm)) {
- if (unlikely(mm_is_singlethreaded(mm))) {
- exit_flush_lazy_tlbs(mm);
- goto local;
- }
+ type = flush_type_needed(mm, false);
+ if (type == FLUSH_TYPE_GLOBAL) {
if (!mmu_has_feature(MMU_FTR_GTSE)) {
unsigned long tgt, type, pg_sizes;
@@ -1209,7 +1222,6 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
_tlbiel_va_range_multicast(mm,
addr, end, pid, PAGE_SIZE, mmu_virtual_psize, true);
} else {
-local:
_tlbiel_va_range(addr, end, pid, PAGE_SIZE, mmu_virtual_psize, true);
}
--
2.23.0
^ permalink raw reply related
* [PATCH 1/7] powerpc/64s/radix: add warning and comments in mm_cpumask trim
From: Nicholas Piggin @ 2020-12-17 13:47 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Nicholas Piggin
In-Reply-To: <20201217134731.488135-1-npiggin@gmail.com>
Add a comment explaining part of the logic for mm_cpumask trimming, and
add a (hopefully graceful) check and warning in case something gets it
wrong.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/mm/book3s64/radix_tlb.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
index b487b489d4b6..5f09e0cd0016 100644
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
@@ -644,13 +644,14 @@ static void do_exit_flush_lazy_tlb(void *arg)
{
struct mm_struct *mm = arg;
unsigned long pid = mm->context.id;
+ int cpu = smp_processor_id();
/*
* A kthread could have done a mmget_not_zero() after the flushing CPU
- * checked mm_is_singlethreaded, and be in the process of
- * kthread_use_mm when interrupted here. In that case, current->mm will
- * be set to mm, because kthread_use_mm() setting ->mm and switching to
- * the mm is done with interrupts off.
+ * checked mm_cpumask, and be in the process of kthread_use_mm when
+ * interrupted here. In that case, current->mm will be set to mm,
+ * because kthread_use_mm() setting ->mm and switching to the mm is
+ * done with interrupts off.
*/
if (current->mm == mm)
goto out_flush;
@@ -664,8 +665,22 @@ static void do_exit_flush_lazy_tlb(void *arg)
mmdrop(mm);
}
- atomic_dec(&mm->context.active_cpus);
- cpumask_clear_cpu(smp_processor_id(), mm_cpumask(mm));
+ /*
+ * This IPI is only initiated from a CPU which is running mm which
+ * is a single-threaded process, so there will not be another racing
+ * IPI coming in where we would find our cpumask already clear.
+ *
+ * Nothing else clears our bit in the cpumask except CPU offlining,
+ * in which case we should not be taking IPIs here. However check
+ * this just in case the logic is wrong somewhere, and don't underflow
+ * the active_cpus count.
+ */
+ if (cpumask_test_cpu(cpu, mm_cpumask(mm))) {
+ atomic_dec(&mm->context.active_cpus);
+ cpumask_clear_cpu(cpu, mm_cpumask(mm));
+ } else {
+ WARN_ON_ONCE(1);
+ }
out_flush:
_tlbiel_pid(pid, RIC_FLUSH_ALL);
--
2.23.0
^ permalink raw reply related
* [PATCH 0/7] powerpc/64s: TLB flushing improvements
From: Nicholas Piggin @ 2020-12-17 13:47 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Nicholas Piggin
Another round of reducing TLB flushing (mostly on radix).
Thanks,
Nick
Nicholas Piggin (7):
powerpc/64s/radix: add warning and comments in mm_cpumask trim
powerpc/64s/radix: refactor TLB flush type selection
powerpc/64s/radix: Check for no TLB flush required
powerpc/64s/radix: Allow mm_cpumask trimming from external sources
powerpc/64s/radix: occasionally attempt to trim mm_cpumask
powerpc/64s/radix: serialize_against_pte_lookup IPIs trim mm_cpumask
powerpc/64s: Implement ptep_clear_flush_young that does not flush TLBs
arch/powerpc/include/asm/book3s/64/pgtable.h | 23 +-
arch/powerpc/mm/book3s64/pgtable.c | 13 +-
arch/powerpc/mm/book3s64/radix_tlb.c | 297 ++++++++++++-------
3 files changed, 225 insertions(+), 108 deletions(-)
--
2.23.0
^ permalink raw reply
* [GIT PULL] Please pull powerpc/linux.git powerpc-5.11-1 tag
From: Michael Ellerman @ 2020-12-17 13:28 UTC (permalink / raw)
To: Linus Torvalds
Cc: ego, clombard, david, aik, jniethe5, srikar, bala24, oohall,
miaoqinglang, ardb, ajd, leobras.c, maddy, aneesh.kumar,
vincent.stehle, tiwai, ganeshgr, u.kleine-koenig, harish, longman,
mathieu.desnoyers, nathanl, ravi.bangoria, Kees Cook, amodra,
npiggin, oss, kaixuxia, clg, oleg, ldufour, tangyouling,
po-hsu.lin, dja, atrajeev, zhangxiaoxu5, linux-kernel, tyreld,
fbarrat, colin.king, linuxppc-dev, morbo
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hi Linus,
Please pull powerpc updates for 5.11.
There's only one conflict I'm aware of, which is the three lkdtm files,
resolution is simply to take both sides.
Notable out of area changes:
drivers/misc/lkdtm/* # 3ba150fb2120 lkdtm/powerpc: Add SLB multihit test
tools/testing/selftests/lkdtm/tests.txt
include/linux/compat.h # 14026b94ccfe signal: Add unsafe_put_compat_sigset()
include/linux/memory_hotplug.h # 4abb1e5b63ac powerpc/mm: factor out creating/removing linear mapping
include/linux/regset.h # 640586f8af35 powerpc/ptrace: Simplify gpr_get()/tm_cgpr_get()
cheers
The following changes since commit 3cea11cd5e3b00d91caf0b4730194039b45c5891:
Linux 5.10-rc2 (2020-11-01 14:43:51 -0800)
are available in the git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.11-1
for you to fetch changes up to c1bea0a840ac75dca19bc6aa05575a33eb9fd058:
powerpc/32s: Fix cleanup_cpu_mmu_context() compile bug (2020-12-17 14:33:35 +1100)
- ------------------------------------------------------------------
powerpc updates for 5.11
- Switch to the generic C VDSO, as well as some cleanups of our VDSO
setup/handling code.
- Support for KUAP (Kernel User Access Prevention) on systems using the hashed
page table MMU, using memory protection keys.
- Better handling of PowerVM SMT8 systems where all threads of a core do not
share an L2, allowing the scheduler to make better scheduling decisions.
- Further improvements to our machine check handling.
- Show registers when unwinding interrupt frames during stack traces.
- Improvements to our pseries (PowerVM) partition migration code.
- Several series from Christophe refactoring and cleaning up various parts of
the 32-bit code.
- Other smaller features, fixes & cleanups.
Thanks to:
Alan Modra, Alexey Kardashevskiy, Andrew Donnellan, Aneesh Kumar K.V, Ard
Biesheuvel, Athira Rajeev, Balamuruhan S, Bill Wendling, Cédric Le Goater,
Christophe Leroy, Christophe Lombard, Colin Ian King, Daniel Axtens, David
Hildenbrand, Frederic Barrat, Ganesh Goudar, Gautham R. Shenoy, Geert
Uytterhoeven, Giuseppe Sacco, Greg Kurz, Harish, Jan Kratochvil, Jordan
Niethe, Kaixu Xia, Laurent Dufour, Leonardo Bras, Madhavan Srinivasan, Mahesh
Salgaonkar, Mathieu Desnoyers, Nathan Lynch, Nicholas Piggin, Oleg Nesterov,
Oliver O'Halloran, Oscar Salvador, Po-Hsu Lin, Qian Cai, Qinglang Miao, Randy
Dunlap, Ravi Bangoria, Sachin Sant, Sandipan Das, Sebastian Andrzej Siewior ,
Segher Boessenkool, Srikar Dronamraju, Tyrel Datwyler, Uwe Kleine-König,
Vincent Stehlé, Youling Tang, Zhang Xiaoxu.
- ------------------------------------------------------------------
Alan Modra (1):
powerpc/boot: Make use of REL16 relocs in powerpc/boot/util.S
Alexey Kardashevskiy (1):
powerpc/powernv/npu: Do not attempt NPU2 setup on POWER8NVL NPU
Andrew Donnellan (1):
powerpc/powernv: Rate limit opal-elog read failure message
Aneesh Kumar K.V (26):
powerpc/mm: Move setting PTE specific flags to pfn_pmd()
powerpc/mm: Update tlbiel loop on POWER10
powerpc: Add new macro to handle NESTED_IFCLR
KVM: PPC: BOOK3S: PR: Ignore UAMOR SPR
powerpc/book3s64/kuap/kuep: Add PPC_PKEY config on book3s64
powerpc/book3s64/kuap/kuep: Move uamor setup to pkey init
powerpc/book3s64/kuap: Move KUAP related function outside radix
powerpc/book3s64/kuep: Move KUEP related function outside radix
powerpc/book3s64/kuap: Rename MMU_FTR_RADIX_KUAP and MMU_FTR_KUEP
powerpc/book3s64/kuap: Use Key 3 for kernel mapping with hash translation
powerpc/exec: Set thread.regs early during exec
powerpc/book3s64/pkeys: Store/restore userspace AMR/IAMR correctly on entry and exit from kernel
powerpc/book3s64/pkeys: Inherit correctly on fork.
powerpc/book3s64/pkeys: Reset userspace AMR correctly on exec
powerpc/ptrace-view: Use pt_regs values instead of thread_struct based one.
powerpc/book3s64/pkeys: Don't update SPRN_AMR when in kernel mode.
powerpc/book3s64/kuap: Restrict access to userspace based on userspace AMR
powerpc/book3s64/kuap: Improve error reporting with KUAP
powerpc/book3s64/kuap: Use Key 3 to implement KUAP with hash translation.
powerpc/book3s64/kuep: Use Key 3 to implement KUEP with hash translation.
powerpc/book3s64/hash/kuap: Enable kuap on hash
powerpc/book3s64/hash/kuep: Enable KUEP on hash
powerpc/book3s64/kup: Check max key supported before enabling kup
powerpc/book3s64/pkeys: Optimize KUAP and KUEP feature disabled case
powerpc/book3s64/kuap: Improve error reporting with KUAP
powerpc/64s: Mark the kuap/kuep functions non __init
Ard Biesheuvel (1):
powerpc: Avoid broken GCC __attribute__((optimize))
Athira Rajeev (13):
powerpc/perf: Add new power PMU flag "PPMU_P10_DD1" for power10 DD1
powerpc/perf: Drop the check for SIAR_VALID
powerpc/perf: Use the address from SIAR register to set cpumode flags
powerpc/perf: Fix crash with is_sier_available when pmu is not set
powerpc/perf: Invoke per-CPU variable access with disabled interrupts
powerpc/perf: Fix to update radix_scope_qual in power10
powerpc/perf: Update the PMU group constraints for l2l3 events in power10
powerpc/perf: Fix the PMU group constraints for threshold events in power10
powerpc/perf: Add generic and cache event list for power10 DD1
powerpc/perf: Fix to update generic event codes for power10
powerpc/perf: Fix to update cache events with l2l3 events in power10
powerpc/perf: MMCR0 control for PMU registers under PMCC=00
powerpc/perf: Exclude kernel samples while counting events in user space.
Balamuruhan S (4):
powerpc/sstep: Emulate prefixed instructions only when CPU_FTR_ARCH_31 is set
powerpc/sstep: Support VSX vector paired storage access instructions
powerpc/ppc-opcode: Add encoding macros for VSX vector paired instructions
powerpc/sstep: Add testcases for VSX vector paired load/store instructions
Bill Wendling (5):
powerpc/boot: Move the .got section to after the .dynamic section
powerpc/boot/wrapper: Add "-z rodynamic" when using LLD
powerpc/boot/wrapper: Add "-z notext" flag to disable diagnostic
powerpc/boot: Use clang when CC is clang
powerpc: Work around inline asm issues in alternate feature sections
Christophe Leroy (128):
powerpc/bitops: Fix possible undefined behaviour with fls() and fls64()
powerpc/feature: Fix CPU_FTRS_ALWAYS by removing CPU_FTRS_GENERIC_32
powerpc/64s: Replace RFI by RFI_TO_KERNEL and remove RFI
powerpc: Replace RFI by rfi on book3s/32 and booke
powerpc: Remove RFI macro
powerpc: inline iomap accessors
powerpc/feature: Use CONFIG_PPC64 instead of __powerpc64__ to define possible features
powerpc/processor: Move cpu_relax() into asm/vdso/processor.h
powerpc/time: Move timebase functions into new asm/vdso/timebase.h
powerpc/vdso: Prepare for switching VDSO to generic C implementation.
powerpc/vdso: Save and restore TOC pointer on PPC64
powerpc/vdso: Switch VDSO to generic C implementation.
powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32
powerpc/signal: Move inline functions in signal.h
powerpc/ptrace: Move declaration of ptrace_get_reg() and ptrace_set_reg()
powerpc/ptrace: Consolidate reg index calculation
powerpc/ptrace: Create ptrace_get_fpr() and ptrace_put_fpr()
powerpc/signal: Don't manage floating point regs when no FPU
powerpc/32s: Allow deselecting CONFIG_PPC_FPU on mpc832x
powerpc/signal: Remove BUG_ON() in handler_signal functions
powerpc/signal: Move access_ok() out of get_sigframe()
powerpc/signal: Remove get_clean_sp()
powerpc/signal: Call get_tm_stackpointer() from get_sigframe()
powerpc/signal: Refactor bad frame logging
powerpc/signal32: Simplify logging in handle_rt_signal32()
powerpc/signal32: Move handle_signal32() close to handle_rt_signal32()
powerpc/signal32: Rename local pointers in handle_rt_signal32()
powerpc/signal32: Misc changes to make handle_[rt_]_signal32() more similar
powerpc/signal32: Move signal trampoline setup to handle_[rt_]signal32
powerpc/signal32: Switch handle_signal32() to user_access_begin() logic
powerpc/signal32: Switch handle_rt_signal32() to user_access_begin() logic
powerpc/signal32: Remove ifdefery in middle of if/else
signal: Add unsafe_put_compat_sigset()
powerpc/signal32: Add and use unsafe_put_sigset_t()
powerpc/signal32: Switch swap_context() to user_access_begin() logic
powerpc/signal: Create 'unsafe' versions of copy_[ck][fpr/vsx]_to_user()
powerpc/signal32: Isolate non-copy actions in save_user_regs() and save_tm_user_regs()
powerpc/signal32: Transform save_user_regs() and save_tm_user_regs() in 'unsafe' version
powerpc/vdso: Stripped VDSO is not needed, don't build it
powerpc/vdso: Add missing includes and clean vdso_setup_syscall_map()
powerpc/vdso: Rename syscall_map_32/64 to simplify vdso_setup_syscall_map()
powerpc/vdso: Remove get_page() in vdso_pagelist initialization
powerpc/vdso: Remove NULL termination element in vdso_pagelist
powerpc/vdso: Refactor 32 bits and 64 bits pages setup
powerpc/vdso: Remove unnecessary ifdefs in vdso_pagelist initialization
powerpc/vdso: Use VDSO size in arch_setup_additional_pages()
powerpc/vdso: Simplify arch_setup_additional_pages() exit
powerpc/vdso: Move to _install_special_mapping() and remove arch_vma_name()
powerpc/vdso: Provide vdso_remap()
powerpc/vdso: Replace vdso_base by vdso
powerpc/vdso: Move vdso datapage up front
powerpc/vdso: Simplify __get_datapage()
powerpc/vdso: Remove unused \tmp param in __get_datapage()
powerpc/vdso: Retrieve sigtramp offsets at buildtime
powerpc/vdso: Use builtin symbols to locate fixup section
powerpc/vdso: Merge __kernel_sync_dicache_p5() into __kernel_sync_dicache()
powerpc/vdso: Remove vdso32_pages and vdso64_pages
powerpc/vdso: Remove __kernel_datapage_offset
powerpc/vdso: Remove runtime generated sigtramp offsets
powerpc/vdso: Remove vdso_patches[] and associated functions
powerpc/vdso: Remove unused text member in struct lib32/64_elfinfo
powerpc/vdso: Remove symbol section information in struct lib32/64_elfinfo
powerpc/vdso: Remove lib32_elfinfo and lib64_elfinfo
powerpc/vdso: Remove vdso_setup()
powerpc/vdso: Remove vdso_ready
powerpc/vdso: Remove DBG()
powerpc/vdso: Remove VDSO32_LBASE and VDSO64_LBASE
powerpc/vdso: Cleanup vdso.h
powerpc/32s: Always map kernel text and rodata with BATs
powerpc/32s: Don't hash_preload() kernel text
powerpc/32s: Fix an FTR_SECTION_ELSE
powerpc/32s: Don't use SPRN_SPRG_PGDIR in hash_page
powerpc/603: Use SPRN_SDR1 to store the pgdir phys address
powerpc/32: Simplify EXCEPTION_PROLOG_1 macro
powerpc/32s: Use SPRN_SPRG_SCRATCH2 in DSI prolog
powerpc/32: Use SPRN_SPRG_SCRATCH2 in exception prologs
powerpc/time: Remove ifdef in get_vtb()
powerpc/mm: Fix verification of MMU_FTR_TYPE_44x
powerpc/feature: Add CPU_FTR_NOEXECUTE to G2_LE
powerpc/mm: Remove useless #ifndef CPU_FTR_COHERENT_ICACHE in mem.c
powerpc/mm: MMU_FTR_NEED_DTLB_SW_LRU is only possible with CONFIG_PPC_83xx
powerpc/mm: Desintegrate MMU_FTR_PPCAS_ARCH_V2
powerpc/feature: Remove CPU_FTR_NODSISRALIGN
powerpc/44x: Don't support 440 when CONFIG_PPC_47x is set
powerpc/44x: Don't support 47x code and non 47x code at the same time
powerpc/xmon: Change printk() to pr_cont()
powerpc: Fix update form addressing in inline assembly
powerpc: Retire e200 core (mpc555x processor)
powerpc: Remove ucache_bsize
powerpc/powermac: Fix low_sleep_handler with CONFIG_VMAP_STACK
powerpc/mm: Add mask of always present MMU features
powerpc/mm: Remove flush_tlb_page_nohash() prototype.
powerpc/32s: Make bat_addrs[] static
powerpc/32s: Use mmu_has_feature(MMU_FTR_HPTE_TABLE) instead of checking Hash var
powerpc/32s: Make Hash var static
powerpc/32s: Declare Hash related vars as __initdata
powerpc/32s: Move _tlbie() and _tlbia() prototypes to tlbflush.h
powerpc/32s: Inline _tlbie() on non SMP
powerpc/32s: Move _tlbie() and _tlbia() in a new file
powerpc/32s: Split and inline flush_tlb_mm() and flush_tlb_page()
powerpc/32s: Inline flush_tlb_range() and flush_tlb_kernel_range()
powerpc/32s: Split and inline flush_range()
powerpc/32s: Inline tlb_flush()
powerpc/32s: Inline flush_hash_entry()
powerpc/32s: Move early_mmu_init() into mmu.c
powerpc/32s: Remove CONFIG_PPC_BOOK3S_6xx
powerpc/32s: Regroup 603 based CPUs in cputable
powerpc/32s: Make support for 603 and 604+ selectable
powerpc/32s: Handle PROTFAULT in hash_page() also for CONFIG_PPC_KUAP
powerpc/8xx: Fix early debug when SMC1 is relocated
powerpc/process: Remove target specific __set_dabr()
powerpc/8xx: DEBUG_PAGEALLOC doesn't require an ITLB miss exception handler
powerpc/8xx: Always pin kernel text TLB
powerpc/8xx: Simplify INVALIDATE_ADJACENT_PAGES_CPU15
powerpc/8xx: Use SPRN_SPRG_SCRATCH2 in ITLB miss exception
powerpc/8xx: Use SPRN_SPRG_SCRATCH2 in DTLB miss exception
powerpc/ppc-opcode: Add PPC_RAW_MFSPR()
powerpc/mm: sanity_check_fault() should work for all, not only BOOK3S
powerpc/fault: Unnest definition of page_fault_is_write() and page_fault_is_bad()
powerpc/mm: Move the WARN() out of bad_kuap_fault()
powerpc/fault: Avoid heavy search_exception_tables() verification
powerpc/fault: Perform exception fixup in do_page_fault()
powerpc/mm: Refactor the floor/ceiling check in hugetlb range freeing functions
powerpc/32s: Remove unused counters incremented by create_hpte()
powerpc/32s: In add_hash_page(), calculate VSID later
powerpc/32s: Cleanup around PTE_FLAGS_OFFSET in hash_low.S
powerpc/mm: Fix hugetlb_free_pmd_range() and hugetlb_free_pud_range()
powerpc: force inlining of csum_partial() to avoid multiple csum_partial() with GCC10
Christophe Lombard (5):
ocxl: Assign a register set to a Logical Partition
ocxl: Initiate a TLB invalidate command
ocxl: Update the Process Element Entry
ocxl: Add mmu notifier
ocxl: Add new kernel traces
Colin Ian King (1):
powerpc: fix spelling mistake in Kconfig "seleted" -> "selected"
Cédric Le Goater (12):
KVM: PPC: Book3S HV: XIVE: Show detailed configuration in debug output
powerpc/xive: Rename XIVE_IRQ_NO_EOI to show its a flag
powerpc/xive: Introduce XIVE_IPI_HW_IRQ
powerpc/xive: Add a name to the IRQ domain
powerpc/xive: Add a debug_show handler to the XIVE irq_domain
powerpc: Increase NR_IRQS range to support more KVM guests
powerpc/xive: Remove P9 DD1 flag XIVE_IRQ_FLAG_SHIFT_BUG
powerpc/xive: Remove P9 DD1 flag XIVE_IRQ_FLAG_MASK_FW
powerpc/xive: Remove P9 DD1 flag XIVE_IRQ_FLAG_EOI_FW
powerpc/xive: Simplify xive_do_source_eoi()
powerpc/xive: Improve error reporting of OPAL calls
KVM: PPC: Book3S HV: XIVE: Add a comment regarding VP numbering
Daniel Axtens (3):
powerpc/feature-fixups: use a semicolon rather than a comma
selftests/powerpc: update .gitignore
powerpc: add security.config, enforcing lockdown=integrity
David Hildenbrand (8):
powerpc/powernv/memtrace: Don't leak kernel memory to user space
powerpc/powernv/memtrace: Fix crashing the kernel when enabling concurrently
powerpc/mm: factor out creating/removing linear mapping
powerpc/mm: protect linear mapping modifications by a mutex
powerpc/mm: print warning in arch_remove_linear_mapping()
powerpc/book3s64/hash: Drop WARN_ON in hash__remove_section_mapping()
powerpc/mm: remove linear mapping if __add_pages() fails in arch_add_memory()
powernv/memtrace: don't abuse memory hot(un)plug infrastructure for memory allocations
Frederic Barrat (1):
powerpc/pseries: Define PCI bus speed for Gen4 and Gen5
Ganesh Goudar (1):
lkdtm/powerpc: Add SLB multihit test
Gautham R. Shenoy (5):
powerpc/smp: Parse ibm,thread-groups with multiple properties
powerpc/smp: Rename cpu_l1_cache_map as thread_group_l1_cache_map
powerpc/smp: Rename init_thread_group_l1_cache_map() to make it generic
powerpc/smp: Add support detecting thread-groups sharing L2 cache
powerpc/cacheinfo: Print correct cache-sibling map/list for L2 cache
Harish (1):
selftests/powerpc: Fix uninitialized variable warning
Jordan Niethe (6):
powerpc/64: Set up a kernel stack for secondaries before cpu_restore()
powerpc/64s: Convert some cpu_setup() and cpu_restore() functions to C
powerpc/64: Fix an EMIT_BUG_ENTRY in head_64.S
powerpc: Allow relative pointers in bug table entries
powerpc/book3s64/kexec: Clear CIABR on kexec
powerpc/powernv/idle: Restore CIABR after idle for Power9
Kaixu Xia (4):
powerpc/powernv/sriov: fix unsigned int win compared to less than zero
powerpc/mm: Fix comparing pointer to 0 warning
KVM: PPC: Book3S: Assign boolean values to a bool variable
KVM: PPC: fix comparison to bool warning
Laurent Dufour (1):
powerpc/pseries/memhotplug: Quieten some DLPAR operations
Leonardo Bras (1):
KVM: PPC: Book3S HV: Fix mask size for emulated msgsndp
Madhavan Srinivasan (2):
powerpc/perf: Use regs->nip when SIAR is zero
powerpc/perf: Fix Threshold Event Counter Multiplier width for P10
Mathieu Desnoyers (1):
powerpc: Fix incorrect stw{, ux, u, x} instructions in __set_pte_at
Michael Ellerman (12):
powerpc/85xx: Fix declaration made after definition
powerpc/ps3: Drop unused DBG macro
Merge branch 'fixes' into next
powerpc: Make NUMA depend on SMP
powerpc: Make NUMA default y for powernv
powerpc: Update NUMA Kconfig description & help text
powerpc/time: Fix mftb()/get_tb() for use with the compat VDSO
powerpc/barrier: Use CONFIG_PPC64 for barrier selection
powerpc: Inline setup_kup()
powerpc/configs: Add ppc64le_allnoconfig target
powerpc: Add config fragment for disabling -Werror
powerpc/32s: Fix cleanup_cpu_mmu_context() compile bug
Nathan Lynch (28):
powerpc/rtas: prevent suspend-related sys_rtas use on LE
powerpc/rtas: complete ibm,suspend-me status codes
powerpc/rtas: rtas_ibm_suspend_me -> rtas_ibm_suspend_me_unsafe
powerpc/rtas: add rtas_ibm_suspend_me()
powerpc/rtas: add rtas_activate_firmware()
powerpc/hvcall: add token and codes for H_VASI_SIGNAL
powerpc/pseries/mobility: don't error on absence of ibm, update-nodes
powerpc/pseries/mobility: add missing break to default case
powerpc/pseries/mobility: error message improvements
powerpc/pseries/mobility: use rtas_activate_firmware() on resume
powerpc/pseries/mobility: extract VASI session polling logic
powerpc/pseries/mobility: use stop_machine for join/suspend
powerpc/pseries/mobility: signal suspend cancellation to platform
powerpc/pseries/mobility: retry partition suspend after error
powerpc/rtas: dispatch partition migration requests to pseries
powerpc/rtas: remove rtas_ibm_suspend_me_unsafe()
powerpc/pseries/hibernation: drop pseries_suspend_begin() from suspend ops
powerpc/pseries/hibernation: pass stream id via function arguments
powerpc/pseries/hibernation: remove pseries_suspend_cpu()
powerpc/machdep: remove suspend_disable_cpu()
powerpc/rtas: remove rtas_suspend_cpu()
powerpc/pseries/hibernation: switch to rtas_ibm_suspend_me()
powerpc/rtas: remove unused rtas_suspend_last_cpu()
powerpc/pseries/hibernation: remove redundant cacheinfo update
powerpc/pseries/hibernation: perform post-suspend fixups later
powerpc/pseries/hibernation: remove prepare_late() callback
powerpc/rtas: remove unused rtas_suspend_me_data
powerpc/pseries/mobility: refactor node lookup during DT update
Nicholas Piggin (13):
powerpc/64s/perf: perf interrupt does not have to get_user_pages to access user memory
powerpc: show registers when unwinding interrupt frames
powerpc/64s/powernv: Allow KVM to handle guest machine check details
KVM: PPC: Book3S HV: Don't attempt to recover machine checks for FWNMI enabled guests
KVM: PPC: Book3S HV: Ratelimit machine check messages coming from guests
powerpc/64s/powernv: Ratelimit harmless HMI error printing
powerpc/64s/pseries: Add ERAT specific machine check handler
powerpc/64s: Remove "Host" from MCE logging
powerpc/64s: Tidy machine check SLB logging
powerpc/64s/iommu: Don't use atomic_ function on atomic64_t type
powerpc/64s: Remove MSR[ISF] bit
powerpc/64: irq replay remove decrementer overflow check
powerpc/64s: Remove idle workaround code from restore_cpu_cpufeatures
Oleg Nesterov (2):
powerpc/ptrace: Simplify gpr_get()/tm_cgpr_get()
powerpc/ptrace: Hard wire PT_SOFTE value to 1 in gpr_get() too
Oliver O'Halloran (2):
powerpc/pci: Remove LSI mappings on device teardown
powernv/pci: Print an error when device enable is blocked
Po-Hsu Lin (1):
selftests/powerpc/eeh: disable kselftest timeout setting for eeh-basic
Qinglang Miao (1):
powerpc: sysdev: add missing iounmap() on error in mpic_msgr_probe()
Ravi Bangoria (3):
powerpc/xmon: Fix build failure for 8xx
powerpc/sstep: Cover new VSX instructions under CONFIG_VSX
powerpc/watchpoint: Workaround P10 DD1 issue with VSX-32 byte instructions
Srikar Dronamraju (4):
powerpc: Refactor is_kvm_guest() declaration to new header
powerpc: Rename is_kvm_guest() to check_kvm_guest()
powerpc: Reintroduce is_kvm_guest() as a fast-path check
powerpc/paravirt: Use is_kvm_guest() in vcpu_is_preempted()
Tyrel Datwyler (1):
powerpc/rtas: Fix typo of ibm,open-errinjct in RTAS filter
Uwe Kleine-König (2):
ALSA: ppc: drop if block with always false condition
powerpc/ps3: make system bus's remove and shutdown callbacks return void
Vincent Stehlé (1):
powerpc/ps3: use dma_mapping_error()
Youling Tang (2):
powerpc: Use the common INIT_DATA_SECTION macro in vmlinux.lds.S
powerpc: Use common STABS_DEBUG and DWARF_DEBUG and ELF_DETAILS macro
Zhang Xiaoxu (1):
Revert "powerpc/pseries/hotplug-cpu: Remove double free in error path"
arch/powerpc/Kconfig | 26 +-
arch/powerpc/Makefile | 29 +-
arch/powerpc/boot/Makefile | 4 +
arch/powerpc/boot/ps3.c | 7 -
arch/powerpc/boot/util.S | 9 +-
arch/powerpc/boot/wrapper | 6 +-
arch/powerpc/boot/zImage.lds.S | 21 +-
arch/powerpc/configs/disable-werror.config | 1 +
arch/powerpc/configs/ppc64le.config | 2 +
arch/powerpc/configs/security.config | 15 +
arch/powerpc/include/asm/atomic.h | 9 +-
arch/powerpc/include/asm/barrier.h | 2 +-
arch/powerpc/include/asm/bitops.h | 23 +-
arch/powerpc/include/asm/book3s/32/kup.h | 6 +-
arch/powerpc/include/asm/book3s/32/mmu-hash.h | 3 +-
arch/powerpc/include/asm/book3s/32/pgtable.h | 21 +-
arch/powerpc/include/asm/book3s/32/tlbflush.h | 69 +-
arch/powerpc/include/asm/book3s/64/hash-pkey.h | 25 +-
arch/powerpc/include/asm/book3s/64/hash.h | 2 +-
arch/powerpc/include/asm/book3s/64/kexec.h | 5 +
arch/powerpc/include/asm/book3s/64/kup-radix.h | 205 ------
arch/powerpc/include/asm/book3s/64/kup.h | 442 +++++++++++++
arch/powerpc/include/asm/book3s/64/mmu-hash.h | 29 +-
arch/powerpc/include/asm/book3s/64/mmu.h | 4 +-
arch/powerpc/include/asm/book3s/64/pgtable.h | 17 +-
arch/powerpc/include/asm/book3s/64/pkeys.h | 2 +
arch/powerpc/include/asm/bug.h | 9 +-
arch/powerpc/include/asm/checksum.h | 2 +-
arch/powerpc/include/asm/clocksource.h | 7 +
arch/powerpc/include/asm/cpm1.h | 1 +
arch/powerpc/include/asm/cpu_setup_power.h | 12 +
arch/powerpc/include/asm/cputable.h | 76 +--
arch/powerpc/include/asm/elf.h | 4 +-
arch/powerpc/include/asm/feature-fixups.h | 25 +-
arch/powerpc/include/asm/firmware.h | 6 -
arch/powerpc/include/asm/hvcall.h | 9 +
arch/powerpc/include/asm/io.h | 158 ++++-
arch/powerpc/include/asm/kup.h | 15 +-
arch/powerpc/include/asm/kvm_guest.h | 25 +
arch/powerpc/include/asm/kvm_para.h | 2 +-
arch/powerpc/include/asm/machdep.h | 1 -
arch/powerpc/include/asm/mce.h | 1 +
arch/powerpc/include/asm/mm-arch-hooks.h | 25 -
arch/powerpc/include/asm/mmu.h | 71 +-
arch/powerpc/include/asm/mmu_context.h | 8 +-
arch/powerpc/include/asm/nohash/32/kup-8xx.h | 3 +-
arch/powerpc/include/asm/nohash/32/mmu-40x.h | 2 +-
arch/powerpc/include/asm/nohash/32/mmu-44x.h | 2 +-
arch/powerpc/include/asm/nohash/32/mmu-8xx.h | 2 +-
arch/powerpc/include/asm/nohash/mmu-book3e.h | 2 +-
arch/powerpc/include/asm/nohash/pgtable.h | 4 +-
arch/powerpc/include/asm/nohash/tlbflush.h | 1 -
arch/powerpc/include/asm/opal-api.h | 6 +-
arch/powerpc/include/asm/page_32.h | 6 -
arch/powerpc/include/asm/paravirt.h | 18 +
arch/powerpc/include/asm/perf_event_server.h | 1 +
arch/powerpc/include/asm/pnv-ocxl.h | 54 ++
arch/powerpc/include/asm/ppc-opcode.h | 16 +-
arch/powerpc/include/asm/ppc_asm.h | 8 +-
arch/powerpc/include/asm/processor.h | 33 +-
arch/powerpc/include/asm/ps3.h | 4 +-
arch/powerpc/include/asm/ptrace.h | 18 +-
arch/powerpc/include/asm/reg.h | 44 +-
arch/powerpc/include/asm/reg_booke.h | 12 -
arch/powerpc/include/asm/rtas-types.h | 8 -
arch/powerpc/include/asm/rtas.h | 17 +-
arch/powerpc/include/asm/smp.h | 6 +
arch/powerpc/include/asm/thread_info.h | 2 -
arch/powerpc/include/asm/time.h | 33 +-
arch/powerpc/include/asm/timex.h | 2 +-
arch/powerpc/include/asm/tlb.h | 3 -
arch/powerpc/include/asm/vdso.h | 29 +-
arch/powerpc/include/asm/vdso/clocksource.h | 7 +
arch/powerpc/include/asm/vdso/gettimeofday.h | 201 ++++++
arch/powerpc/include/asm/vdso/processor.h | 23 +
arch/powerpc/include/asm/vdso/timebase.h | 79 +++
arch/powerpc/include/asm/vdso/vsyscall.h | 25 +
arch/powerpc/include/asm/vdso_datapage.h | 57 +-
arch/powerpc/include/asm/xive.h | 8 +-
arch/powerpc/kernel/Makefile | 3 +
arch/powerpc/kernel/asm-offsets.c | 58 +-
arch/powerpc/kernel/cacheinfo.c | 30 +-
arch/powerpc/kernel/cpu_setup_fsl_booke.S | 9 -
arch/powerpc/kernel/cpu_setup_power.S | 252 -------
arch/powerpc/kernel/cpu_setup_power.c | 272 ++++++++
arch/powerpc/kernel/cputable.c | 175 ++---
arch/powerpc/kernel/dt_cpu_ftrs.c | 31 +-
arch/powerpc/kernel/entry_32.S | 49 +-
arch/powerpc/kernel/entry_64.S | 8 +-
arch/powerpc/kernel/exceptions-64e.S | 2 +-
arch/powerpc/kernel/exceptions-64s.S | 6 +-
arch/powerpc/kernel/firmware.c | 11 +-
arch/powerpc/kernel/head_32.h | 37 +-
arch/powerpc/kernel/head_64.S | 22 +-
arch/powerpc/kernel/head_8xx.S | 59 +-
arch/powerpc/kernel/head_book3s_32.S | 96 +--
arch/powerpc/kernel/head_booke.h | 5 +-
arch/powerpc/kernel/head_fsl_booke.S | 57 +-
arch/powerpc/kernel/hw_breakpoint.c | 67 +-
arch/powerpc/kernel/iomap.c | 166 -----
arch/powerpc/kernel/irq.c | 53 +-
arch/powerpc/kernel/mce.c | 4 +-
arch/powerpc/kernel/mce_power.c | 98 +--
arch/powerpc/kernel/paca.c | 4 +-
arch/powerpc/kernel/pci-common.c | 82 ++-
arch/powerpc/kernel/process.c | 108 +--
arch/powerpc/kernel/prom.c | 1 -
arch/powerpc/kernel/ptrace/Makefile | 3 +-
arch/powerpc/kernel/ptrace/ptrace-decl.h | 21 +
arch/powerpc/kernel/ptrace/ptrace-fpu.c | 40 ++
arch/powerpc/kernel/ptrace/ptrace-tm.c | 19 +-
arch/powerpc/kernel/ptrace/ptrace-view.c | 26 +-
arch/powerpc/kernel/ptrace/ptrace.c | 54 +-
arch/powerpc/kernel/ptrace/ptrace32.c | 2 +
arch/powerpc/kernel/rtas.c | 245 +++----
arch/powerpc/kernel/setup-common.c | 8 +-
arch/powerpc/kernel/setup.h | 6 -
arch/powerpc/kernel/setup_32.c | 3 -
arch/powerpc/kernel/setup_64.c | 2 +-
arch/powerpc/kernel/signal.c | 59 +-
arch/powerpc/kernel/signal.h | 115 +++-
arch/powerpc/kernel/signal_32.c | 602 +++++++++--------
arch/powerpc/kernel/signal_64.c | 25 +-
arch/powerpc/kernel/smp.c | 241 +++++--
arch/powerpc/kernel/syscall_64.c | 38 +-
arch/powerpc/kernel/time.c | 100 +--
arch/powerpc/kernel/traps.c | 33 +-
arch/powerpc/kernel/vdso.c | 688 +++-----------------
arch/powerpc/kernel/vdso32/Makefile | 53 +-
arch/powerpc/kernel/vdso32/cacheflush.S | 19 +-
arch/powerpc/kernel/vdso32/datapage.S | 7 +-
arch/powerpc/kernel/vdso32/gen_vdso_offsets.sh | 16 +
arch/powerpc/kernel/vdso32/gettimeofday.S | 300 +--------
arch/powerpc/kernel/vdso32/vdso32.lds.S | 68 +-
arch/powerpc/kernel/vdso32/vgettimeofday.c | 34 +
arch/powerpc/kernel/vdso64/Makefile | 48 +-
arch/powerpc/kernel/vdso64/cacheflush.S | 18 +-
arch/powerpc/kernel/vdso64/datapage.S | 7 +-
arch/powerpc/kernel/vdso64/gen_vdso_offsets.sh | 16 +
arch/powerpc/kernel/vdso64/gettimeofday.S | 242 +------
arch/powerpc/kernel/vdso64/vdso64.lds.S | 67 +-
arch/powerpc/kernel/vdso64/vgettimeofday.c | 29 +
arch/powerpc/kernel/vmlinux.lds.S | 19 +-
arch/powerpc/kvm/book3s_emulate.c | 6 +
arch/powerpc/kvm/book3s_hv.c | 33 +-
arch/powerpc/kvm/book3s_hv_builtin.c | 11 +-
arch/powerpc/kvm/book3s_hv_ras.c | 23 +-
arch/powerpc/kvm/book3s_pr.c | 2 +-
arch/powerpc/kvm/book3s_rmhandlers.S | 4 +-
arch/powerpc/kvm/book3s_xics.c | 4 +-
arch/powerpc/kvm/book3s_xive.c | 134 ++--
arch/powerpc/kvm/book3s_xive.h | 13 +
arch/powerpc/kvm/book3s_xive_native.c | 24 +-
arch/powerpc/kvm/book3s_xive_template.c | 5 -
arch/powerpc/kvm/booke.c | 6 +-
arch/powerpc/kvm/powerpc.c | 4 +-
arch/powerpc/lib/feature-fixups.c | 8 +-
arch/powerpc/lib/sstep.c | 160 ++++-
arch/powerpc/lib/test_emulate_step.c | 270 ++++++++
arch/powerpc/mm/book3s32/Makefile | 2 +-
arch/powerpc/mm/book3s32/hash_low.S | 169 +----
arch/powerpc/mm/book3s32/mmu.c | 30 +-
arch/powerpc/mm/book3s32/nohash_low.S | 80 +++
arch/powerpc/mm/book3s32/tlb.c | 89 +--
arch/powerpc/mm/book3s64/Makefile | 2 +-
arch/powerpc/mm/book3s64/hash_4k.c | 2 +-
arch/powerpc/mm/book3s64/hash_64k.c | 4 +-
arch/powerpc/mm/book3s64/hash_hugepage.c | 2 +-
arch/powerpc/mm/book3s64/hash_hugetlbpage.c | 2 +-
arch/powerpc/mm/book3s64/hash_pgtable.c | 2 +-
arch/powerpc/mm/book3s64/hash_utils.c | 12 +-
arch/powerpc/mm/book3s64/iommu_api.c | 2 +-
arch/powerpc/mm/book3s64/pgtable.c | 8 +-
arch/powerpc/mm/book3s64/pkeys.c | 151 +++--
arch/powerpc/mm/book3s64/radix_pgtable.c | 45 +-
arch/powerpc/mm/book3s64/radix_tlb.c | 23 +-
arch/powerpc/mm/book3s64/slb.c | 66 +-
arch/powerpc/mm/fault.c | 79 ++-
arch/powerpc/mm/hugetlbpage.c | 64 +-
arch/powerpc/mm/init-common.c | 10 +-
arch/powerpc/mm/mem.c | 60 +-
arch/powerpc/mm/mmu_decl.h | 6 -
arch/powerpc/mm/nohash/8xx.c | 3 +-
arch/powerpc/mm/nohash/fsl_booke.c | 12 +-
arch/powerpc/mm/nohash/tlb_low.S | 29 +-
arch/powerpc/mm/pgtable_32.c | 6 +-
arch/powerpc/perf/8xx-pmu.c | 16 +-
arch/powerpc/perf/callchain.h | 2 +-
arch/powerpc/perf/callchain_32.c | 8 +-
arch/powerpc/perf/callchain_64.c | 7 +-
arch/powerpc/perf/core-book3s.c | 65 +-
arch/powerpc/perf/isa207-common.c | 38 +-
arch/powerpc/perf/isa207-common.h | 20 +-
arch/powerpc/perf/power10-events-list.h | 9 +
arch/powerpc/perf/power10-pmu.c | 184 +++++-
arch/powerpc/platforms/85xx/corenet_generic.c | 3 +-
arch/powerpc/platforms/8xx/Kconfig | 7 -
arch/powerpc/platforms/8xx/micropatch.c | 11 +
arch/powerpc/platforms/Kconfig.cputype | 57 +-
arch/powerpc/platforms/powermac/sleep.S | 132 ++--
arch/powerpc/platforms/powernv/Kconfig | 8 +-
arch/powerpc/platforms/powernv/idle.c | 3 +
arch/powerpc/platforms/powernv/memtrace.c | 175 +++--
arch/powerpc/platforms/powernv/npu-dma.c | 16 +-
arch/powerpc/platforms/powernv/ocxl.c | 114 ++++
arch/powerpc/platforms/powernv/opal-elog.c | 4 +-
arch/powerpc/platforms/powernv/opal-hmi.c | 29 +-
arch/powerpc/platforms/powernv/opal.c | 2 +-
arch/powerpc/platforms/powernv/pci-ioda.c | 4 +-
arch/powerpc/platforms/powernv/pci-sriov.c | 2 +-
arch/powerpc/platforms/ps3/system-bus.c | 5 +-
arch/powerpc/platforms/pseries/hotplug-cpu.c | 1 +
arch/powerpc/platforms/pseries/hotplug-memory.c | 12 +-
arch/powerpc/platforms/pseries/mobility.c | 358 ++++++++--
arch/powerpc/platforms/pseries/pci.c | 51 +-
arch/powerpc/platforms/pseries/ras.c | 5 +-
arch/powerpc/platforms/pseries/smp.c | 3 +-
arch/powerpc/platforms/pseries/suspend.c | 79 +--
arch/powerpc/sysdev/mpic_msgr.c | 2 +-
arch/powerpc/sysdev/xive/common.c | 207 +++---
arch/powerpc/sysdev/xive/native.c | 46 +-
arch/powerpc/sysdev/xive/spapr.c | 8 +-
arch/powerpc/sysdev/xive/xive-internal.h | 7 +-
arch/powerpc/xmon/nonstdio.c | 2 +-
arch/powerpc/xmon/xmon.c | 6 +-
drivers/block/ps3disk.c | 3 +-
drivers/block/ps3vram.c | 3 +-
drivers/char/ps3flash.c | 3 +-
drivers/misc/lkdtm/Makefile | 1 +
drivers/misc/lkdtm/core.c | 3 +
drivers/misc/lkdtm/lkdtm.h | 3 +
drivers/misc/lkdtm/powerpc.c | 120 ++++
drivers/misc/ocxl/context.c | 4 +-
drivers/misc/ocxl/link.c | 70 +-
drivers/misc/ocxl/ocxl_internal.h | 9 +-
drivers/misc/ocxl/trace.h | 64 ++
drivers/net/ethernet/toshiba/ps3_gelic_net.c | 3 +-
drivers/ps3/ps3-lpm.c | 3 +-
drivers/ps3/ps3-vuart.c | 10 +-
drivers/ps3/ps3stor_lib.c | 2 +-
drivers/scsi/cxlflash/ocxl_hw.c | 6 +-
drivers/scsi/ps3rom.c | 3 +-
drivers/usb/host/ehci-ps3.c | 4 +-
drivers/usb/host/ohci-ps3.c | 4 +-
drivers/video/fbdev/ps3fb.c | 4 +-
include/linux/compat.h | 32 +
include/linux/memory_hotplug.h | 3 +
include/linux/regset.h | 12 +
include/misc/ocxl.h | 2 +-
sound/ppc/snd_ps3.c | 3 +-
tools/testing/selftests/lkdtm/tests.txt | 1 +
tools/testing/selftests/powerpc/eeh/Makefile | 2 +-
tools/testing/selftests/powerpc/eeh/settings | 1 +
tools/testing/selftests/powerpc/mm/bad_accesses.c | 2 +-
tools/testing/selftests/powerpc/nx-gzip/.gitignore | 3 +
tools/testing/selftests/powerpc/security/.gitignore | 1 +
tools/testing/selftests/powerpc/signal/.gitignore | 1 +
tools/testing/selftests/powerpc/syscalls/.gitignore | 1 +
258 files changed, 6011 insertions(+), 4965 deletions(-)
create mode 100644 arch/powerpc/configs/disable-werror.config
create mode 100644 arch/powerpc/configs/ppc64le.config
create mode 100644 arch/powerpc/configs/security.config
delete mode 100644 arch/powerpc/include/asm/book3s/64/kup-radix.h
create mode 100644 arch/powerpc/include/asm/book3s/64/kup.h
create mode 100644 arch/powerpc/include/asm/clocksource.h
create mode 100644 arch/powerpc/include/asm/cpu_setup_power.h
create mode 100644 arch/powerpc/include/asm/kvm_guest.h
delete mode 100644 arch/powerpc/include/asm/mm-arch-hooks.h
create mode 100644 arch/powerpc/include/asm/vdso/clocksource.h
create mode 100644 arch/powerpc/include/asm/vdso/gettimeofday.h
create mode 100644 arch/powerpc/include/asm/vdso/processor.h
create mode 100644 arch/powerpc/include/asm/vdso/timebase.h
create mode 100644 arch/powerpc/include/asm/vdso/vsyscall.h
delete mode 100644 arch/powerpc/kernel/cpu_setup_power.S
create mode 100644 arch/powerpc/kernel/cpu_setup_power.c
create mode 100644 arch/powerpc/kernel/ptrace/ptrace-fpu.c
create mode 100755 arch/powerpc/kernel/vdso32/gen_vdso_offsets.sh
create mode 100644 arch/powerpc/kernel/vdso32/vgettimeofday.c
create mode 100755 arch/powerpc/kernel/vdso64/gen_vdso_offsets.sh
create mode 100644 arch/powerpc/kernel/vdso64/vgettimeofday.c
create mode 100644 arch/powerpc/mm/book3s32/nohash_low.S
create mode 100644 drivers/misc/lkdtm/powerpc.c
create mode 100644 tools/testing/selftests/powerpc/eeh/settings
create mode 100644 tools/testing/selftests/powerpc/nx-gzip/.gitignore
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAl/bW0UACgkQUevqPMjh
pYCkXg//TIbruNsuWQ1NF0Qg/o6r6Rw0meQ04fi1iqNvlg0q5IrAKaR4He75+i2R
foZZTStXZ/GZ1a8XdVjxPUBfgfXmbAtMucu8233EXLGvQ/z4G91OLRL1Rjml/DxD
GAbr+TGV2qZZZUHb+Bnefr1cDXbOgB+EArrb1pE3NFYQWBZCbgd/bq0aIUwpBX8a
ef7R9XtdRp5WowgU3ZX1SlQhY6obXz5Xuqz4K1k5rrl477K7BQCjqnD4jmmU33nI
UK5adRdNk/Fce4CTx/CxsaH197geeF3604j5qOUZdBhMhWeAHXKndigolaYgZNEg
sjlhJ7zSxXBC7vHK5fS6IeTI2dlZBnv63g6STHzj7MhGiaoZ9ETTYzF8Qlzl7Bg2
icx/KOt3bc09NYpqsiGQ1Hr8HbK5Nq+3DufYm1wFvk9ngOrPhCPnPk69wv1e6rlX
R5E7D7WIsNroiNNMsx5mfQIsU2ZScy+GLFK4EBr5I2sJfqiZULijmOnBdPRVaU1Q
p2yrw93ji2De+C5BsYq1YOPK6reDXXJjjye54C/7RyPg5zEmjUP40fLHU98n/ZPY
QDwj6uCQLTfYJ1INRt53FKvefFm6Y+EKB+9G/lC+7w4gne2WTLPRRl0go9jwEqba
4hShAIonoXq0UwcM2fNZRa6JfD0yJwqWjzHRghnMeNaXr6AgATU=
=LHXh
-----END PGP SIGNATURE-----
^ permalink raw reply
* [Bug 210749] sysfs: cannot create duplicate filename '/bus/nvmem/devices/module-vpd'
From: bugzilla-daemon @ 2020-12-17 12:13 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <bug-210749-206035@https.bugzilla.kernel.org/>
https://bugzilla.kernel.org/show_bug.cgi?id=210749
--- Comment #1 from Erhard F. (erhard_f@mailbox.org) ---
Created attachment 294195
--> https://bugzilla.kernel.org/attachment.cgi?id=294195&action=edit
kernel .config (kernel 5.10.1, Talos II)
--
You are receiving this mail because:
You are watching the assignee of the bug.
^ permalink raw reply
* [Bug 210749] New: sysfs: cannot create duplicate filename '/bus/nvmem/devices/module-vpd'
From: bugzilla-daemon @ 2020-12-17 12:12 UTC (permalink / raw)
To: linuxppc-dev
https://bugzilla.kernel.org/show_bug.cgi?id=210749
Bug ID: 210749
Summary: sysfs: cannot create duplicate filename
'/bus/nvmem/devices/module-vpd'
Product: Platform Specific/Hardware
Version: 2.5
Kernel Version: 5.10.1
Hardware: PPC-64
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: PPC-64
Assignee: platform_ppc-64@kernel-bugs.osdl.org
Reporter: erhard_f@mailbox.org
Regression: No
Created attachment 294193
--> https://bugzilla.kernel.org/attachment.cgi?id=294193&action=edit
dmesg (kernel 5.10.1, Talos II)
[...]
sysfs: cannot create duplicate filename '/bus/nvmem/devices/module-vpd'
CPU: 4 PID: 349 Comm: systemd-udevd Not tainted 5.10.1-gentoo-TalosII #1
Call Trace:
[c00000001b93eb70] [c0000000007ea2c8] .dump_stack+0xe4/0x13c (unreliable)
[c00000001b93ec10] [c0000000004d63a8] .sysfs_warn_dup+0x78/0xb0
[c00000001b93eca0] [c0000000004d69ec]
.sysfs_do_create_link_sd.isra.0+0x13c/0x150
[c00000001b93ed40] [c0000000008be3a0] .bus_add_device+0x80/0x190
[c00000001b93edd0] [c0000000008b8f2c] .device_add+0x41c/0x990
[c00000001b93eea0] [c000000000952f28] .nvmem_register+0x1f8/0xae0
[c00000001b93ef90] [c00000000095385c] .devm_nvmem_register+0x4c/0xb0
[c00000001b93f020] [c008000006de8c7c] .at24_probe+0x67c/0x8a0 [at24]
[c00000001b93f2a0] [c00000000091cfa8] .i2c_device_probe+0x158/0x3c0
[c00000001b93f330] [c0000000008bfd04] .really_probe+0x134/0x500
[c00000001b93f3e0] [c0000000008c02f8] .driver_probe_device+0x78/0x110
[c00000001b93f460] [c0000000008c06bc] .device_driver_attach+0xbc/0xf0
[c00000001b93f4f0] [c0000000008c0768] .__driver_attach+0x78/0x140
[c00000001b93f580] [c0000000008bcbac] .bus_for_each_dev+0x9c/0x120
[c00000001b93f630] [c0000000008bf404] .driver_attach+0x24/0x40
[c00000001b93f6a0] [c0000000008be958] .bus_add_driver+0x1c8/0x2a0
[c00000001b93f740] [c0000000008c1158] .driver_register+0x88/0x190
[c00000001b93f7c0] [c00000000091e068] .i2c_register_driver+0x58/0xc0
[c00000001b93f840] [c008000006de8ff4] .at24_init+0x5c/0x70 [at24]
[c00000001b93f8b0] [c00000000001135c] .do_one_initcall+0x7c/0x490
[c00000001b93f9a0] [c0000000001d1fac] .do_init_module+0x6c/0x2e0
[c00000001b93fa30] [c0000000001d50e0] .load_module+0x2c80/0x3450
[c00000001b93fc40] [c0000000001d5b28] .__do_sys_finit_module+0xc8/0x120
[c00000001b93fd70] [c000000000037ab0] .system_call_exception+0x160/0x2b0
[c00000001b93fe20] [c00000000000cbe0] system_call_common+0xf0/0x27c
at24: probe of 1-0050 failed with error -17
at24 2-0050: probe
sysfs: cannot create duplicate filename '/bus/nvmem/devices/module-vpd'
CPU: 4 PID: 349 Comm: systemd-udevd Not tainted 5.10.1-gentoo-TalosII #1
Call Trace:
[c00000001b93eb70] [c0000000007ea2c8] .dump_stack+0xe4/0x13c (unreliable)
[c00000001b93ec10] [c0000000004d63a8] .sysfs_warn_dup+0x78/0xb0
[c00000001b93eca0] [c0000000004d69ec]
.sysfs_do_create_link_sd.isra.0+0x13c/0x150
[c00000001b93ed40] [c0000000008be3a0] .bus_add_device+0x80/0x190
[c00000001b93edd0] [c0000000008b8f2c] .device_add+0x41c/0x990
[c00000001b93eea0] [c000000000952f28] .nvmem_register+0x1f8/0xae0
[c00000001b93ef90] [c00000000095385c] .devm_nvmem_register+0x4c/0xb0
[c00000001b93f020] [c008000006de8c7c] .at24_probe+0x67c/0x8a0 [at24]
[c00000001b93f2a0] [c00000000091cfa8] .i2c_device_probe+0x158/0x3c0
[c00000001b93f330] [c0000000008bfd04] .really_probe+0x134/0x500
[c00000001b93f3e0] [c0000000008c02f8] .driver_probe_device+0x78/0x110
[c00000001b93f460] [c0000000008c06bc] .device_driver_attach+0xbc/0xf0
[c00000001b93f4f0] [c0000000008c0768] .__driver_attach+0x78/0x140
[c00000001b93f580] [c0000000008bcbac] .bus_for_each_dev+0x9c/0x120
[c00000001b93f630] [c0000000008bf404] .driver_attach+0x24/0x40
[c00000001b93f6a0] [c0000000008be958] .bus_add_driver+0x1c8/0x2a0
[c00000001b93f740] [c0000000008c1158] .driver_register+0x88/0x190
[c00000001b93f7c0] [c00000000091e068] .i2c_register_driver+0x58/0xc0
[c00000001b93f840] [c008000006de8ff4] .at24_init+0x5c/0x70 [at24]
[c00000001b93f8b0] [c00000000001135c] .do_one_initcall+0x7c/0x490
[c00000001b93f9a0] [c0000000001d1fac] .do_init_module+0x6c/0x2e0
[c00000001b93fa30] [c0000000001d50e0] .load_module+0x2c80/0x3450
[c00000001b93fc40] [c0000000001d5b28] .__do_sys_finit_module+0xc8/0x120
[c00000001b93fd70] [c000000000037ab0] .system_call_exception+0x160/0x2b0
[c00000001b93fe20] [c00000000000cbe0] system_call_common+0xf0/0x27c
at24: probe of 2-0050 failed with error -17
at24 3-0050: probe
[...]
# inxi -b --no-host
System: Kernel: 5.10.1-gentoo-TalosII ppc64 bits: 64 Console: tty 1
Distro: Gentoo Base System release 2.7
Machine: Type: PowerPC Device System: T2P9D01 REV 1.01 details: PowerNV
T2P9D01 REV 1.01
rev: 2.2 (pvr 004e 1202)
CPU: Info: 32-Core POWER9 altivec supported [MCP] speed: 2170 MHz
min/max: 2154/3800 MHz
Graphics: Device-1: AMD Turks XT [Radeon HD 6670/7670] driver: radeon v:
kernel
Device-2: ASPEED Graphics Family driver: N/A
Display: server: X.org 1.20.10 driver: ati,radeon unloaded:
fbdev,modesetting tty: 104x53
Message: Advanced graphics data unavailable in console for root.
Network: Device-1: Broadcom and subsidiaries NetXtreme BCM5719 Gigabit
Ethernet PCIe driver: tg3
Device-2: Broadcom and subsidiaries NetXtreme BCM5719 Gigabit
Ethernet PCIe driver: tg3
Drives: Local Storage: total: 447.13 GiB used: 16.64 GiB (3.7%)
Info: Processes: 445 Uptime: 11m Memory: 62.75 GiB used: 1.89 GiB (3.0%)
Init: systemd
runlevel: 5 Shell: Bash inxi: 3.1.06
--
You are receiving this mail because:
You are watching the assignee of the bug.
^ permalink raw reply
* Re: [PATCH v2 01/17] ibmvfc: add vhost fields and defaults for MQ enablement
From: John Garry @ 2020-12-17 11:49 UTC (permalink / raw)
To: Tyrel Datwyler, Hannes Reinecke, Brian King, james.bottomley
Cc: brking, linuxppc-dev, linux-scsi, martin.petersen, linux-kernel
In-Reply-To: <f226e3f9-60e9-b96a-ecc3-2e4008e08bac@linux.ibm.com>
On 08/12/2020 22:37, Tyrel Datwyler wrote:
> On 12/7/20 3:56 AM, Hannes Reinecke wrote:
>> On 12/4/20 3:26 PM, Brian King wrote:
>>> On 12/2/20 11:27 AM, Tyrel Datwyler wrote:
>>>> On 12/2/20 7:14 AM, Brian King wrote:
>>>>> On 12/1/20 6:53 PM, Tyrel Datwyler wrote:
>>>>>> Introduce several new vhost fields for managing MQ state of the adapter
>>>>>> as well as initial defaults for MQ enablement.
>>>>>>
>>>>>> Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
>>>>>> ---
>>>>>> drivers/scsi/ibmvscsi/ibmvfc.c | 9 ++++++++-
>>>>>> drivers/scsi/ibmvscsi/ibmvfc.h | 13 +++++++++++--
>>>>>> 2 files changed, 19 insertions(+), 3 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
>>>>>> index 42e4d35e0d35..f1d677a7423d 100644
>>>>>> --- a/drivers/scsi/ibmvscsi/ibmvfc.c
>>>>>> +++ b/drivers/scsi/ibmvscsi/ibmvfc.c
>>>>>> @@ -5161,12 +5161,13 @@ static int ibmvfc_probe(struct vio_dev *vdev, const
>>>>>> struct vio_device_id *id)
>>>>>> }
>>>>>> shost->transportt = ibmvfc_transport_template;
>>>>>> - shost->can_queue = max_requests;
>>>>>> + shost->can_queue = (max_requests / IBMVFC_SCSI_HW_QUEUES);
>>>>>
>>>>> This doesn't look right. can_queue is the SCSI host queue depth, not the MQ
>>>>> queue depth.
>>>>
>>>> Our max_requests is the total number commands allowed across all queues. From
>>>> what I understand is can_queue is the total number of commands in flight allowed
>>>> for each hw queue.
>>>>
>>>> /*
>>>> * In scsi-mq mode, the number of hardware queues supported by the LLD.
>>>> *
>>>> * Note: it is assumed that each hardware queue has a queue depth of
>>>> * can_queue. In other words, the total queue depth per host
>>>> * is nr_hw_queues * can_queue. However, for when host_tagset is set,
>>>> * the total queue depth is can_queue.
>>>> */
>>>>
>>>> We currently don't use the host wide shared tagset.
>>>
>>> Ok. I missed that bit... In that case, since we allocate by default only 100
>>> event structs. If we slice that across IBMVFC_SCSI_HW_QUEUES (16) queues, then
>>> we end up with only about 6 commands that can be outstanding per queue,
>>> which is going to really hurt performance... I'd suggest bumping up
>>> IBMVFC_MAX_REQUESTS_DEFAULT from 100 to 1000 as a starting point.
>>>
>> Before doing that I'd rather use the host-wide shared tagset.
>> Increasing the number of requests will increase the memory footprint of the
>> driver (as each request will be statically allocated).
Exposing HW queues increases memory footprint as we allocate the static
requests per HW queue ctx, regardless of shared hostwide tagset enabled
or not. This could prob be improved.
>>
>
> In the case where we use host-wide how do I determine the queue depth per
> hardware queue? Is is hypothetically can_queue or is it (can_queue /
> nr_hw_queues)? We want to allocate an event pool per-queue which made sense
> without host-wide tags since the queue depth per hw queue is exactly can_queue.
>
Generally hw queue depth should be same as can_queue. And this applies
when hostwide shared tags is enabled as well.
We do this for hisi_sas: the host can queue max 4096 commands over all
queues, so we set .can_queue = 4096*, set HW queue depth = 4096, and set
.host_tagset = 1.
* we need to reserve some commands for internal IO, so this is reduced a
little
Thanks,
John
^ permalink raw reply
* Re: [PATCH] powerpc/perf/hv-24x7: Dont create sysfs event files for dummy events
From: kajoljain @ 2020-12-17 11:51 UTC (permalink / raw)
To: Madhavan Srinivasan, mpe, linuxppc-dev; +Cc: suka, maddy, atrajeev
In-Reply-To: <d61d619b-3557-f4ff-a363-3a8f12b3a9ed@linux.ibm.com>
On 12/17/20 5:10 PM, Madhavan Srinivasan wrote:
>
> On 12/17/20 5:02 PM, Kajol Jain wrote:
>> hv_24x7 performance monitoring unit creates list of supported events
>> from the event catalog obtained via HCALL. hv_24x7 catalog could also
>> contain invalid or dummy events (with names like FREE_ or CPM_FREE_ so
>
>
> Can you also include " RESERVED_NEST*" as part of the check.
Hi Maddy,
Sure, I will add this check.
Thanks,
Kajol Jain
>
> # ls /sys/devices/hv_24x7/events | grep RESERVED
> RESERVED_NEST1
> RESERVED_NEST10
> RESERVED_NEST11
> RESERVED_NEST12
> ...
>
>
> Maddy
>
>
>> on). These events does not have any hardware counters backing them.
>> So patch adds a check to string compare the event names to filter
>> out them.
>>
>> Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
>> ---
>> arch/powerpc/perf/hv-24x7.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
>> index 6e7e820508df..c3252d8a7818 100644
>> --- a/arch/powerpc/perf/hv-24x7.c
>> +++ b/arch/powerpc/perf/hv-24x7.c
>> @@ -894,6 +894,11 @@ static int create_events_from_catalog(struct attribute ***events_,
>>
>> name = event_name(event, &nl);
>>
>> + if (strstr(name, "FREE_")) {
>> + pr_info("invalid event %zu (%.*s)\n", event_idx, nl, name);
>> + junk_events++;
>> + continue;
>> + }
>> if (event->event_group_record_len == 0) {
>> pr_devel("invalid event %zu (%.*s): group_record_len == 0, skipping\n",
>> event_idx, nl, name);
>> @@ -955,6 +960,9 @@ static int create_events_from_catalog(struct attribute ***events_,
>> continue;
>>
>> name = event_name(event, &nl);
>> + if (strstr(name, "FREE_"))
>> + continue;
>> +
>> nonce = event_uniq_add(&ev_uniq, name, nl, event->domain);
>> ct = event_data_to_attrs(event_idx, events + event_attr_ct,
>> event, nonce);
^ permalink raw reply
* Re: [PATCH] powerpc/perf/hv-24x7: Dont create sysfs event files for dummy events
From: Madhavan Srinivasan @ 2020-12-17 11:40 UTC (permalink / raw)
To: Kajol Jain, mpe, linuxppc-dev; +Cc: suka, maddy, atrajeev
In-Reply-To: <20201217113230.1069882-1-kjain@linux.ibm.com>
On 12/17/20 5:02 PM, Kajol Jain wrote:
> hv_24x7 performance monitoring unit creates list of supported events
> from the event catalog obtained via HCALL. hv_24x7 catalog could also
> contain invalid or dummy events (with names like FREE_ or CPM_FREE_ so
Can you also include " RESERVED_NEST*" as part of the check.
# ls /sys/devices/hv_24x7/events | grep RESERVED
RESERVED_NEST1
RESERVED_NEST10
RESERVED_NEST11
RESERVED_NEST12
...
Maddy
> on). These events does not have any hardware counters backing them.
> So patch adds a check to string compare the event names to filter
> out them.
>
> Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
> ---
> arch/powerpc/perf/hv-24x7.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
> index 6e7e820508df..c3252d8a7818 100644
> --- a/arch/powerpc/perf/hv-24x7.c
> +++ b/arch/powerpc/perf/hv-24x7.c
> @@ -894,6 +894,11 @@ static int create_events_from_catalog(struct attribute ***events_,
>
> name = event_name(event, &nl);
>
> + if (strstr(name, "FREE_")) {
> + pr_info("invalid event %zu (%.*s)\n", event_idx, nl, name);
> + junk_events++;
> + continue;
> + }
> if (event->event_group_record_len == 0) {
> pr_devel("invalid event %zu (%.*s): group_record_len == 0, skipping\n",
> event_idx, nl, name);
> @@ -955,6 +960,9 @@ static int create_events_from_catalog(struct attribute ***events_,
> continue;
>
> name = event_name(event, &nl);
> + if (strstr(name, "FREE_"))
> + continue;
> +
> nonce = event_uniq_add(&ev_uniq, name, nl, event->domain);
> ct = event_data_to_attrs(event_idx, events + event_attr_ct,
> event, nonce);
^ permalink raw reply
* [PATCH] powerpc/perf/hv-24x7: Dont create sysfs event files for dummy events
From: Kajol Jain @ 2020-12-17 11:32 UTC (permalink / raw)
To: mpe, linuxppc-dev; +Cc: kjain, suka, maddy, atrajeev
hv_24x7 performance monitoring unit creates list of supported events
from the event catalog obtained via HCALL. hv_24x7 catalog could also
contain invalid or dummy events (with names like FREE_ or CPM_FREE_ so
on). These events does not have any hardware counters backing them.
So patch adds a check to string compare the event names to filter
out them.
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
arch/powerpc/perf/hv-24x7.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index 6e7e820508df..c3252d8a7818 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -894,6 +894,11 @@ static int create_events_from_catalog(struct attribute ***events_,
name = event_name(event, &nl);
+ if (strstr(name, "FREE_")) {
+ pr_info("invalid event %zu (%.*s)\n", event_idx, nl, name);
+ junk_events++;
+ continue;
+ }
if (event->event_group_record_len == 0) {
pr_devel("invalid event %zu (%.*s): group_record_len == 0, skipping\n",
event_idx, nl, name);
@@ -955,6 +960,9 @@ static int create_events_from_catalog(struct attribute ***events_,
continue;
name = event_name(event, &nl);
+ if (strstr(name, "FREE_"))
+ continue;
+
nonce = event_uniq_add(&ev_uniq, name, nl, event->domain);
ct = event_data_to_attrs(event_idx, events + event_attr_ct,
event, nonce);
--
2.26.2
^ permalink raw reply related
* Re: [RFC PATCH v1 7/7] powerpc/bpf: Implement extended BPF on PPC32
From: Christophe Leroy @ 2020-12-17 9:54 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: songliubraving, daniel, john.fastabend, andrii, ast, naveen.n.rao,
netdev, Paul Mackerras, sandipan, kpsingh, yhs, bpf, linuxppc-dev,
kafai, linux-kernel
In-Reply-To: <20201217061133.lnfnhbzvikgtjb3i@ast-mbp>
Le 17/12/2020 à 07:11, Alexei Starovoitov a écrit :
> On Wed, Dec 16, 2020 at 10:07:37AM +0000, Christophe Leroy wrote:
>> Implement Extended Berkeley Packet Filter on Powerpc 32
>>
>> Test result with test_bpf module:
>>
>> test_bpf: Summary: 378 PASSED, 0 FAILED, [354/366 JIT'ed]
>
> nice!
>
>> Registers mapping:
>>
>> [BPF_REG_0] = r11-r12
>> /* function arguments */
>> [BPF_REG_1] = r3-r4
>> [BPF_REG_2] = r5-r6
>> [BPF_REG_3] = r7-r8
>> [BPF_REG_4] = r9-r10
>> [BPF_REG_5] = r21-r22 (Args 9 and 10 come in via the stack)
>> /* non volatile registers */
>> [BPF_REG_6] = r23-r24
>> [BPF_REG_7] = r25-r26
>> [BPF_REG_8] = r27-r28
>> [BPF_REG_9] = r29-r30
>> /* frame pointer aka BPF_REG_10 */
>> [BPF_REG_FP] = r31
>> /* eBPF jit internal registers */
>> [BPF_REG_AX] = r19-r20
>> [TMP_REG] = r18
>>
>> As PPC32 doesn't have a redzone in the stack,
>> use r17 as tail call counter.
>>
>> r0 is used as temporary register as much as possible. It is referenced
>> directly in the code in order to avoid misuse of it, because some
>> instructions interpret it as value 0 instead of register r0
>> (ex: addi, addis, stw, lwz, ...)
>>
>> The following operations are not implemented:
>>
>> case BPF_ALU64 | BPF_DIV | BPF_X: /* dst /= src */
>> case BPF_ALU64 | BPF_MOD | BPF_X: /* dst %= src */
>> case BPF_STX | BPF_XADD | BPF_DW: /* *(u64 *)(dst + off) += src */
>>
>> The following operations are only implemented for power of two constants:
>>
>> case BPF_ALU64 | BPF_MOD | BPF_K: /* dst %= imm */
>> case BPF_ALU64 | BPF_DIV | BPF_K: /* dst /= imm */
>
> Those are sensible limitations. MOD and DIV are rare, but XADD is common.
> Please consider doing it as a cmpxchg loop in the future.
>
> Also please run test_progs. It will give a lot better coverage than test_bpf.ko
>
I'm having hard time cross building test_progs:
~/linux-powerpc/tools/testing/selftests/bpf/$ make CROSS_COMPILE=ppc-linux-
...
GEN
/home/chr/linux-powerpc/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpf-helpers.7
INSTALL eBPF_helpers-manpage
INSTALL Documentation-man
GEN vmlinux.h
/bin/sh: /home/chr/linux-powerpc/tools/testing/selftests/bpf/tools/sbin/bpftool: cannot execute
binary file
make: *** [/home/chr/linux-powerpc/tools/testing/selftests/bpf/tools/include/vmlinux.h] Error 126
make: *** Deleting file `/home/chr/linux-powerpc/tools/testing/selftests/bpf/tools/include/vmlinux.h'
Looks like it builds bpftool for powerpc and tries to run it on my x86.
How should I proceed ?
Thanks
Christophe
^ permalink raw reply
* Re: powerpc VDSO files being unnecessarily rebuilt
From: Masahiro Yamada @ 2020-12-17 9:23 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, Linux Kbuild mailing list
In-Reply-To: <87tuslxhry.fsf@mpe.ellerman.id.au>
On Thu, Dec 17, 2020 at 11:56 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> Hi all,
>
> Since the merge of the C VDSO I see we are repeatedly rebuilding some
> files in the VDSO, eg:
>
> $ make V=2
> make[1]: Entering directory '/home/michael/linux/build~'
> GEN Makefile
> CALL /home/michael/linux/scripts/checksyscalls.sh - due to target missing
> CALL /home/michael/linux/scripts/atomic/check-atomics.sh - due to target missing
> CHK include/generated/compile.h
> CC arch/powerpc/kernel/vdso64/vgettimeofday.o - due to vgettimeofday.o not in $(targets)
>
> This then causes multiple other files to be rebuilt.
>
> So the obvious fix is to add it to targets:
>
> diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
> index d365810a689a..5386532866ce 100644
> --- a/arch/powerpc/kernel/vdso64/Makefile
> +++ b/arch/powerpc/kernel/vdso64/Makefile
> @@ -5,6 +5,7 @@ ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_
> include $(srctree)/lib/vdso/Makefile
>
> obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o
> +targets := $(obj-vdso64) vdso64.so.dbg
>
> ifneq ($(c-gettimeofday-y),)
> CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
> @@ -13,11 +14,11 @@ ifneq ($(c-gettimeofday-y),)
> CFLAGS_vgettimeofday.o += -DDISABLE_BRANCH_PROFILING
> CFLAGS_vgettimeofday.o += -ffreestanding -fasynchronous-unwind-tables
> CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE)
> + targets += vgettimeofday.o
> endif
>
> # Build rules
>
> -targets := $(obj-vdso64) vdso64.so.dbg
> obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
>
> GCOV_PROFILE := n
>
>
> But then I see it still rebuilt:
>
> CC arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
>
>
> I'm not changing the command line, and AFAICS the .cmd file is not
> changing either:
>
> $ make V=2
> ...
> CC arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
>
> $ sha256sum build\~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> 7f635546bc2768c7b929d3de1724d83285f3cd54394fcd7104f8b1301d689d65 build~/arch/powerpc/kernel/vdso64/vgettimeofday.o
>
> $ make V=2
> ...
> CC arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
>
> $ sha256sum build\~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> 7f635546bc2768c7b929d3de1724d83285f3cd54394fcd7104f8b1301d689d65 build~/arch/powerpc/kernel/vdso64/vgettimeofday.o
>
>
> So any hints on what I'm missing here?
>
> cheers
This is because PPC builds the vdso twice
with different command arguments.
First time:
vdso_prepare: prepare0
$(if $(CONFIG_VDSO32),$(Q)$(MAKE) \
$(build)=arch/powerpc/kernel/vdso32
include/generated/vdso32-offsets.h)
$(if $(CONFIG_PPC64),$(Q)$(MAKE) \
$(build)=arch/powerpc/kernel/vdso64
include/generated/vdso64-offsets.h)
Second time:
from arch/powerpc/kernel/Makefile
For the first build, -Werror is missing because
Kbuild directly descends into arch/powerpc/kernel/vdso[32,64]/.
For the second build,
arch/powerpc/Kbuild appends the following:
subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
--
Best Regards
Masahiro Yamada
^ permalink raw reply
* Re: [PATCH v2 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE
From: Bharata B Rao @ 2020-12-17 8:48 UTC (permalink / raw)
To: David Gibson; +Cc: aneesh.kumar, npiggin, kvm-ppc, linuxppc-dev
In-Reply-To: <20201217034215.GE310465@yekko.fritz.box>
On Thu, Dec 17, 2020 at 02:42:15PM +1100, David Gibson wrote:
> On Wed, Dec 16, 2020 at 02:24:46PM +0530, Bharata B Rao wrote:
> > +static void do_tlb_invalidate(unsigned long rs, unsigned long target,
> > + unsigned long type, unsigned long page_size,
> > + unsigned long ap, unsigned long start,
> > + unsigned long end)
> > +{
> > + unsigned long rb;
> > + unsigned long addr = start;
> > +
> > + if ((type & H_RPTI_TYPE_ALL) == H_RPTI_TYPE_ALL) {
> > + rb = PPC_BIT(53); /* IS = 1 */
> > + do_tlb_invalidate_all(rb, rs);
> > + return;
> > + }
> > +
> > + if (type & H_RPTI_TYPE_PWC) {
> > + rb = PPC_BIT(53); /* IS = 1 */
> > + do_tlb_invalidate_pwc(rb, rs);
> > + }
> > +
> > + if (!addr && end == -1) { /* PID */
> > + rb = PPC_BIT(53); /* IS = 1 */
> > + do_tlb_invalidate_tlb(rb, rs);
> > + } else { /* EA */
> > + do {
> > + rb = addr & ~(PPC_BITMASK(52, 63));
> > + rb |= ap << PPC_BITLSHIFT(58);
> > + do_tlb_invalidate_tlb(rb, rs);
> > + addr += page_size;
> > + } while (addr < end);
> > + }
> > +}
> > +
> > +static long kvmppc_h_rpt_invalidate(struct kvm_vcpu *vcpu,
> > + unsigned long pid, unsigned long target,
> > + unsigned long type, unsigned long pg_sizes,
> > + unsigned long start, unsigned long end)
> > +{
> > + unsigned long rs, ap, psize;
> > +
> > + if (!kvm_is_radix(vcpu->kvm))
> > + return H_FUNCTION;
>
> IIUC The cover note said this case was H_NOT_SUPPORTED, rather than H_FUNCTION.
>
> > +
> > + if (end < start)
> > + return H_P5;
> > +
> > + if (type & H_RPTI_TYPE_NESTED) {
> > + if (!nesting_enabled(vcpu->kvm))
> > + return H_FUNCTION;
>
> Likewise, I'm not sure that H_FUNCTION is the right choice here.
Yes to both, will switch to H_FUNCTION in the next iteration.
>
> > +
> > + /* Support only cores as target */
> > + if (target != H_RPTI_TARGET_CMMU)
> > + return H_P2;
> > +
> > + return kvmhv_h_rpti_nested(vcpu, pid,
> > + (type & ~H_RPTI_TYPE_NESTED),
> > + pg_sizes, start, end);
> > + }
> > +
> > + rs = pid << PPC_BITLSHIFT(31);
> > + rs |= vcpu->kvm->arch.lpid;
> > +
> > + if (pg_sizes & H_RPTI_PAGE_64K) {
> > + psize = rpti_pgsize_to_psize(pg_sizes & H_RPTI_PAGE_64K);
> > + ap = mmu_get_ap(psize);
> > + do_tlb_invalidate(rs, target, type, (1UL << 16), ap, start,
> > + end);
>
> Should these be conditional on the TLB flag in type?
Didn't quite get you. Do you mean that depending on the type flag
we may not need to do invalidations for different page sizes
separately?
Regards,
Bharata.
^ permalink raw reply
* Re: [PATCH v2 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE
From: Bharata B Rao @ 2020-12-17 8:41 UTC (permalink / raw)
To: Fabiano Rosas; +Cc: aneesh.kumar, npiggin, kvm-ppc, linuxppc-dev, david
In-Reply-To: <87v9d174hq.fsf@linux.ibm.com>
On Wed, Dec 16, 2020 at 07:47:29PM -0300, Fabiano Rosas wrote:
> > +static void do_tlb_invalidate(unsigned long rs, unsigned long target,
> > + unsigned long type, unsigned long page_size,
> > + unsigned long ap, unsigned long start,
> > + unsigned long end)
> > +{
> > + unsigned long rb;
> > + unsigned long addr = start;
> > +
> > + if ((type & H_RPTI_TYPE_ALL) == H_RPTI_TYPE_ALL) {
> > + rb = PPC_BIT(53); /* IS = 1 */
> > + do_tlb_invalidate_all(rb, rs);
> > + return;
> > + }
> > +
> > + if (type & H_RPTI_TYPE_PWC) {
> > + rb = PPC_BIT(53); /* IS = 1 */
> > + do_tlb_invalidate_pwc(rb, rs);
> > + }
> > +
> > + if (!addr && end == -1) { /* PID */
> > + rb = PPC_BIT(53); /* IS = 1 */
> > + do_tlb_invalidate_tlb(rb, rs);
> > + } else { /* EA */
> > + do {
> > + rb = addr & ~(PPC_BITMASK(52, 63));
> > + rb |= ap << PPC_BITLSHIFT(58);
> > + do_tlb_invalidate_tlb(rb, rs);
> > + addr += page_size;
> > + } while (addr < end);
> > + }
> > +}
>
> This is all quite similar to _tlbie_pid in mm/book3s64/radix_tlb.c so:
>
> 1) Shouldn't do_tlb_invalidate be in that file so we could reuse
> __tlbie_pid and __tlbie_va? There are also the tracepoints in that file
> that we might want to reuse.
Will see how much reuse is possible.
>
> 2) For my own understanding, don't the "fixups" in _tlbie_pid apply to
> this scenario as well?
Yes, I think, will add fixups.
> > +long kvmhv_h_rpti_nested(struct kvm_vcpu *vcpu, unsigned long lpid,
> > + unsigned long type, unsigned long pg_sizes,
> > + unsigned long start, unsigned long end)
> > +{
> > + struct kvm_nested_guest *gp;
> > + long ret;
> > + unsigned long psize, ap;
> > +
> > + /*
> > + * If L2 lpid isn't valid, we need to return H_PARAMETER.
> > + * Nested KVM issues a L2 lpid flush call when creating
> > + * partition table entries for L2. This happens even before
> > + * the corresponding shadow lpid is created in HV. Until
> > + * this is fixed, ignore such flush requests.
>
> >From the text, it seems that you are talking about kvmhv_set_ptbl_entry
> in L1 calling kvmhv_flush_lpid, but I'm not sure. Could you clarify that
> scenario a bit?
Yes this is the scenario which I am talking about here.
>
> Maybe it would be good to have a more concrete hint of the issue here or
> in the commit message, since you mentioned this is something that needs
> fixing.
Hmm let me see if I can make the comment more verbose/concrete in the
next version.
Thanks for your review.
Regards,
Bharata.
^ permalink raw reply
* Re: [RFC PATCH v1 7/7] powerpc/bpf: Implement extended BPF on PPC32
From: Alexei Starovoitov @ 2020-12-17 6:11 UTC (permalink / raw)
To: Christophe Leroy
Cc: songliubraving, daniel, john.fastabend, andrii, ast, naveen.n.rao,
netdev, Paul Mackerras, sandipan, kpsingh, yhs, bpf, linuxppc-dev,
kafai, linux-kernel
In-Reply-To: <1fed5e11ba08ee28d12f3f57986e5b143a6aa937.1608112797.git.christophe.leroy@csgroup.eu>
On Wed, Dec 16, 2020 at 10:07:37AM +0000, Christophe Leroy wrote:
> Implement Extended Berkeley Packet Filter on Powerpc 32
>
> Test result with test_bpf module:
>
> test_bpf: Summary: 378 PASSED, 0 FAILED, [354/366 JIT'ed]
nice!
> Registers mapping:
>
> [BPF_REG_0] = r11-r12
> /* function arguments */
> [BPF_REG_1] = r3-r4
> [BPF_REG_2] = r5-r6
> [BPF_REG_3] = r7-r8
> [BPF_REG_4] = r9-r10
> [BPF_REG_5] = r21-r22 (Args 9 and 10 come in via the stack)
> /* non volatile registers */
> [BPF_REG_6] = r23-r24
> [BPF_REG_7] = r25-r26
> [BPF_REG_8] = r27-r28
> [BPF_REG_9] = r29-r30
> /* frame pointer aka BPF_REG_10 */
> [BPF_REG_FP] = r31
> /* eBPF jit internal registers */
> [BPF_REG_AX] = r19-r20
> [TMP_REG] = r18
>
> As PPC32 doesn't have a redzone in the stack,
> use r17 as tail call counter.
>
> r0 is used as temporary register as much as possible. It is referenced
> directly in the code in order to avoid misuse of it, because some
> instructions interpret it as value 0 instead of register r0
> (ex: addi, addis, stw, lwz, ...)
>
> The following operations are not implemented:
>
> case BPF_ALU64 | BPF_DIV | BPF_X: /* dst /= src */
> case BPF_ALU64 | BPF_MOD | BPF_X: /* dst %= src */
> case BPF_STX | BPF_XADD | BPF_DW: /* *(u64 *)(dst + off) += src */
>
> The following operations are only implemented for power of two constants:
>
> case BPF_ALU64 | BPF_MOD | BPF_K: /* dst %= imm */
> case BPF_ALU64 | BPF_DIV | BPF_K: /* dst /= imm */
Those are sensible limitations. MOD and DIV are rare, but XADD is common.
Please consider doing it as a cmpxchg loop in the future.
Also please run test_progs. It will give a lot better coverage than test_bpf.ko
^ permalink raw reply
* Re: [PATCH v2 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE
From: David Gibson @ 2020-12-17 3:42 UTC (permalink / raw)
To: Bharata B Rao; +Cc: aneesh.kumar, npiggin, kvm-ppc, linuxppc-dev
In-Reply-To: <20201216085447.1265433-2-bharata@linux.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 13795 bytes --]
On Wed, Dec 16, 2020 at 02:24:46PM +0530, Bharata B Rao wrote:
> Implement H_RPT_INVALIDATE hcall and add KVM capability
> KVM_CAP_PPC_RPT_INVALIDATE to indicate the support for the same.
>
> This hcall does two types of TLB invalidations:
>
> 1. Process-scoped invalidations for guests with LPCR[GTSE]=0.
> This is currently not used in KVM as GTSE is not usually
> disabled in KVM.
> 2. Partition-scoped invalidations that an L1 hypervisor does on
> behalf of an L2 guest. This replaces the uses of the existing
> hcall H_TLB_INVALIDATE.
>
> Signed-off-by: Bharata B Rao <bharata@linux.ibm.com>
> ---
> Documentation/virt/kvm/api.rst | 17 +++
> .../include/asm/book3s/64/tlbflush-radix.h | 18 +++
> arch/powerpc/include/asm/kvm_book3s.h | 3 +
> arch/powerpc/kvm/book3s_hv.c | 121 ++++++++++++++++++
> arch/powerpc/kvm/book3s_hv_nested.c | 94 ++++++++++++++
> arch/powerpc/kvm/powerpc.c | 3 +
> arch/powerpc/mm/book3s64/radix_tlb.c | 4 -
> include/uapi/linux/kvm.h | 1 +
> 8 files changed, 257 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
> index e00a66d72372..5ce237c0d707 100644
> --- a/Documentation/virt/kvm/api.rst
> +++ b/Documentation/virt/kvm/api.rst
> @@ -6014,6 +6014,23 @@ KVM_EXIT_X86_RDMSR and KVM_EXIT_X86_WRMSR exit notifications which user space
> can then handle to implement model specific MSR handling and/or user notifications
> to inform a user that an MSR was not handled.
>
> +7.22 KVM_CAP_PPC_RPT_INVALIDATE
> +------------------------------
> +
> +:Capability: KVM_CAP_PPC_RPT_INVALIDATE
> +:Architectures: ppc
> +:Type: vm
> +
> +This capability indicates that the kernel is capable of handling
> +H_RPT_INVALIDATE hcall.
> +
> +In order to enable the use of H_RPT_INVALIDATE in the guest,
> +user space might have to advertise it for the guest. For example,
> +IBM pSeries (sPAPR) guest starts using it if "hcall-rpt-invalidate" is
> +present in the "ibm,hypertas-functions" device-tree property.
> +
> +This capability is always enabled.
> +
> 8. Other capabilities.
> ======================
>
> diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> index 94439e0cefc9..aace7e9b2397 100644
> --- a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> +++ b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> @@ -4,6 +4,10 @@
>
> #include <asm/hvcall.h>
>
> +#define RIC_FLUSH_TLB 0
> +#define RIC_FLUSH_PWC 1
> +#define RIC_FLUSH_ALL 2
> +
> struct vm_area_struct;
> struct mm_struct;
> struct mmu_gather;
> @@ -21,6 +25,20 @@ static inline u64 psize_to_rpti_pgsize(unsigned long psize)
> return H_RPTI_PAGE_ALL;
> }
>
> +static inline int rpti_pgsize_to_psize(unsigned long page_size)
> +{
> + if (page_size == H_RPTI_PAGE_4K)
> + return MMU_PAGE_4K;
> + if (page_size == H_RPTI_PAGE_64K)
> + return MMU_PAGE_64K;
> + if (page_size == H_RPTI_PAGE_2M)
> + return MMU_PAGE_2M;
> + if (page_size == H_RPTI_PAGE_1G)
> + return MMU_PAGE_1G;
> + else
> + return MMU_PAGE_64K; /* Default */
> +}
> +
> static inline int mmu_get_ap(int psize)
> {
> return mmu_psize_defs[psize].ap;
> diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
> index d32ec9ae73bd..0f1c5fa6e8ce 100644
> --- a/arch/powerpc/include/asm/kvm_book3s.h
> +++ b/arch/powerpc/include/asm/kvm_book3s.h
> @@ -298,6 +298,9 @@ void kvmhv_set_ptbl_entry(unsigned int lpid, u64 dw0, u64 dw1);
> void kvmhv_release_all_nested(struct kvm *kvm);
> long kvmhv_enter_nested_guest(struct kvm_vcpu *vcpu);
> long kvmhv_do_nested_tlbie(struct kvm_vcpu *vcpu);
> +long kvmhv_h_rpti_nested(struct kvm_vcpu *vcpu, unsigned long lpid,
> + unsigned long type, unsigned long pg_sizes,
> + unsigned long start, unsigned long end);
> int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu,
> u64 time_limit, unsigned long lpcr);
> void kvmhv_save_hv_regs(struct kvm_vcpu *vcpu, struct hv_guest_state *hr);
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index e3b1839fc251..adf2d1191581 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -904,6 +904,118 @@ static int kvmppc_get_yield_count(struct kvm_vcpu *vcpu)
> return yield_count;
> }
>
> +static inline void do_tlb_invalidate_all(unsigned long rb, unsigned long rs)
> +{
> + asm volatile("ptesync" : : : "memory");
> + asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
> + : : "r"(rb), "i"(1), "i"(1), "i"(RIC_FLUSH_ALL), "r"(rs)
> + : "memory");
> + asm volatile("eieio; tlbsync; ptesync" : : : "memory");
> +}
> +
> +static inline void do_tlb_invalidate_pwc(unsigned long rb, unsigned long rs)
> +{
> + asm volatile("ptesync" : : : "memory");
> + asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
> + : : "r"(rb), "i"(1), "i"(1), "i"(RIC_FLUSH_PWC), "r"(rs)
> + : "memory");
> + asm volatile("eieio; tlbsync; ptesync" : : : "memory");
> +}
> +
> +static inline void do_tlb_invalidate_tlb(unsigned long rb, unsigned long rs)
> +{
> + asm volatile("ptesync" : : : "memory");
> + asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
> + : : "r"(rb), "i"(1), "i"(1), "i"(RIC_FLUSH_TLB), "r"(rs)
> + : "memory");
> + asm volatile("eieio; tlbsync; ptesync" : : : "memory");
> +}
> +
> +static void do_tlb_invalidate(unsigned long rs, unsigned long target,
> + unsigned long type, unsigned long page_size,
> + unsigned long ap, unsigned long start,
> + unsigned long end)
> +{
> + unsigned long rb;
> + unsigned long addr = start;
> +
> + if ((type & H_RPTI_TYPE_ALL) == H_RPTI_TYPE_ALL) {
> + rb = PPC_BIT(53); /* IS = 1 */
> + do_tlb_invalidate_all(rb, rs);
> + return;
> + }
> +
> + if (type & H_RPTI_TYPE_PWC) {
> + rb = PPC_BIT(53); /* IS = 1 */
> + do_tlb_invalidate_pwc(rb, rs);
> + }
> +
> + if (!addr && end == -1) { /* PID */
> + rb = PPC_BIT(53); /* IS = 1 */
> + do_tlb_invalidate_tlb(rb, rs);
> + } else { /* EA */
> + do {
> + rb = addr & ~(PPC_BITMASK(52, 63));
> + rb |= ap << PPC_BITLSHIFT(58);
> + do_tlb_invalidate_tlb(rb, rs);
> + addr += page_size;
> + } while (addr < end);
> + }
> +}
> +
> +static long kvmppc_h_rpt_invalidate(struct kvm_vcpu *vcpu,
> + unsigned long pid, unsigned long target,
> + unsigned long type, unsigned long pg_sizes,
> + unsigned long start, unsigned long end)
> +{
> + unsigned long rs, ap, psize;
> +
> + if (!kvm_is_radix(vcpu->kvm))
> + return H_FUNCTION;
IIUC The cover note said this case was H_NOT_SUPPORTED, rather than H_FUNCTION.
> +
> + if (end < start)
> + return H_P5;
> +
> + if (type & H_RPTI_TYPE_NESTED) {
> + if (!nesting_enabled(vcpu->kvm))
> + return H_FUNCTION;
Likewise, I'm not sure that H_FUNCTION is the right choice here.
> +
> + /* Support only cores as target */
> + if (target != H_RPTI_TARGET_CMMU)
> + return H_P2;
> +
> + return kvmhv_h_rpti_nested(vcpu, pid,
> + (type & ~H_RPTI_TYPE_NESTED),
> + pg_sizes, start, end);
> + }
> +
> + rs = pid << PPC_BITLSHIFT(31);
> + rs |= vcpu->kvm->arch.lpid;
> +
> + if (pg_sizes & H_RPTI_PAGE_64K) {
> + psize = rpti_pgsize_to_psize(pg_sizes & H_RPTI_PAGE_64K);
> + ap = mmu_get_ap(psize);
> + do_tlb_invalidate(rs, target, type, (1UL << 16), ap, start,
> + end);
Should these be conditional on the TLB flag in type?
> + }
> +
> + if (pg_sizes & H_RPTI_PAGE_2M) {
> + psize = rpti_pgsize_to_psize(pg_sizes & H_RPTI_PAGE_2M);
> + ap = mmu_get_ap(psize);
> + do_tlb_invalidate(rs, target, type, (1UL << 21), ap, start,
> + end);
> + }
> +
> + if (pg_sizes & H_RPTI_PAGE_1G) {
> + psize = rpti_pgsize_to_psize(pg_sizes & H_RPTI_PAGE_1G);
> + ap = mmu_get_ap(psize);
> + do_tlb_invalidate(rs, target, type, (1UL << 30), ap, start,
> + end);
> + }
> +
> + return H_SUCCESS;
> +}
> +
> int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
> {
> unsigned long req = kvmppc_get_gpr(vcpu, 3);
> @@ -1112,6 +1224,14 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
> */
> ret = kvmppc_h_svm_init_abort(vcpu->kvm);
> break;
> + case H_RPT_INVALIDATE:
> + ret = kvmppc_h_rpt_invalidate(vcpu, kvmppc_get_gpr(vcpu, 4),
> + kvmppc_get_gpr(vcpu, 5),
> + kvmppc_get_gpr(vcpu, 6),
> + kvmppc_get_gpr(vcpu, 7),
> + kvmppc_get_gpr(vcpu, 8),
> + kvmppc_get_gpr(vcpu, 9));
> + break;
>
> default:
> return RESUME_HOST;
> @@ -1158,6 +1278,7 @@ static int kvmppc_hcall_impl_hv(unsigned long cmd)
> case H_XIRR_X:
> #endif
> case H_PAGE_INIT:
> + case H_RPT_INVALIDATE:
> return 1;
> }
>
> diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c
> index 33b58549a9aa..a54ba4b1d4a7 100644
> --- a/arch/powerpc/kvm/book3s_hv_nested.c
> +++ b/arch/powerpc/kvm/book3s_hv_nested.c
> @@ -1149,6 +1149,100 @@ long kvmhv_do_nested_tlbie(struct kvm_vcpu *vcpu)
> return H_SUCCESS;
> }
>
> +static long do_tlb_invalidate_nested_tlb(struct kvm_vcpu *vcpu,
> + unsigned long lpid,
> + unsigned long page_size,
> + unsigned long ap,
> + unsigned long start,
> + unsigned long end)
> +{
> + unsigned long addr = start;
> + int ret;
> +
> + do {
> + ret = kvmhv_emulate_tlbie_tlb_addr(vcpu, lpid, ap,
> + get_epn(addr));
> + if (ret)
> + return ret;
> + addr += page_size;
> + } while (addr < end);
> +
> + return ret;
> +}
> +
> +static long do_tlb_invalidate_nested_all(struct kvm_vcpu *vcpu,
> + unsigned long lpid)
> +{
> + struct kvm *kvm = vcpu->kvm;
> + struct kvm_nested_guest *gp;
> +
> + gp = kvmhv_get_nested(kvm, lpid, false);
> + if (gp) {
> + kvmhv_emulate_tlbie_lpid(vcpu, gp, RIC_FLUSH_ALL);
> + kvmhv_put_nested(gp);
> + }
> + return H_SUCCESS;
> +}
> +
> +long kvmhv_h_rpti_nested(struct kvm_vcpu *vcpu, unsigned long lpid,
> + unsigned long type, unsigned long pg_sizes,
> + unsigned long start, unsigned long end)
> +{
> + struct kvm_nested_guest *gp;
> + long ret;
> + unsigned long psize, ap;
> +
> + /*
> + * If L2 lpid isn't valid, we need to return H_PARAMETER.
> + * Nested KVM issues a L2 lpid flush call when creating
> + * partition table entries for L2. This happens even before
> + * the corresponding shadow lpid is created in HV. Until
> + * this is fixed, ignore such flush requests.
> + */
> + gp = kvmhv_find_nested(vcpu->kvm, lpid);
> + if (!gp)
> + return H_SUCCESS;
> +
> + if ((type & H_RPTI_TYPE_NESTED_ALL) == H_RPTI_TYPE_NESTED_ALL)
> + return do_tlb_invalidate_nested_all(vcpu, lpid);
> +
> + if ((type & H_RPTI_TYPE_TLB) == H_RPTI_TYPE_TLB) {
> + if (pg_sizes & H_RPTI_PAGE_64K) {
> + psize = rpti_pgsize_to_psize(pg_sizes & H_RPTI_PAGE_64K);
> + ap = mmu_get_ap(psize);
> +
> + ret = do_tlb_invalidate_nested_tlb(vcpu, lpid,
> + (1UL << 16),
> + ap, start, end);
> + if (ret)
> + return H_P4;
> + }
> +
> + if (pg_sizes & H_RPTI_PAGE_2M) {
> + psize = rpti_pgsize_to_psize(pg_sizes & H_RPTI_PAGE_2M);
> + ap = mmu_get_ap(psize);
> +
> + ret = do_tlb_invalidate_nested_tlb(vcpu, lpid,
> + (1UL << 21),
> + ap, start, end);
> + if (ret)
> + return H_P4;
> + }
> +
> + if (pg_sizes & H_RPTI_PAGE_1G) {
> + psize = rpti_pgsize_to_psize(pg_sizes & H_RPTI_PAGE_1G);
> + ap = mmu_get_ap(psize);
> +
> + ret = do_tlb_invalidate_nested_tlb(vcpu, lpid,
> + (1UL << 30),
> + ap, start, end);
> + if (ret)
> + return H_P4;
> + }
> + }
> + return H_SUCCESS;
> +}
> +
> /* Used to convert a nested guest real address to a L1 guest real address */
> static int kvmhv_translate_addr_nested(struct kvm_vcpu *vcpu,
> struct kvm_nested_guest *gp,
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 13999123b735..172a89187116 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -678,6 +678,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> r = hv_enabled && kvmppc_hv_ops->enable_svm &&
> !kvmppc_hv_ops->enable_svm(NULL);
> break;
> + case KVM_CAP_PPC_RPT_INVALIDATE:
> + r = 1;
> + break;
> #endif
> default:
> r = 0;
> diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
> index b487b489d4b6..3a2b12d1d49b 100644
> --- a/arch/powerpc/mm/book3s64/radix_tlb.c
> +++ b/arch/powerpc/mm/book3s64/radix_tlb.c
> @@ -18,10 +18,6 @@
> #include <asm/cputhreads.h>
> #include <asm/plpar_wrappers.h>
>
> -#define RIC_FLUSH_TLB 0
> -#define RIC_FLUSH_PWC 1
> -#define RIC_FLUSH_ALL 2
> -
> /*
> * tlbiel instruction for radix, set invalidation
> * i.e., r=1 and is=01 or is=10 or is=11
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index ca41220b40b8..c9ece825299e 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -1053,6 +1053,7 @@ struct kvm_ppc_resize_hpt {
> #define KVM_CAP_X86_USER_SPACE_MSR 188
> #define KVM_CAP_X86_MSR_FILTER 189
> #define KVM_CAP_ENFORCE_PV_FEATURE_CPUID 190
> +#define KVM_CAP_PPC_RPT_INVALIDATE 191
>
> #ifdef KVM_CAP_IRQ_ROUTING
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH v2 0/2] Support for H_RPT_INVALIDATE in PowerPC KVM
From: David Gibson @ 2020-12-17 3:33 UTC (permalink / raw)
To: Bharata B Rao; +Cc: aneesh.kumar, npiggin, kvm-ppc, linuxppc-dev
In-Reply-To: <20201216085447.1265433-1-bharata@linux.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 5117 bytes --]
On Wed, Dec 16, 2020 at 02:24:45PM +0530, Bharata B Rao wrote:
> This patchset adds support for the new hcall H_RPT_INVALIDATE
> and replaces the nested tlb flush calls with this new hcall
> if support for the same exists.
>
> Changes in v2:
> -------------
> - Not enabling the hcall by default now, userspace can enable it when
> required.
> - Added implementation for process-scoped invalidations in the hcall.
>
> v1: https://lore.kernel.org/linuxppc-dev/20201019112642.53016-1-bharata@linux.ibm.com/T/#t
>
> H_RPT_INVALIDATE
> ================
> Syntax:
> int64 /* H_Success: Return code on successful completion */
> /* H_Busy - repeat the call with the same */
> /* H_Parameter, H_P2, H_P3, H_P4, H_P5 : Invalid parameters */
> hcall(const uint64 H_RPT_INVALIDATE, /* Invalidate RPT translation lookaside information */
> uint64 pid, /* PID/LPID to invalidate */
> uint64 target, /* Invalidation target */
> uint64 type, /* Type of lookaside information */
> uint64 pageSizes, /* Page sizes */
> uint64 start, /* Start of Effective Address (EA) range (inclusive) */
> uint64 end) /* End of EA range (exclusive) */
>
> Invalidation targets (target)
> -----------------------------
> Core MMU 0x01 /* All virtual processors in the partition */
> Core local MMU 0x02 /* Current virtual processor */
> Nest MMU 0x04 /* All nest/accelerator agents in use by the partition */
>
> A combination of the above can be specified, except core and core local.
>
> Type of translation to invalidate (type)
> ---------------------------------------
> NESTED 0x0001 /* Invalidate nested guest partition-scope */
> TLB 0x0002 /* Invalidate TLB */
> PWC 0x0004 /* Invalidate Page Walk Cache */
> PRT 0x0008 /* Invalidate Process Table Entries if NESTED is clear */
> PAT 0x0008 /* Invalidate Partition Table Entries if NESTED is set */
>
> A combination of the above can be specified.
>
> Page size mask (pageSizes)
> --------------------------
> 4K 0x01
> 64K 0x02
> 2M 0x04
> 1G 0x08
> All sizes (-1UL)
PAPR really has a real talent for tying its own shoelaces together.
They could have just made the bit for each pagesize be... the size of
the page, but why use something obviously extensible to any future
pagesizes when we can make it both less flexible and more complicated
to deal with. Sigh.
>
> A combination of the above can be specified.
> All page sizes can be selected with -1.
>
> Semantics: Invalidate radix tree lookaside information
> matching the parameters given.
> * Return H_P2, H_P3 or H_P4 if target, type, or pageSizes parameters are
> different from the defined values.
> * Return H_PARAMETER if NESTED is set and pid is not a valid nested
> LPID allocated to this partition
> * Return H_P5 if (start, end) doesn't form a valid range. Start and end
> should be a valid Quadrant address and end > start.
> * Return H_NotSupported if the partition is not in running in radix
> translation mode.
> * May invalidate more translation information than requested.
> * If start = 0 and end = -1, set the range to cover all valid addresses.
> Else start and end should be aligned to 4kB (lower 11 bits clear).
> * If NESTED is clear, then invalidate process scoped lookaside information.
> Else pid specifies a nested LPID, and the invalidation is performed
> on nested guest partition table and nested guest partition scope real
> addresses.
> * If pid = 0 and NESTED is clear, then valid addresses are quadrant 3 and
> quadrant 0 spaces, Else valid addresses are quadrant 0.
> * Pages which are fully covered by the range are to be invalidated.
> Those which are partially covered are considered outside invalidation
> range, which allows a caller to optimally invalidate ranges that may
> contain mixed page sizes.
> * Return H_SUCCESS on success.
>
> Bharata B Rao (2):
> KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE
> KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM
>
> Documentation/virt/kvm/api.rst | 17 +++
> .../include/asm/book3s/64/tlbflush-radix.h | 18 +++
> arch/powerpc/include/asm/kvm_book3s.h | 3 +
> arch/powerpc/kvm/book3s_64_mmu_radix.c | 27 +++-
> arch/powerpc/kvm/book3s_hv.c | 121 ++++++++++++++++++
> arch/powerpc/kvm/book3s_hv_nested.c | 106 ++++++++++++++-
> arch/powerpc/kvm/powerpc.c | 3 +
> arch/powerpc/mm/book3s64/radix_tlb.c | 4 -
> include/uapi/linux/kvm.h | 1 +
> 9 files changed, 289 insertions(+), 11 deletions(-)
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* powerpc VDSO files being unnecessarily rebuilt
From: Michael Ellerman @ 2020-12-17 2:56 UTC (permalink / raw)
To: linuxppc-dev, Masahiro Yamada, Christophe Leroy, linux-kbuild
Hi all,
Since the merge of the C VDSO I see we are repeatedly rebuilding some
files in the VDSO, eg:
$ make V=2
make[1]: Entering directory '/home/michael/linux/build~'
GEN Makefile
CALL /home/michael/linux/scripts/checksyscalls.sh - due to target missing
CALL /home/michael/linux/scripts/atomic/check-atomics.sh - due to target missing
CHK include/generated/compile.h
CC arch/powerpc/kernel/vdso64/vgettimeofday.o - due to vgettimeofday.o not in $(targets)
This then causes multiple other files to be rebuilt.
So the obvious fix is to add it to targets:
diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
index d365810a689a..5386532866ce 100644
--- a/arch/powerpc/kernel/vdso64/Makefile
+++ b/arch/powerpc/kernel/vdso64/Makefile
@@ -5,6 +5,7 @@ ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_
include $(srctree)/lib/vdso/Makefile
obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o
+targets := $(obj-vdso64) vdso64.so.dbg
ifneq ($(c-gettimeofday-y),)
CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
@@ -13,11 +14,11 @@ ifneq ($(c-gettimeofday-y),)
CFLAGS_vgettimeofday.o += -DDISABLE_BRANCH_PROFILING
CFLAGS_vgettimeofday.o += -ffreestanding -fasynchronous-unwind-tables
CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE)
+ targets += vgettimeofday.o
endif
# Build rules
-targets := $(obj-vdso64) vdso64.so.dbg
obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
GCOV_PROFILE := n
But then I see it still rebuilt:
CC arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
I'm not changing the command line, and AFAICS the .cmd file is not
changing either:
$ make V=2
...
CC arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
$ sha256sum build\~/arch/powerpc/kernel/vdso64/vgettimeofday.o
7f635546bc2768c7b929d3de1724d83285f3cd54394fcd7104f8b1301d689d65 build~/arch/powerpc/kernel/vdso64/vgettimeofday.o
$ make V=2
...
CC arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
$ sha256sum build\~/arch/powerpc/kernel/vdso64/vgettimeofday.o
7f635546bc2768c7b929d3de1724d83285f3cd54394fcd7104f8b1301d689d65 build~/arch/powerpc/kernel/vdso64/vgettimeofday.o
So any hints on what I'm missing here?
cheers
^ permalink raw reply related
* [PATCH] powerpc/64s/kuap: Use mmu_has_feature()
From: Michael Ellerman @ 2020-12-17 0:53 UTC (permalink / raw)
To: linuxppc-dev
In commit 8150a153c013 ("powerpc/64s: Use early_mmu_has_feature() in
set_kuap()") we switched the KUAP code to use early_mmu_has_feature(),
to avoid a bug where we called set_kuap() before feature patching had
been done, leading to recursion and crashes.
That path, which called probe_kernel_read() from printk(), has since
been removed, see commit 2ac5a3bf7042 ("vsprintf: Do not break early
boot with probing addresses").
Additionally probe_kernel_read() no longer invokes any KUAP routines,
since commit fe557319aa06 ("maccess: rename probe_kernel_{read,write}
to copy_{from,to}_kernel_nofault") and c33165253492 ("powerpc: use
non-set_fs based maccess routines").
So it should now be safe to use mmu_has_feature() in the KUAP
routines, because we shouldn't invoke them prior to feature patching.
This is essentially a revert of commit 8150a153c013 ("powerpc/64s: Use
early_mmu_has_feature() in set_kuap()"), but we've since added a
second usage of early_mmu_has_feature() in get_kuap(), so we convert
that to use mmu_has_feature() as well.
Depends-on: c33165253492 ("powerpc: use non-set_fs based maccess routines").
Reported-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/book3s/64/kup.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/book3s/64/kup.h b/arch/powerpc/include/asm/book3s/64/kup.h
index f50f72e535aa..2298eac49763 100644
--- a/arch/powerpc/include/asm/book3s/64/kup.h
+++ b/arch/powerpc/include/asm/book3s/64/kup.h
@@ -333,7 +333,7 @@ static inline unsigned long get_kuap(void)
* This has no effect in terms of actually blocking things on hash,
* so it doesn't break anything.
*/
- if (!early_mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
+ if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
return AMR_KUAP_BLOCKED;
return mfspr(SPRN_AMR);
@@ -341,7 +341,7 @@ static inline unsigned long get_kuap(void)
static inline void set_kuap(unsigned long value)
{
- if (!early_mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
+ if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
return;
/*
--
2.25.1
^ permalink raw reply related
* Re: linux-next: manual merge of the akpm-current tree with the powerpc tree
From: Stephen Rothwell @ 2020-12-17 0:48 UTC (permalink / raw)
To: Michael Ellerman
Cc: PowerPC, Linux Kernel Mailing List, Mahesh Salgaonkar,
Linux Next Mailing List, Ganesh Goudar, Andrew Morton,
Francis Laniel
In-Reply-To: <20201208204016.4eb18ca4@canb.auug.org.au>
[-- Attachment #1: Type: text/plain, Size: 2425 bytes --]
Hi all,
On Tue, 8 Dec 2020 20:40:16 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Today's linux-next merge of the akpm-current tree got conflicts in:
>
> drivers/misc/lkdtm/Makefile
> drivers/misc/lkdtm/lkdtm.h
> tools/testing/selftests/lkdtm/tests.txt
>
> between commit:
>
> 3ba150fb2120 ("lkdtm/powerpc: Add SLB multihit test")
>
> from the powerpc tree and commit:
>
> 014a486edd8a ("drivers/misc/lkdtm: add new file in LKDTM to test fortified strscpy")
>
> from the akpm-current tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging. You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
>
>
> diff --cc drivers/misc/lkdtm/Makefile
> index 5a92c74eca92,d898f7b22045..000000000000
> --- a/drivers/misc/lkdtm/Makefile
> +++ b/drivers/misc/lkdtm/Makefile
> @@@ -10,7 -10,7 +10,8 @@@ lkdtm-$(CONFIG_LKDTM) += rodata_objcop
> lkdtm-$(CONFIG_LKDTM) += usercopy.o
> lkdtm-$(CONFIG_LKDTM) += stackleak.o
> lkdtm-$(CONFIG_LKDTM) += cfi.o
> + lkdtm-$(CONFIG_LKDTM) += fortify.o
> +lkdtm-$(CONFIG_PPC_BOOK3S_64) += powerpc.o
>
> KASAN_SANITIZE_stackleak.o := n
> KCOV_INSTRUMENT_rodata.o := n
> diff --cc drivers/misc/lkdtm/lkdtm.h
> index 79ec05c18dd1,6aa6d6a1a839..000000000000
> --- a/drivers/misc/lkdtm/lkdtm.h
> +++ b/drivers/misc/lkdtm/lkdtm.h
> @@@ -102,7 -104,7 +104,10 @@@ void lkdtm_STACKLEAK_ERASING(void)
> /* cfi.c */
> void lkdtm_CFI_FORWARD_PROTO(void);
>
> + /* fortify.c */
> + void lkdtm_FORTIFIED_STRSCPY(void);
> +
> +/* powerpc.c */
> +void lkdtm_PPC_SLB_MULTIHIT(void);
> +
> #endif
> diff --cc tools/testing/selftests/lkdtm/tests.txt
> index 18e4599863c0,92ba4cc41314..000000000000
> --- a/tools/testing/selftests/lkdtm/tests.txt
> +++ b/tools/testing/selftests/lkdtm/tests.txt
> @@@ -68,4 -68,4 +68,5 @@@ USERCOPY_STACK_BEYON
> USERCOPY_KERNEL
> STACKLEAK_ERASING OK: the rest of the thread stack is properly erased
> CFI_FORWARD_PROTO
> + FORTIFIED_STRSCPY
> +PPC_SLB_MULTIHIT Recovered
These conflicts are now between the powerpc tree and Linus' tree.
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Re: [PATCH] arch: fix 'unexpected IRQ trap at vector' warnings
From: Enrico Weigelt, metux IT consult @ 2020-12-16 16:42 UTC (permalink / raw)
To: Thomas Gleixner, Michael Ellerman,
Enrico Weigelt, metux IT consult, linux-kernel
Cc: linux-s390, hpa, linux-parisc, deller, x86, linux-um,
James.Bottomley, mingo, paulus, richard, bp, linuxppc-dev, jdike,
anton.ivanov
In-Reply-To: <87a6ueu3af.fsf@nanos.tec.linutronix.de>
On 15.12.20 23:12, Thomas Gleixner wrote:
> On Tue, Dec 15 2020 at 21:12, Enrico Weigelt wrote:
>> On 09.12.20 00:01, Thomas Gleixner wrote:
>>> 3) It's invoked from __handle_domain_irq() when the 'hwirq' which is
>>> handed in by the caller does not resolve to a mapped Linux
>>> interrupt which is pretty much the same as the x86 situation above
>>> in #1, but it prints useless data.
>>>
>>> It prints 'irq' which is invalid but it does not print the really
>>> interesting 'hwirq' which was handed in by the caller and did
>>> not resolve.
>>
>> I wouldn't say the irq-nr isn't interesting. In my particular case it
>> was quite what I've been looking for. But you're right, hwirq should
>> also be printed.
>
> The number is _not_ interesting in this case. It's useless because the
> function does:
Oh, I've mixed up the cases - I only had the other one, down below.
> irq = hwirq;
>
> if (lookup)
> irq = find_mapping(hwirq);
>
> if (!irq || irq >= nr_irqs)
> -> BAD
When exactly can that happen ? Only when some hardware sending an IRQ,
but no driver listening to it, or are there other cases ?
By the way: who's supposed to call that function ? Only irqchip's
(and the few soc specific 1st-level irq handlers) ? I'm asking, because
we have lots of gpio drivers, which have their own irq domain, but go
the generic_handle_irq() route. Same for some SOC-specific irqchips.
Should they also call handle_domain_irq() instead ?
> In both cases the only interesting information is that hwirq does not
> resolve to a valid Linux interrupt number and which hwirq number caused
> that.
Don't we also need know which irqchip the hwirq number belongs to ?
> If you look really then you find out that there is exactly _ONE_
> architecture which does anything else than incrementing a counter and/or
> printing stuff: X86, which has a big fat comment explaining why. The
> only way to ack an interrupt on X86 is to issue EOI on the local APIC,
> i.e. it does _not_ need any further information.
Yeah, found it :)
At this point I wonder whether the ack_APIC_irq() call could be done
somewhere further up in the call chain, eg. handle_irq() or
common_interrupt() ?
If that works, we IMHO could drop ack_bad_irq() completely (except for
the counter and printk, which we could consolidate elsewhere anyways)
>> ... rethinking this further ... shouldn't we also pass in even more data
>> (eg. irq_desc, irqchip, ...), so this function can check which hw to
>> actually talk to ?
>
> There are 3 ways to get there:
>
> 1) via dummy chip which obviously has no hardware associated
... which also calls print_irq_desc() ..
> 2) via handle_bad_irq() which prints the info already
print_irq_desc() doesn't seem to print the hwirq ... shall we fix this ?
> 3) __handle_domain_irq() which cannot print anything and obviously
> cannot figure out the hw to talk to because there is no irq
> descriptor associated.
Okay, what's the conclusion ? Drop printouts in the ack_bad_irq()'s ?
>>> 4) It's invoked from the dummy irq chip which is installed for a
>>> couple of truly virtual interrupts where the invocation of
>>> dummy_irq_chip::irq_ack() is indicating wreckage.
>>>
>>> In that case the Linux irq number is the thing which is printed.
>>>
>>> So no. It's not just inconsistent it's in some places outright
>>> wrong. What we really want is:
>>>
>>> ack_bad_irq(int hwirq, int virq)
>>
>> is 'int' correct here ?
>
> This was just for illustration.
Okay, thanks. Just discovered already have an irq_hw_number_t, which
doesn't seem to be used everywhere ... shall we fix that ?
>> OTOH: since both callers (dummychip.c, handle.c) already dump out before
>> ack_bad_irq(), do we need to print out anything at all ?
>
> Not all callers print something, but yes this could do with some general
> cleanup.
I've found three callers, only one (__handle_domain_irq() in irqdesc.c)
doesn't print out anything. I belive, adding a pr_warn() here and drop
all the printouts in ack_bad_irq()'s makes sense.
> The error counter is independent of that, but yes there is room for
> consolidation.
Ok, I've already started hacking a bit here: adding an atomic_t counter
in kernel/irq/handle.c and inline'd accessor functions in
include/asm-generic/irq.h (just feeling that accessors are a bit cleaner
than direct access). Would that be okay ?
By the way: I still wonder whether my case should have ever reached
ack_bad_irq().
The irqdescs had been allocated via devm_irq_alloc_descs(), and the
driver just called generic_handle_irq() with base irq + gpio nr.
So, IMHO it was a valid linux irq number, but no (explicit) handler.
I wonder whether ack'ing those virtual irqs onto hw could be harmful.
--mtx
--
---
Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert
werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren
GPG/PGP-Schlüssel zu.
---
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287
^ permalink raw reply
* Re: [PATCH] ASoC: imx-hdmi: Fix warning of the uninitialized variable ret
From: Mark Brown @ 2020-12-16 15:52 UTC (permalink / raw)
To: nicoleotsuka, Xiubo.Lee, timur, tiwai, Shengjiu Wang, perex,
festevam, alsa-devel
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1608115464-18710-1-git-send-email-shengjiu.wang@nxp.com>
On Wed, 16 Dec 2020 18:44:24 +0800, Shengjiu Wang wrote:
> When condition ((hdmi_out && hdmi_in) || (!hdmi_out && !hdmi_in))
> is true, then goto fail, the uninitialized variable ret will be
> returned.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: imx-hdmi: Fix warning of the uninitialized variable ret
commit: acd894aee3149c15847bc4f0690fccba59ced5e7
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply
* [PATCH -next] pci/controller/dwc: convert comma to semicolon
From: Zheng Yongjun @ 2020-12-16 13:19 UTC (permalink / raw)
To: minghuan.Lian, mingkai.hu, roy.zang, robh, linuxppc-dev,
linux-pci, linux-arm-kernel, linux-kernel
Cc: Zheng Yongjun
Replace a comma between expression statements by a semicolon.
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
drivers/pci/controller/dwc/pci-layerscape-ep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pci-layerscape-ep.c b/drivers/pci/controller/dwc/pci-layerscape-ep.c
index 84206f265e54..917ba8d254fc 100644
--- a/drivers/pci/controller/dwc/pci-layerscape-ep.c
+++ b/drivers/pci/controller/dwc/pci-layerscape-ep.c
@@ -178,7 +178,7 @@ static int __init ls_pcie_ep_probe(struct platform_device *pdev)
pci->dev = dev;
pci->ops = pcie->drvdata->dw_pcie_ops;
- ls_epc->bar_fixed_64bit = (1 << BAR_2) | (1 << BAR_4),
+ ls_epc->bar_fixed_64bit = (1 << BAR_2) | (1 << BAR_4);
pcie->pci = pci;
pcie->ls_epc = ls_epc;
--
2.22.0
^ 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