* [PATCH v3 04/11] powerpc: Add soft_enabled manipulation functions
From: Madhavan Srinivasan @ 2016-11-14 18:04 UTC (permalink / raw)
To: mpe, benh; +Cc: anton, paulus, npiggin, linuxppc-dev, Madhavan Srinivasan
In-Reply-To: <1479146692-15726-1-git-send-email-maddy@linux.vnet.ibm.com>
Add new soft_enabled_* manipulation function and implement
arch_local_* using the soft_enabled_* wrappers.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/hw_irq.h | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 88f6a8e2b5e3..c292ef4b4bc5 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -62,21 +62,7 @@ static inline notrace void soft_enabled_set(unsigned long enable)
: "memory");
}
-static inline notrace unsigned long soft_enabled_set_return(unsigned long enable)
-{
- unsigned long flags;
-
- asm volatile(
- "lbz %0,%1(13); stb %2,%1(13)"
- : "=r" (flags)
- : "i" (offsetof(struct paca_struct, soft_enabled)),\
- "r" (enable)
- : "memory");
-
- return flags;
-}
-
-static inline unsigned long arch_local_save_flags(void)
+static inline notrace unsigned long soft_enabled_return(void)
{
unsigned long flags;
@@ -88,20 +74,30 @@ static inline unsigned long arch_local_save_flags(void)
return flags;
}
-static inline unsigned long arch_local_irq_disable(void)
+static inline notrace unsigned long soft_enabled_set_return(unsigned long enable)
{
unsigned long flags, zero;
asm volatile(
- "li %1,%3; lbz %0,%2(13); stb %1,%2(13)"
+ "mr %1,%3; lbz %0,%2(13); stb %1,%2(13)"
: "=r" (flags), "=&r" (zero)
: "i" (offsetof(struct paca_struct, soft_enabled)),\
- "i" (IRQ_DISABLE_MASK_LINUX)
+ "r" (enable)
: "memory");
return flags;
}
+static inline unsigned long arch_local_save_flags(void)
+{
+ return soft_enabled_return();
+}
+
+static inline unsigned long arch_local_irq_disable(void)
+{
+ return soft_enabled_set_return(IRQ_DISABLE_MASK_LINUX);
+}
+
extern void arch_local_irq_restore(unsigned long);
static inline void arch_local_irq_enable(void)
--
2.7.4
^ permalink raw reply related
* Re: [PATCH v1 2/2] net/i40e: fix spelling errors
From: Kevin Traynor @ 2016-11-14 18:05 UTC (permalink / raw)
To: Remy Horton, dev; +Cc: Helin Zhang, Jingjing Wu
In-Reply-To: <1479104089-27862-3-git-send-email-remy.horton@intel.com>
On 11/14/2016 06:14 AM, Remy Horton wrote:
> Fixes: da61cd084976 ("i40evf: add extended stats")
> Fixes: 0eedec25ea36 ("i40e: clean log messages")
>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
> Signed-off-by: Remy Horton <remy.horton@intel.com>
> ---
> drivers/net/i40e/i40e_ethdev.c | 2 +-
> drivers/net/i40e/i40e_ethdev_vf.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 67778ba..f102328 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -4107,7 +4107,7 @@ i40e_veb_setup(struct i40e_pf *pf, struct i40e_vsi *vsi)
> ret = i40e_aq_get_veb_parameters(hw, veb->seid, NULL, NULL,
> &veb->stats_idx, NULL, NULL, NULL);
> if (ret != I40E_SUCCESS) {
> - PMD_DRV_LOG(ERR, "Get veb statics index failed, aq_err: %d",
> + PMD_DRV_LOG(ERR, "Get veb statistics index failed, aq_err: %d",
> hw->aq.asq_last_status);
> goto fail;
> }
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
> index afae2ec..1431b6e 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -952,7 +952,7 @@ i40evf_update_stats(struct rte_eth_dev *dev, struct i40e_eth_stats **pstats)
> }
>
> static int
> -i40evf_get_statics(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
> +i40evf_get_statistics(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
> {
> int ret;
> struct i40e_eth_stats *pstats = NULL;
> @@ -2277,8 +2277,8 @@ i40evf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
> static void
> i40evf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
> {
> - if (i40evf_get_statics(dev, stats))
> - PMD_DRV_LOG(ERR, "Get statics failed");
> + if (i40evf_get_statistics(dev, stats))
> + PMD_DRV_LOG(ERR, "Get statistics failed");
> }
>
> static void
>
^ permalink raw reply
* [PATCH v3 11/11] powerpc: rewrite local_t using soft_irq
From: Madhavan Srinivasan @ 2016-11-14 18:04 UTC (permalink / raw)
To: mpe, benh; +Cc: anton, paulus, npiggin, linuxppc-dev, Madhavan Srinivasan
In-Reply-To: <1479146692-15726-1-git-send-email-maddy@linux.vnet.ibm.com>
Local atomic operations are fast and highly reentrant per CPU counters.
Used for percpu variable updates. Local atomic operations only guarantee
variable modification atomicity wrt the CPU which owns the data and
these needs to be executed in a preemption safe way.
Here is the design of this patch. Since local_* operations
are only need to be atomic to interrupts (IIUC), we have two options.
Either replay the "op" if interrupted or replay the interrupt after
the "op". Initial patchset posted was based on implementing local_* operation
based on CR5 which replay's the "op". Patchset had issues in case of
rewinding the address pointor from an array. This make the slow patch
really slow. Since CR5 based implementation proposed using __ex_table to find
the rewind addressr, this rasied concerns about size of __ex_table and vmlinux.
https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-December/123115.html
But this patch uses, powerpc_local_irq_pmu_save to soft_disable
interrupts (including PMIs). After finishing the "op", powerpc_local_irq_pmu_restore()
called and correspondingly interrupts are replayed if any occured.
patch re-write the current local_* functions to use arch_local_irq_disbale.
Base flow for each function is
{
powerpc_local_irq_pmu_save(flags)
load
..
store
powerpc_local_irq_pmu_restore(flags)
}
Reason for the approach is that, currently l[w/d]arx/st[w/d]cx.
instruction pair is used for local_* operations, which are heavy
on cycle count and they dont support a local variant. So to
see whether the new implementation helps, used a modified
version of Rusty's benchmark code on local_t.
https://lkml.org/lkml/2008/12/16/450
Modifications to Rusty's benchmark code:
- Executed only local_t test
Here are the values with the patch.
Time in ns per iteration
Local_t Without Patch With Patch
_inc 28 8
_add 28 8
_read 3 3
_add_return 28 7
Currently only asm/local.h has been rewrite, and also
the entire change is tested only in PPC64 (pseries guest)
and PPC64 host (LE)
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/local.h | 201 +++++++++++++++++++++++++++++++++++++++
1 file changed, 201 insertions(+)
diff --git a/arch/powerpc/include/asm/local.h b/arch/powerpc/include/asm/local.h
index b8da91363864..7d117c07b0b1 100644
--- a/arch/powerpc/include/asm/local.h
+++ b/arch/powerpc/include/asm/local.h
@@ -3,6 +3,9 @@
#include <linux/percpu.h>
#include <linux/atomic.h>
+#include <linux/irqflags.h>
+
+#include <asm/hw_irq.h>
typedef struct
{
@@ -14,6 +17,202 @@ typedef struct
#define local_read(l) atomic_long_read(&(l)->a)
#define local_set(l,i) atomic_long_set(&(l)->a, (i))
+#ifdef CONFIG_PPC64
+
+static __inline__ void local_add(long i, local_t *l)
+{
+ long t;
+ unsigned long flags;
+
+ powerpc_local_irq_pmu_save(flags);
+ __asm__ __volatile__(
+ PPC_LL" %0,0(%2)\n\
+ add %0,%1,%0\n"
+ PPC_STL" %0,0(%2)\n"
+ : "=&r" (t)
+ : "r" (i), "r" (&(l->a.counter)));
+ powerpc_local_irq_pmu_restore(flags);
+}
+
+static __inline__ void local_sub(long i, local_t *l)
+{
+ long t;
+ unsigned long flags;
+
+ powerpc_local_irq_pmu_save(flags);
+ __asm__ __volatile__(
+ PPC_LL" %0,0(%2)\n\
+ subf %0,%1,%0\n"
+ PPC_STL" %0,0(%2)\n"
+ : "=&r" (t)
+ : "r" (i), "r" (&(l->a.counter)));
+ powerpc_local_irq_pmu_restore(flags);
+}
+
+static __inline__ long local_add_return(long a, local_t *l)
+{
+ long t;
+ unsigned long flags;
+
+ powerpc_local_irq_pmu_save(flags);
+ __asm__ __volatile__(
+ PPC_LL" %0,0(%2)\n\
+ add %0,%1,%0\n"
+ PPC_STL "%0,0(%2)\n"
+ : "=&r" (t)
+ : "r" (a), "r" (&(l->a.counter))
+ : "memory");
+ powerpc_local_irq_pmu_restore(flags);
+
+ return t;
+}
+
+#define local_add_negative(a, l) (local_add_return((a), (l)) < 0)
+
+static __inline__ long local_sub_return(long a, local_t *l)
+{
+ long t;
+ unsigned long flags;
+
+ powerpc_local_irq_pmu_save(flags);
+ __asm__ __volatile__(
+ PPC_LL" %0,0(%2)\n\
+ subf %0,%1,%0\n"
+ PPC_STL "%0,0(%2)\n"
+ : "=&r" (t)
+ : "r" (a), "r" (&(l->a.counter))
+ : "memory");
+ powerpc_local_irq_pmu_restore(flags);
+
+ return t;
+}
+
+static __inline__ long local_inc_return(local_t *l)
+{
+ long t;
+ unsigned long flags;
+
+ powerpc_local_irq_pmu_save(flags);
+ __asm__ __volatile__(
+ PPC_LL" %0,0(%1)\n\
+ addic %0,%0,1\n"
+ PPC_STL "%0,0(%1)\n"
+ : "=&r" (t)
+ : "r" (&(l->a.counter))
+ : "xer", "memory");
+ powerpc_local_irq_pmu_restore(flags);
+
+ return t;
+}
+
+/*
+ * local_inc_and_test - increment and test
+ * @l: pointer of type local_t
+ *
+ * Atomically increments @l by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+#define local_inc_and_test(l) (local_inc_return(l) == 0)
+
+static __inline__ long local_dec_return(local_t *l)
+{
+ long t;
+ unsigned long flags;
+
+ powerpc_local_irq_pmu_save(flags);
+ __asm__ __volatile__(
+ PPC_LL" %0,0(%1)\n\
+ addic %0,%0,-1\n"
+ PPC_STL "%0,0(%1)\n"
+ : "=&r" (t)
+ : "r" (&(l->a.counter))
+ : "xer", "memory");
+ powerpc_local_irq_pmu_restore(flags);
+
+ return t;
+}
+
+#define local_inc(l) local_inc_return(l)
+#define local_dec(l) local_dec_return(l)
+
+#define local_cmpxchg(l, o, n) \
+ (cmpxchg_local(&((l)->a.counter), (o), (n)))
+#define local_xchg(l, n) (xchg_local(&((l)->a.counter), (n)))
+
+/**
+ * local_add_unless - add unless the number is a given value
+ * @l: pointer of type local_t
+ * @a: the amount to add to v...
+ * @u: ...unless v is equal to u.
+ *
+ * Atomically adds @a to @l, so long as it was not @u.
+ * Returns non-zero if @l was not @u, and zero otherwise.
+ */
+static __inline__ int local_add_unless(local_t *l, long a, long u)
+{
+ long t;
+ unsigned long flags;
+
+ powerpc_local_irq_pmu_save(flags);
+ __asm__ __volatile__ (
+ PPC_LL" %0,0(%1)\n\
+ cmpw 0,%0,%3 \n\
+ beq- 2f \n\
+ add %0,%2,%0 \n"
+ PPC_STL" %0,0(%1) \n"
+" subf %0,%2,%0 \n\
+2:"
+ : "=&r" (t)
+ : "r" (&(l->a.counter)), "r" (a), "r" (u)
+ : "cc", "memory");
+ powerpc_local_irq_pmu_restore(flags);
+
+ return t != u;
+}
+
+#define local_inc_not_zero(l) local_add_unless((l), 1, 0)
+
+#define local_sub_and_test(a, l) (local_sub_return((a), (l)) == 0)
+#define local_dec_and_test(l) (local_dec_return((l)) == 0)
+
+/*
+ * Atomically test *l and decrement if it is greater than 0.
+ * The function returns the old value of *l minus 1.
+ */
+static __inline__ long local_dec_if_positive(local_t *l)
+{
+ long t;
+ unsigned long flags;
+
+ powerpc_local_irq_pmu_save(flags);
+ __asm__ __volatile__(
+ PPC_LL" %0,0(%1)\n\
+ cmpwi %0,1\n\
+ addi %0,%0,-1\n\
+ blt- 2f\n"
+ PPC_STL "%0,0(%1)\n"
+ "\n\
+2:" : "=&b" (t)
+ : "r" (&(l->a.counter))
+ : "cc", "memory");
+ powerpc_local_irq_pmu_restore(flags);
+
+ return t;
+}
+
+/* Use these for per-cpu local_t variables: on some archs they are
+ * much more efficient than these naive implementations. Note they take
+ * a variable, not an address.
+ */
+
+#define __local_inc(l) ((l)->a.counter++)
+#define __local_dec(l) ((l)->a.counter++)
+#define __local_add(i,l) ((l)->a.counter+=(i))
+#define __local_sub(i,l) ((l)->a.counter-=(i))
+
+#else
+
#define local_add(i,l) atomic_long_add((i),(&(l)->a))
#define local_sub(i,l) atomic_long_sub((i),(&(l)->a))
#define local_inc(l) atomic_long_inc(&(l)->a)
@@ -172,4 +371,6 @@ static __inline__ long local_dec_if_positive(local_t *l)
#define __local_add(i,l) ((l)->a.counter+=(i))
#define __local_sub(i,l) ((l)->a.counter-=(i))
+#endif /* CONFIG_PPC64 */
+
#endif /* _ARCH_POWERPC_LOCAL_H */
--
2.7.4
^ permalink raw reply related
* [PATCH v3 09/11] powerpc:Add new kconfig IRQ_DEBUG_SUPPORT
From: Madhavan Srinivasan @ 2016-11-14 18:04 UTC (permalink / raw)
To: mpe, benh; +Cc: anton, paulus, npiggin, linuxppc-dev, Madhavan Srinivasan
In-Reply-To: <1479146692-15726-1-git-send-email-maddy@linux.vnet.ibm.com>
New Kconfig is added "CONFIG_IRQ_DEBUG_SUPPORT" to add warn_on
to alert the invalid transitions. Also moved the code under
the CONFIG_TRACE_IRQFLAGS in arch_local_irq_restore() to new Kconfig.
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
arch/powerpc/Kconfig | 4 ++++
arch/powerpc/kernel/irq.c | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 65fba4c34cd7..d19eee83b864 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -46,6 +46,10 @@ config TRACE_IRQFLAGS_SUPPORT
bool
default y
+config IRQ_DEBUG_SUPPORT
+ bool
+ default n
+
config LOCKDEP_SUPPORT
bool
default y
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index c030ccd0a7aa..299b55071612 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -263,7 +263,7 @@ notrace void arch_local_irq_restore(unsigned long en)
*/
if (unlikely(irq_happened != PACA_IRQ_HARD_DIS))
__hard_irq_disable();
-#ifdef CONFIG_TRACE_IRQFLAGS
+#ifdef CONFIG_IRQ_DEBUG_SUPPORT
else {
/*
* We should already be hard disabled here. We had bugs
@@ -274,7 +274,7 @@ notrace void arch_local_irq_restore(unsigned long en)
if (WARN_ON(mfmsr() & MSR_EE))
__hard_irq_disable();
}
-#endif /* CONFIG_TRACE_IRQFLAGS */
+#endif /* CONFIG_IRQ_DEBUG_SUPPORT */
soft_enabled_set(IRQ_DISABLE_MASK_LINUX);
--
2.7.4
^ permalink raw reply related
* [PATCH v3 10/11] powerpc: Add new set of soft_enabled_ functions
From: Madhavan Srinivasan @ 2016-11-14 18:04 UTC (permalink / raw)
To: mpe, benh; +Cc: anton, paulus, npiggin, linuxppc-dev, Madhavan Srinivasan
In-Reply-To: <1479146692-15726-1-git-send-email-maddy@linux.vnet.ibm.com>
To support disabling and enabling of irq with PMI, set of
new powerpc_local_irq_pmu_save() and powerpc_local_irq_restore()
functions are added. And powerpc_local_irq_save() implemented,
by adding a new soft_enabled manipulation function soft_enabled_or_return().
Local_irq_pmu_* macros are provided to access these powerpc_local_irq_pmu*
functions which includes trace_hardirqs_on|off() to match what we
have in include/linux/irqflags.h.
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/hw_irq.h | 62 ++++++++++++++++++++++++++++++++++++++-
arch/powerpc/kernel/irq.c | 4 +++
2 files changed, 65 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index ac9a17ea1d66..7be90b73a943 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -90,6 +90,20 @@ static inline notrace unsigned long soft_enabled_set_return(unsigned long enable
return flags;
}
+static inline notrace unsigned long soft_enabled_or_return(unsigned long enable)
+{
+ unsigned long flags, zero;
+
+ asm volatile(
+ "mr %1,%3; lbz %0,%2(13); or %1,%0,%1; stb %1,%2(13)"
+ : "=r" (flags), "=&r"(zero)
+ : "i" (offsetof(struct paca_struct, soft_enabled)),\
+ "r" (enable)
+ : "memory");
+
+ return flags;
+}
+
static inline unsigned long arch_local_save_flags(void)
{
return soft_enabled_return();
@@ -114,7 +128,7 @@ static inline unsigned long arch_local_irq_save(void)
static inline bool arch_irqs_disabled_flags(unsigned long flags)
{
- return flags == IRQ_DISABLE_MASK_LINUX;
+ return flags & IRQ_DISABLE_MASK_LINUX;
}
static inline bool arch_irqs_disabled(void)
@@ -122,6 +136,52 @@ static inline bool arch_irqs_disabled(void)
return arch_irqs_disabled_flags(arch_local_save_flags());
}
+/*
+ * To support disabling and enabling of irq with PMI, set of
+ * new powerpc_local_irq_pmu_save() and powerpc_local_irq_restore()
+ * functions are added. These macros are implemented using generic
+ * linux local_irq_* code from include/linux/irqflags.h.
+ */
+#define raw_local_irq_pmu_save(flags) \
+ do { \
+ typecheck(unsigned long, flags); \
+ flags = soft_enabled_or_return(IRQ_DISABLE_MASK_LINUX | \
+ IRQ_DISABLE_MASK_PMU); \
+ } while(0)
+
+#define raw_local_irq_pmu_restore(flags) \
+ do { \
+ typecheck(unsigned long, flags); \
+ arch_local_irq_restore(flags); \
+ } while(0)
+
+#ifdef CONFIG_TRACE_IRQFLAGS
+#define powerpc_local_irq_pmu_save(flags) \
+ do { \
+ raw_local_irq_pmu_save(flags); \
+ trace_hardirqs_off(); \
+ } while(0)
+#define powerpc_local_irq_pmu_restore(flags) \
+ do { \
+ if (raw_irqs_disabled_flags(flags)) { \
+ raw_local_irq_pmu_restore(flags); \
+ trace_hardirqs_off(); \
+ } else { \
+ trace_hardirqs_on(); \
+ raw_local_irq_pmu_restore(flags); \
+ } \
+ } while(0)
+#else
+#define powerpc_local_irq_pmu_save(flags) \
+ do { \
+ raw_local_irq_pmu_save(flags); \
+ } while(0)
+#define powerpc_local_irq_pmu_restore(flags) \
+ do { \
+ raw_local_irq_pmu_restore(flags); \
+ } while (0)
+#endif /* CONFIG_TRACE_IRQFLAGS */
+
#ifdef CONFIG_PPC_BOOK3E
#define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory")
#define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory")
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 299b55071612..9010f996e238 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -227,6 +227,10 @@ notrace void arch_local_irq_restore(unsigned long en)
unsigned char irq_happened;
unsigned int replay;
+#ifdef CONFIG_IRQ_DEBUG_SUPPORT
+ WARN_ON(en & local_paca->soft_enabled & ~IRQ_DISABLE_MASK_LINUX);
+#endif
+
/* Write the new soft-enabled value */
soft_enabled_set(en);
--
2.7.4
^ permalink raw reply related
* [PATCH v3 08/11] powerpc: Add support to mask perf interrupts and replay them
From: Madhavan Srinivasan @ 2016-11-14 18:04 UTC (permalink / raw)
To: mpe, benh; +Cc: anton, paulus, npiggin, linuxppc-dev, Madhavan Srinivasan
In-Reply-To: <1479146692-15726-1-git-send-email-maddy@linux.vnet.ibm.com>
New bit mask field "IRQ_DISABLE_MASK_PMU" is introduced to support
the masking of PMI.
Couple of new irq #defs "PACA_IRQ_PMI" and "SOFTEN_VALUE_0xf0*" added to
use in the exception code to check for PMI interrupts.
In the masked_interrupt handler, for PMIs we reset the MSR[EE]
and return. In the __check_irq_replay(), replay the PMI interrupt
by calling performance_monitor_common handler.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/exception-64s.h | 5 +++++
arch/powerpc/include/asm/hw_irq.h | 2 ++
arch/powerpc/kernel/entry_64.S | 5 +++++
arch/powerpc/kernel/exceptions-64s.S | 6 ++++--
arch/powerpc/kernel/irq.c | 25 ++++++++++++++++++++++++-
5 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index ac0b8a25d9e6..8033f3950970 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -422,6 +422,7 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
#define SOFTEN_VALUE_0xe80 PACA_IRQ_DBELL
#define SOFTEN_VALUE_0xe60 PACA_IRQ_HMI
#define SOFTEN_VALUE_0xea0 PACA_IRQ_EE
+#define SOFTEN_VALUE_0xf00 PACA_IRQ_PMI
#define __SOFTEN_TEST(h, vec, bitmask) \
lbz r10,PACASOFTIRQEN(r13); \
@@ -486,6 +487,10 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
_MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, \
EXC_STD, SOFTEN_NOTEST_PR, bitmask)
+#define MASKABLE_RELON_EXCEPTION_PSERIES_OOL(vec, label, bitmask) \
+ MASKABLE_EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_PR, vec, bitmask);\
+ EXCEPTION_PROLOG_PSERIES_1(label, EXC_STD);
+
#define MASKABLE_RELON_EXCEPTION_HV(loc, vec, label, bitmask) \
_MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, \
EXC_HV, SOFTEN_NOTEST_HV, bitmask)
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 8359fbf83376..ac9a17ea1d66 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -26,12 +26,14 @@
#define PACA_IRQ_DEC 0x08 /* Or FIT */
#define PACA_IRQ_EE_EDGE 0x10 /* BookE only */
#define PACA_IRQ_HMI 0x20
+#define PACA_IRQ_PMI 0x40
/*
* flags for paca->soft_enabled
*/
#define IRQ_DISABLE_MASK_NONE 0
#define IRQ_DISABLE_MASK_LINUX 1
+#define IRQ_DISABLE_MASK_PMU 2
#endif /* CONFIG_PPC64 */
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index f3afa0b9332d..d021f7de79bd 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -931,6 +931,11 @@ restore_check_irq_replay:
addi r3,r1,STACK_FRAME_OVERHEAD;
bl do_IRQ
b ret_from_except
+1: cmpwi cr0,r3,0xf00
+ bne 1f
+ addi r3,r1,STACK_FRAME_OVERHEAD;
+ bl performance_monitor_exception
+ b ret_from_except
1: cmpwi cr0,r3,0xe60
bne 1f
addi r3,r1,STACK_FRAME_OVERHEAD;
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index adddaa8258b9..3718f1d13707 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -1036,8 +1036,8 @@ EXC_REAL_NONE(0xec0, 0xf00)
EXC_VIRT_NONE(0x4ec0, 0x4f00)
-EXC_REAL_OOL(performance_monitor, 0xf00, 0xf20)
-EXC_VIRT_OOL(performance_monitor, 0x4f00, 0x4f20, 0xf00)
+EXC_REAL_OOL_MASKABLE(performance_monitor, 0xf00, 0xf20, IRQ_DISABLE_MASK_PMU)
+EXC_VIRT_OOL_MASKABLE(performance_monitor, 0x4f00, 0x4f20, 0xf00, IRQ_DISABLE_MASK_PMU)
TRAMP_KVM(PACA_EXGEN, 0xf00)
EXC_COMMON_ASYNC(performance_monitor_common, 0xf00, performance_monitor_exception)
@@ -1575,6 +1575,8 @@ _GLOBAL(__replay_interrupt)
beq decrementer_common
cmpwi r3,0x500
beq hardware_interrupt_common
+ cmpwi r3,0xf00
+ beq performance_monitor_common
BEGIN_FTR_SECTION
cmpwi r3,0xe80
beq h_doorbell_common
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 5a995183dafb..c030ccd0a7aa 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -169,6 +169,27 @@ notrace unsigned int __check_irq_replay(void)
if ((happened & PACA_IRQ_DEC) || decrementer_check_overflow())
return 0x900;
+ /*
+ * In masked_handler() for PMI, we disable MSR[EE] and return.
+ * Replay it here.
+ *
+ * After this point, PMIs could still be disabled in certain
+ * scenarios like this one.
+ *
+ * local_irq_disable();
+ * powerpc_irq_pmu_save();
+ * powerpc_irq_pmu_restore();
+ * local_irq_restore();
+ *
+ * Even though powerpc_irq_pmu_restore() would have replayed the PMIs
+ * if any, we have still not enabled EE and this will happen only at
+ * complition of last *_restore in this nested cases. And PMIs will
+ * once again start firing only when we have MSR[EE] enabled.
+ */
+ local_paca->irq_happened &= ~PACA_IRQ_PMI;
+ if (happened & PACA_IRQ_PMI)
+ return 0xf00;
+
/* Finally check if an external interrupt happened */
local_paca->irq_happened &= ~PACA_IRQ_EE;
if (happened & PACA_IRQ_EE)
@@ -208,7 +229,9 @@ notrace void arch_local_irq_restore(unsigned long en)
/* Write the new soft-enabled value */
soft_enabled_set(en);
- if (en == IRQ_DISABLE_MASK_LINUX)
+
+ /* any bits still disabled */
+ if (en)
return;
/*
* From this point onward, we can take interrupts, preempt,
--
2.7.4
^ permalink raw reply related
* [PATCH v3 07/11] powerpc: Add support to take additional parameter in MASKABLE_* macro
From: Madhavan Srinivasan @ 2016-11-14 18:04 UTC (permalink / raw)
To: mpe, benh; +Cc: anton, paulus, npiggin, linuxppc-dev, Madhavan Srinivasan
In-Reply-To: <1479146692-15726-1-git-send-email-maddy@linux.vnet.ibm.com>
To support addition of "bitmask" to MASKABLE_* macros,
factor out the EXCPETION_PROLOG_1 macro.
Currently soft_enabled is used as the flag to determine
the interrupt state. Patch extends the soft_enabled
to be used as a mask instead of a flag.
Make it explicit the interrupt masking supported
by a gievn interrupt handler. Patch correspondingly
extends the MASKABLE_* macros with an addition's parameter.
"bitmask" parameter is passed to SOFTEN_TEST macro to decide
on masking the interrupt.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/exception-64s.h | 94 ++++++++++++++++++++------------
arch/powerpc/include/asm/head-64.h | 40 +++++++-------
arch/powerpc/include/asm/irqflags.h | 4 +-
arch/powerpc/kernel/entry_64.S | 4 +-
arch/powerpc/kernel/exceptions-64e.S | 6 +-
arch/powerpc/kernel/exceptions-64s.S | 32 ++++++-----
6 files changed, 104 insertions(+), 76 deletions(-)
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index bcd5a7f7dafe..ac0b8a25d9e6 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -166,18 +166,40 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
std r10,area+EX_R10(r13); /* save r10 - r12 */ \
OPT_GET_SPR(r10, SPRN_CFAR, CPU_FTR_CFAR)
-#define __EXCEPTION_PROLOG_1(area, extra, vec) \
+#define __EXCEPTION_PROLOG_1_PRE(area) \
OPT_SAVE_REG_TO_PACA(area+EX_PPR, r9, CPU_FTR_HAS_PPR); \
OPT_SAVE_REG_TO_PACA(area+EX_CFAR, r10, CPU_FTR_CFAR); \
SAVE_CTR(r10, area); \
- mfcr r9; \
- extra(vec); \
+ mfcr r9;
+
+#define __EXCEPTION_PROLOG_1_POST(area) \
std r11,area+EX_R11(r13); \
std r12,area+EX_R12(r13); \
GET_SCRATCH0(r10); \
std r10,area+EX_R13(r13)
+
+/*
+ * This version of the EXCEPTION_PROLOG_1 will carry
+ * addition parameter called "bitmask" to support
+ * checking of the interrupt maskable level in the SOFTEN_TEST.
+ * Intended to be used in MASKABLE_EXCPETION_* macros.
+ */
+#define MASKABLE_EXCEPTION_PROLOG_1(area, extra, vec, bitmask) \
+ __EXCEPTION_PROLOG_1_PRE(area); \
+ extra(vec, bitmask); \
+ __EXCEPTION_PROLOG_1_POST(area);
+
+/*
+ * This version of the EXCEPTION_PROLOG_1 is intended
+ * to be used in STD_EXCEPTION* macros
+ */
+#define _EXCEPTION_PROLOG_1(area, extra, vec) \
+ __EXCEPTION_PROLOG_1_PRE(area); \
+ extra(vec); \
+ __EXCEPTION_PROLOG_1_POST(area);
+
#define EXCEPTION_PROLOG_1(area, extra, vec) \
- __EXCEPTION_PROLOG_1(area, extra, vec)
+ _EXCEPTION_PROLOG_1(area, extra, vec)
#define __EXCEPTION_PROLOG_PSERIES_1(label, h) \
ld r10,PACAKMSR(r13); /* get MSR value for kernel */ \
@@ -401,21 +423,21 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
#define SOFTEN_VALUE_0xe60 PACA_IRQ_HMI
#define SOFTEN_VALUE_0xea0 PACA_IRQ_EE
-#define __SOFTEN_TEST(h, vec) \
+#define __SOFTEN_TEST(h, vec, bitmask) \
lbz r10,PACASOFTIRQEN(r13); \
- cmpwi r10,IRQ_DISABLE_MASK_LINUX; \
+ andi. r10,r10,bitmask; \
li r10,SOFTEN_VALUE_##vec; \
- beq masked_##h##interrupt
+ bne masked_##h##interrupt
-#define _SOFTEN_TEST(h, vec) __SOFTEN_TEST(h, vec)
+#define _SOFTEN_TEST(h, vec, bitmask) __SOFTEN_TEST(h, vec, bitmask)
-#define SOFTEN_TEST_PR(vec) \
+#define SOFTEN_TEST_PR(vec, bitmask) \
KVMTEST(EXC_STD, vec); \
- _SOFTEN_TEST(EXC_STD, vec)
+ _SOFTEN_TEST(EXC_STD, vec, bitmask)
-#define SOFTEN_TEST_HV(vec) \
+#define SOFTEN_TEST_HV(vec, bitmask) \
KVMTEST(EXC_HV, vec); \
- _SOFTEN_TEST(EXC_HV, vec)
+ _SOFTEN_TEST(EXC_HV, vec, bitmask)
#define KVMTEST_PR(vec) \
KVMTEST(EXC_STD, vec)
@@ -423,53 +445,53 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
#define KVMTEST_HV(vec) \
KVMTEST(EXC_HV, vec)
-#define SOFTEN_NOTEST_PR(vec) _SOFTEN_TEST(EXC_STD, vec)
-#define SOFTEN_NOTEST_HV(vec) _SOFTEN_TEST(EXC_HV, vec)
+#define SOFTEN_NOTEST_PR(vec, bitmask) _SOFTEN_TEST(EXC_STD, vec, bitmask)
+#define SOFTEN_NOTEST_HV(vec, bitmask) _SOFTEN_TEST(EXC_HV, vec, bitmask)
-#define __MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra) \
+#define __MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra, bitmask) \
SET_SCRATCH0(r13); /* save r13 */ \
EXCEPTION_PROLOG_0(PACA_EXGEN); \
- __EXCEPTION_PROLOG_1(PACA_EXGEN, extra, vec); \
+ MASKABLE_EXCEPTION_PROLOG_1(PACA_EXGEN, extra, vec, bitmask); \
EXCEPTION_PROLOG_PSERIES_1(label, h);
-#define _MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra) \
- __MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra)
+#define _MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra, bitmask) \
+ __MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra, bitmask)
-#define MASKABLE_EXCEPTION_PSERIES(loc, vec, label) \
+#define MASKABLE_EXCEPTION_PSERIES(loc, vec, label, bitmask) \
_MASKABLE_EXCEPTION_PSERIES(vec, label, \
- EXC_STD, SOFTEN_TEST_PR)
+ EXC_STD, SOFTEN_TEST_PR, bitmask)
-#define MASKABLE_EXCEPTION_PSERIES_OOL(vec, label) \
- __EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_TEST_PR, vec); \
+#define MASKABLE_EXCEPTION_PSERIES_OOL(vec, label, bitmask) \
+ MASKABLE_EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_TEST_PR, vec, bitmask);\
EXCEPTION_PROLOG_PSERIES_1(label, EXC_STD)
-#define MASKABLE_EXCEPTION_HV(loc, vec, label) \
+#define MASKABLE_EXCEPTION_HV(loc, vec, label, bitmask) \
_MASKABLE_EXCEPTION_PSERIES(vec, label, \
- EXC_HV, SOFTEN_TEST_HV)
+ EXC_HV, SOFTEN_TEST_HV, bitmask)
-#define MASKABLE_EXCEPTION_HV_OOL(vec, label) \
- __EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_TEST_HV, vec); \
+#define MASKABLE_EXCEPTION_HV_OOL(vec, label, bitmask) \
+ MASKABLE_EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_TEST_HV, vec, bitmask);\
EXCEPTION_PROLOG_PSERIES_1(label, EXC_HV)
-#define __MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra) \
+#define __MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra, bitmask)\
SET_SCRATCH0(r13); /* save r13 */ \
EXCEPTION_PROLOG_0(PACA_EXGEN); \
- __EXCEPTION_PROLOG_1(PACA_EXGEN, extra, vec); \
+ MASKABLE_EXCEPTION_PROLOG_1(PACA_EXGEN, extra, vec, bitmask); \
EXCEPTION_RELON_PROLOG_PSERIES_1(label, h)
-#define _MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra) \
- __MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra)
+#define _MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra, bitmask)\
+ __MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra, bitmask)
-#define MASKABLE_RELON_EXCEPTION_PSERIES(loc, vec, label) \
+#define MASKABLE_RELON_EXCEPTION_PSERIES(loc, vec, label, bitmask) \
_MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, \
- EXC_STD, SOFTEN_NOTEST_PR)
+ EXC_STD, SOFTEN_NOTEST_PR, bitmask)
-#define MASKABLE_RELON_EXCEPTION_HV(loc, vec, label) \
+#define MASKABLE_RELON_EXCEPTION_HV(loc, vec, label, bitmask) \
_MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, \
- EXC_HV, SOFTEN_NOTEST_HV)
+ EXC_HV, SOFTEN_NOTEST_HV, bitmask)
-#define MASKABLE_RELON_EXCEPTION_HV_OOL(vec, label) \
- __EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_HV, vec); \
+#define MASKABLE_RELON_EXCEPTION_HV_OOL(vec, label, bitmask) \
+ MASKABLE_EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_HV, vec, bitmask);\
EXCEPTION_PROLOG_PSERIES_1(label, EXC_HV)
/*
diff --git a/arch/powerpc/include/asm/head-64.h b/arch/powerpc/include/asm/head-64.h
index ab90c2fa1ea6..eefadbb0b45c 100644
--- a/arch/powerpc/include/asm/head-64.h
+++ b/arch/powerpc/include/asm/head-64.h
@@ -242,14 +242,14 @@ end_##sname:
STD_RELON_EXCEPTION_PSERIES(start, realvec, name##_common); \
EXC_VIRT_END(name, start, end);
-#define EXC_REAL_MASKABLE(name, start, end) \
+#define EXC_REAL_MASKABLE(name, start, end, bitmask) \
EXC_REAL_BEGIN(name, start, end); \
- MASKABLE_EXCEPTION_PSERIES(start, start, name##_common); \
+ MASKABLE_EXCEPTION_PSERIES(start, start, name##_common, bitmask); \
EXC_REAL_END(name, start, end);
-#define EXC_VIRT_MASKABLE(name, start, end, realvec) \
+#define EXC_VIRT_MASKABLE(name, start, end, realvec, bitmask) \
EXC_VIRT_BEGIN(name, start, end); \
- MASKABLE_RELON_EXCEPTION_PSERIES(start, realvec, name##_common); \
+ MASKABLE_RELON_EXCEPTION_PSERIES(start, realvec, name##_common, bitmask); \
EXC_VIRT_END(name, start, end);
#define EXC_REAL_HV(name, start, end) \
@@ -278,13 +278,13 @@ end_##sname:
#define __EXC_REAL_OOL_MASKABLE(name, start, end) \
__EXC_REAL_OOL(name, start, end);
-#define __TRAMP_REAL_REAL_OOL_MASKABLE(name, vec) \
+#define __TRAMP_REAL_REAL_OOL_MASKABLE(name, vec, bitmask) \
TRAMP_REAL_BEGIN(tramp_real_##name); \
- MASKABLE_EXCEPTION_PSERIES_OOL(vec, name##_common); \
+ MASKABLE_EXCEPTION_PSERIES_OOL(vec, name##_common, bitmask); \
-#define EXC_REAL_OOL_MASKABLE(name, start, end) \
+#define EXC_REAL_OOL_MASKABLE(name, start, end, bitmask) \
__EXC_REAL_OOL_MASKABLE(name, start, end); \
- __TRAMP_REAL_REAL_OOL_MASKABLE(name, start);
+ __TRAMP_REAL_REAL_OOL_MASKABLE(name, start, bitmask);
#define __EXC_REAL_OOL_HV_DIRECT(name, start, end, handler) \
EXC_REAL_BEGIN(name, start, end); \
@@ -305,13 +305,13 @@ end_##sname:
#define __EXC_REAL_OOL_MASKABLE_HV(name, start, end) \
__EXC_REAL_OOL(name, start, end);
-#define __TRAMP_REAL_REAL_OOL_MASKABLE_HV(name, vec) \
+#define __TRAMP_REAL_REAL_OOL_MASKABLE_HV(name, vec, bitmask) \
TRAMP_REAL_BEGIN(tramp_real_##name); \
- MASKABLE_EXCEPTION_HV_OOL(vec, name##_common); \
+ MASKABLE_EXCEPTION_HV_OOL(vec, name##_common, bitmask); \
-#define EXC_REAL_OOL_MASKABLE_HV(name, start, end) \
+#define EXC_REAL_OOL_MASKABLE_HV(name, start, end, bitmask) \
__EXC_REAL_OOL_MASKABLE_HV(name, start, end); \
- __TRAMP_REAL_REAL_OOL_MASKABLE_HV(name, start);
+ __TRAMP_REAL_REAL_OOL_MASKABLE_HV(name, start, bitmask);
#define __EXC_VIRT_OOL(name, start, end) \
EXC_VIRT_BEGIN(name, start, end); \
@@ -329,13 +329,13 @@ end_##sname:
#define __EXC_VIRT_OOL_MASKABLE(name, start, end) \
__EXC_VIRT_OOL(name, start, end);
-#define __TRAMP_REAL_VIRT_OOL_MASKABLE(name, realvec) \
+#define __TRAMP_REAL_VIRT_OOL_MASKABLE(name, realvec, bitmask) \
TRAMP_VIRT_BEGIN(tramp_virt_##name); \
- MASKABLE_RELON_EXCEPTION_PSERIES_OOL(realvec, name##_common); \
+ MASKABLE_RELON_EXCEPTION_PSERIES_OOL(realvec, name##_common, bitmask); \
-#define EXC_VIRT_OOL_MASKABLE(name, start, end, realvec) \
+#define EXC_VIRT_OOL_MASKABLE(name, start, end, realvec, bitmask) \
__EXC_VIRT_OOL_MASKABLE(name, start, end); \
- __TRAMP_REAL_VIRT_OOL_MASKABLE(name, realvec);
+ __TRAMP_REAL_VIRT_OOL_MASKABLE(name, realvec, bitmask);
#define __EXC_VIRT_OOL_HV(name, start, end) \
__EXC_VIRT_OOL(name, start, end);
@@ -351,13 +351,13 @@ end_##sname:
#define __EXC_VIRT_OOL_MASKABLE_HV(name, start, end) \
__EXC_VIRT_OOL(name, start, end);
-#define __TRAMP_REAL_VIRT_OOL_MASKABLE_HV(name, realvec) \
+#define __TRAMP_REAL_VIRT_OOL_MASKABLE_HV(name, realvec, bitmask) \
TRAMP_VIRT_BEGIN(tramp_virt_##name); \
- MASKABLE_RELON_EXCEPTION_HV_OOL(realvec, name##_common); \
+ MASKABLE_RELON_EXCEPTION_HV_OOL(realvec, name##_common, bitmask); \
-#define EXC_VIRT_OOL_MASKABLE_HV(name, start, end, realvec) \
+#define EXC_VIRT_OOL_MASKABLE_HV(name, start, end, realvec, bitmask) \
__EXC_VIRT_OOL_MASKABLE_HV(name, start, end); \
- __TRAMP_REAL_VIRT_OOL_MASKABLE_HV(name, realvec);
+ __TRAMP_REAL_VIRT_OOL_MASKABLE_HV(name, realvec, bitmask);
#define TRAMP_KVM(area, n) \
TRAMP_KVM_BEGIN(do_kvm_##n); \
diff --git a/arch/powerpc/include/asm/irqflags.h b/arch/powerpc/include/asm/irqflags.h
index d0ed2a7d7d10..9ff09747a226 100644
--- a/arch/powerpc/include/asm/irqflags.h
+++ b/arch/powerpc/include/asm/irqflags.h
@@ -48,11 +48,11 @@
#define RECONCILE_IRQ_STATE(__rA, __rB) \
lbz __rA,PACASOFTIRQEN(r13); \
lbz __rB,PACAIRQHAPPENED(r13); \
- cmpwi cr0,__rA,IRQ_DISABLE_MASK_LINUX;\
+ andi. __rA,__rA,IRQ_DISABLE_MASK_LINUX;\
li __rA,IRQ_DISABLE_MASK_LINUX; \
ori __rB,__rB,PACA_IRQ_HARD_DIS; \
stb __rB,PACAIRQHAPPENED(r13); \
- beq 44f; \
+ bne 44f; \
stb __rA,PACASOFTIRQEN(r13); \
TRACE_DISABLE_INTS; \
44:
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 7ef3064ddde1..f3afa0b9332d 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -763,8 +763,8 @@ restore:
*/
ld r5,SOFTE(r1)
lbz r6,PACASOFTIRQEN(r13)
- cmpwi cr0,r5,IRQ_DISABLE_MASK_LINUX
- beq restore_irq_off
+ andi. r5,r5,IRQ_DISABLE_MASK_LINUX
+ bne restore_irq_off
/* We are enabling, were we already enabled ? Yes, just return */
cmpwi cr0,r6,IRQ_DISABLE_MASK_NONE
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index a39226c502c5..835c971b45e4 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -212,8 +212,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
/* Interrupts had better not already be enabled... */
twnei r6,IRQ_DISABLE_MASK_LINUX
- cmpwi cr0,r5,IRQ_DISABLE_MASK_LINUX
- beq 1f
+ andi. r5,r5,IRQ_DISABLE_MASK_LINUX
+ bne 1f
TRACE_ENABLE_INTS
stb r5,PACASOFTIRQEN(r13)
@@ -352,7 +352,7 @@ ret_from_mc_except:
#define PROLOG_ADDITION_MASKABLE_GEN(n) \
lbz r10,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \
- cmpwi cr0,r10,IRQ_DISABLE_MASK_LINUX; /* yes -> go out of line */ \
+ andi. r10,r10,IRQ_DISABLE_MASK_LINUX; /* yes -> go out of line */ \
beq masked_interrupt_book3e_##n
#define PROLOG_ADDITION_2REGS_GEN(n) \
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 08ba447a4b3d..adddaa8258b9 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -711,12 +711,14 @@ EXC_REAL_BEGIN(hardware_interrupt, 0x500, 0x600)
hardware_interrupt_hv:
BEGIN_FTR_SECTION
_MASKABLE_EXCEPTION_PSERIES(0x500, hardware_interrupt_common,
- EXC_HV, SOFTEN_TEST_HV)
+ EXC_HV, SOFTEN_TEST_HV,
+ IRQ_DISABLE_MASK_LINUX)
do_kvm_H0x500:
KVM_HANDLER(PACA_EXGEN, EXC_HV, 0x502)
FTR_SECTION_ELSE
_MASKABLE_EXCEPTION_PSERIES(0x500, hardware_interrupt_common,
- EXC_STD, SOFTEN_TEST_PR)
+ EXC_STD, SOFTEN_TEST_PR,
+ IRQ_DISABLE_MASK_LINUX)
do_kvm_0x500:
KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x500)
ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
@@ -726,9 +728,13 @@ EXC_VIRT_BEGIN(hardware_interrupt, 0x4500, 0x4600)
.globl hardware_interrupt_relon_hv;
hardware_interrupt_relon_hv:
BEGIN_FTR_SECTION
- _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt_common, EXC_HV, SOFTEN_TEST_HV)
+ _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt_common,
+ EXC_HV, SOFTEN_TEST_HV,
+ IRQ_DISABLE_MASK_LINUX)
FTR_SECTION_ELSE
- _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt_common, EXC_STD, SOFTEN_TEST_PR)
+ _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt_common,
+ EXC_STD, SOFTEN_TEST_PR,
+ IRQ_DISABLE_MASK_LINUX)
ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
EXC_VIRT_END(hardware_interrupt, 0x4500, 0x4600)
@@ -800,8 +806,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_TM)
#endif
-EXC_REAL_MASKABLE(decrementer, 0x900, 0x980)
-EXC_VIRT_MASKABLE(decrementer, 0x4900, 0x4980, 0x900)
+EXC_REAL_MASKABLE(decrementer, 0x900, 0x980, IRQ_DISABLE_MASK_LINUX)
+EXC_VIRT_MASKABLE(decrementer, 0x4900, 0x4980, 0x900, IRQ_DISABLE_MASK_LINUX)
TRAMP_KVM(PACA_EXGEN, 0x900)
EXC_COMMON_ASYNC(decrementer_common, 0x900, timer_interrupt)
@@ -812,8 +818,8 @@ TRAMP_KVM_HV(PACA_EXGEN, 0x980)
EXC_COMMON(hdecrementer_common, 0x980, hdec_interrupt)
-EXC_REAL_MASKABLE(doorbell_super, 0xa00, 0xb00)
-EXC_VIRT_MASKABLE(doorbell_super, 0x4a00, 0x4b00, 0xa00)
+EXC_REAL_MASKABLE(doorbell_super, 0xa00, 0xb00, IRQ_DISABLE_MASK_LINUX)
+EXC_VIRT_MASKABLE(doorbell_super, 0x4a00, 0x4b00, 0xa00, IRQ_DISABLE_MASK_LINUX)
TRAMP_KVM(PACA_EXGEN, 0xa00)
#ifdef CONFIG_PPC_DOORBELL
EXC_COMMON_ASYNC(doorbell_super_common, 0xa00, doorbell_exception)
@@ -955,7 +961,7 @@ EXC_COMMON(emulation_assist_common, 0xe40, emulation_assist_interrupt)
* mode.
*/
__EXC_REAL_OOL_HV_DIRECT(hmi_exception, 0xe60, 0xe80, hmi_exception_early)
-__TRAMP_REAL_REAL_OOL_MASKABLE_HV(hmi_exception, 0xe60)
+__TRAMP_REAL_REAL_OOL_MASKABLE_HV(hmi_exception, 0xe60, IRQ_DISABLE_MASK_LINUX)
EXC_VIRT_NONE(0x4e60, 0x4e80)
TRAMP_KVM_HV(PACA_EXGEN, 0xe60)
TRAMP_REAL_BEGIN(hmi_exception_early)
@@ -1010,8 +1016,8 @@ hmi_exception_after_realmode:
EXC_COMMON_ASYNC(hmi_exception_common, 0xe60, handle_hmi_exception)
-EXC_REAL_OOL_MASKABLE_HV(h_doorbell, 0xe80, 0xea0)
-EXC_VIRT_OOL_MASKABLE_HV(h_doorbell, 0x4e80, 0x4ea0, 0xe80)
+EXC_REAL_OOL_MASKABLE_HV(h_doorbell, 0xe80, 0xea0, IRQ_DISABLE_MASK_LINUX)
+EXC_VIRT_OOL_MASKABLE_HV(h_doorbell, 0x4e80, 0x4ea0, 0xe80, IRQ_DISABLE_MASK_LINUX)
TRAMP_KVM_HV(PACA_EXGEN, 0xe80)
#ifdef CONFIG_PPC_DOORBELL
EXC_COMMON_ASYNC(h_doorbell_common, 0xe80, doorbell_exception)
@@ -1020,8 +1026,8 @@ EXC_COMMON_ASYNC(h_doorbell_common, 0xe80, unknown_exception)
#endif
-EXC_REAL_OOL_MASKABLE_HV(h_virt_irq, 0xea0, 0xec0)
-EXC_VIRT_OOL_MASKABLE_HV(h_virt_irq, 0x4ea0, 0x4ec0, 0xea0)
+EXC_REAL_OOL_MASKABLE_HV(h_virt_irq, 0xea0, 0xec0, IRQ_DISABLE_MASK_LINUX)
+EXC_VIRT_OOL_MASKABLE_HV(h_virt_irq, 0x4ea0, 0x4ec0, 0xea0, IRQ_DISABLE_MASK_LINUX)
TRAMP_KVM_HV(PACA_EXGEN, 0xea0)
EXC_COMMON_ASYNC(h_virt_irq_common, 0xea0, do_IRQ)
--
2.7.4
^ permalink raw reply related
* [PATCH v3 05/11] powerpc: reverse the soft_enable logic
From: Madhavan Srinivasan @ 2016-11-14 18:04 UTC (permalink / raw)
To: mpe, benh; +Cc: anton, paulus, npiggin, linuxppc-dev, Madhavan Srinivasan
In-Reply-To: <1479146692-15726-1-git-send-email-maddy@linux.vnet.ibm.com>
"paca->soft_enabled" is used as a flag to mask some of interrupts.
Currently supported flags values and their details:
soft_enabled MSR[EE]
0 0 Disabled (PMI and HMI not masked)
1 1 Enabled
"paca->soft_enabled" is initialized to 1 to make the interripts as
enabled. arch_local_irq_disable() will toggle the value when interrupts
needs to disbled. At this point, the interrupts are not actually disabled,
instead, interrupt vector has code to check for the flag and mask it when it occurs.
By "mask it", it update interrupt paca->irq_happened and return.
arch_local_irq_restore() is called to re-enable interrupts, which checks and
replays interrupts if any occured.
Now, as mentioned, current logic doesnot mask "performance monitoring interrupts"
and PMIs are implemented as NMI. But this patchset depends on local_irq_*
for a successful local_* update. Meaning, mask all possible interrupts during
local_* update and replay them after the update.
So the idea here is to reserve the "paca->soft_enabled" logic. New values and
details:
soft_enabled MSR[EE]
1 0 Disabled (PMI and HMI not masked)
0 1 Enabled
Reason for the this change is to create foundation for a third mask value "0x2"
for "soft_enabled" to add support to mask PMIs. When ->soft_enabled is
set to a value "3", PMI interrupts are mask and when set to a value
of "1", PMI are not mask.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/hw_irq.h | 4 ++--
arch/powerpc/kernel/entry_64.S | 5 ++---
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index c292ef4b4bc5..8359fbf83376 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -30,8 +30,8 @@
/*
* flags for paca->soft_enabled
*/
-#define IRQ_DISABLE_MASK_NONE 1
-#define IRQ_DISABLE_MASK_LINUX 0
+#define IRQ_DISABLE_MASK_NONE 0
+#define IRQ_DISABLE_MASK_LINUX 1
#endif /* CONFIG_PPC64 */
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 8e347ffca14e..7ef3064ddde1 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -132,8 +132,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
*/
#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_BUG)
lbz r10,PACASOFTIRQEN(r13)
- xori r10,r10,IRQ_DISABLE_MASK_NONE
-1: tdnei r10,0
+1: tdnei r10,IRQ_DISABLE_MASK_NONE
EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,BUGFLAG_WARNING
#endif
@@ -1010,7 +1009,7 @@ _GLOBAL(enter_rtas)
* check it with the asm equivalent of WARN_ON
*/
lbz r0,PACASOFTIRQEN(r13)
-1: tdnei r0,IRQ_DISABLE_MASK_LINUX
+1: tdeqi r0,IRQ_DISABLE_MASK_NONE
EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,BUGFLAG_WARNING
#endif
--
2.7.4
^ permalink raw reply related
* [PATCH v3 03/11] powerpc: Use soft_enabled_set api to update paca->soft_enabled
From: Madhavan Srinivasan @ 2016-11-14 18:04 UTC (permalink / raw)
To: mpe, benh; +Cc: anton, paulus, npiggin, linuxppc-dev, Madhavan Srinivasan
In-Reply-To: <1479146692-15726-1-git-send-email-maddy@linux.vnet.ibm.com>
Force use of soft_enabled_set() wrapper to update paca-soft_enabled
wherever possisble. Also add a new wrapper function, soft_enabled_set_return(),
added to force the paca->soft_enabled updates.
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/hw_irq.h | 14 ++++++++++++++
arch/powerpc/include/asm/kvm_ppc.h | 2 +-
arch/powerpc/kernel/irq.c | 2 +-
arch/powerpc/kernel/setup_64.c | 4 ++--
arch/powerpc/kernel/time.c | 6 +++---
5 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index ab1e6da7825c..88f6a8e2b5e3 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -62,6 +62,20 @@ static inline notrace void soft_enabled_set(unsigned long enable)
: "memory");
}
+static inline notrace unsigned long soft_enabled_set_return(unsigned long enable)
+{
+ unsigned long flags;
+
+ asm volatile(
+ "lbz %0,%1(13); stb %2,%1(13)"
+ : "=r" (flags)
+ : "i" (offsetof(struct paca_struct, soft_enabled)),\
+ "r" (enable)
+ : "memory");
+
+ return flags;
+}
+
static inline unsigned long arch_local_save_flags(void)
{
unsigned long flags;
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index 7d8d2b40c6a8..2263d2443d94 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -735,7 +735,7 @@ static inline void kvmppc_fix_ee_before_entry(void)
/* Only need to enable IRQs by hard enabling them after this */
local_paca->irq_happened = 0;
- local_paca->soft_enabled = IRQ_DISABLE_MASK_NONE;
+ soft_enabled_set(IRQ_DISABLE_MASK_NONE);
#endif
}
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 204fa51cdc9e..5a995183dafb 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -337,7 +337,7 @@ bool prep_irq_for_idle(void)
* of entering the low power state.
*/
local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS;
- local_paca->soft_enabled = IRQ_DISABLE_MASK_NONE;
+ soft_enabled_set(IRQ_DISABLE_MASK_NONE);
/* Tell the caller to enter the low power state */
return true;
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index f31930b9bfc1..f0f882166dcc 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -197,7 +197,7 @@ static void __init fixup_boot_paca(void)
/* Allow percpu accesses to work until we setup percpu data */
get_paca()->data_offset = 0;
/* Mark interrupts disabled in PACA */
- get_paca()->soft_enabled = IRQ_DISABLE_MASK_LINUX;
+ soft_enabled_set(IRQ_DISABLE_MASK_LINUX);
}
static void __init configure_exceptions(void)
@@ -334,7 +334,7 @@ void __init early_setup(unsigned long dt_ptr)
void early_setup_secondary(void)
{
/* Mark interrupts disabled in PACA */
- get_paca()->soft_enabled = 0;
+ soft_enabled_set(IRQ_DISABLE_MASK_LINUX);
/* Initialize the hash table or TLB handling */
early_init_mmu_secondary();
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 334144e300ca..42a39a2cea0a 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -260,7 +260,7 @@ static u64 scan_dispatch_log(u64 stop_tb)
void accumulate_stolen_time(void)
{
u64 sst, ust;
- u8 save_soft_enabled = local_paca->soft_enabled;
+ unsigned long save_soft_enabled;
struct cpu_accounting_data *acct = &local_paca->accounting;
/* We are called early in the exception entry, before
@@ -269,7 +269,7 @@ void accumulate_stolen_time(void)
* needs to reflect that so various debug stuff doesn't
* complain
*/
- local_paca->soft_enabled = IRQ_DISABLE_MASK_LINUX;
+ save_soft_enabled = soft_enabled_set_return(IRQ_DISABLE_MASK_LINUX);
sst = scan_dispatch_log(acct->starttime_user);
ust = scan_dispatch_log(acct->starttime);
@@ -277,7 +277,7 @@ void accumulate_stolen_time(void)
acct->user_time -= ust;
local_paca->stolen_time += ust + sst;
- local_paca->soft_enabled = save_soft_enabled;
+ soft_enabled_set(save_soft_enabled);
}
static inline u64 calculate_stolen_time(u64 stop_tb)
--
2.7.4
^ permalink raw reply related
* [PATCH v3 02/11] powerpc: move set_soft_enabled() and rename
From: Madhavan Srinivasan @ 2016-11-14 18:04 UTC (permalink / raw)
To: mpe, benh; +Cc: anton, paulus, npiggin, linuxppc-dev, Madhavan Srinivasan
In-Reply-To: <1479146692-15726-1-git-send-email-maddy@linux.vnet.ibm.com>
Move set_soft_enabled() from powerpc/kernel/irq.c to
asm/hw_irq.c, to force updates to paca-soft_enabled
done via these access function. Add "memory" clobber
to hint compiler since paca->soft_enabled memory is the target
here
Renaming it as soft_enabled_set() will make
namespaces works better as prefix than a postfix
when new soft_enabled manipulation functions introduced.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/hw_irq.h | 15 +++++++++++++++
arch/powerpc/kernel/irq.c | 12 +++---------
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 05b81bca15e9..ab1e6da7825c 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -47,6 +47,21 @@ extern void unknown_exception(struct pt_regs *regs);
#ifdef CONFIG_PPC64
#include <asm/paca.h>
+/*
+ *TODO:
+ * Currently none of the soft_eanbled modification helpers have clobbers
+ * for modifying the r13->soft_enabled memory itself. Secondly they only
+ * include "memory" clobber as a hint. Ideally, if all the accesses to
+ * soft_enabled go via these helpers, we could avoid the "memory" clobber.
+ * Former could be taken care by having location in the constraints.
+ */
+static inline notrace void soft_enabled_set(unsigned long enable)
+{
+ __asm__ __volatile__("stb %0,%1(13)"
+ : : "r" (enable), "i" (offsetof(struct paca_struct, soft_enabled))
+ : "memory");
+}
+
static inline unsigned long arch_local_save_flags(void)
{
unsigned long flags;
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index c6f1e13ff441..204fa51cdc9e 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -108,12 +108,6 @@ static inline notrace unsigned long get_irq_happened(void)
return happened;
}
-static inline notrace void set_soft_enabled(unsigned long enable)
-{
- __asm__ __volatile__("stb %0,%1(13)"
- : : "r" (enable), "i" (offsetof(struct paca_struct, soft_enabled)));
-}
-
static inline notrace int decrementer_check_overflow(void)
{
u64 now = get_tb_or_rtc();
@@ -213,7 +207,7 @@ notrace void arch_local_irq_restore(unsigned long en)
unsigned int replay;
/* Write the new soft-enabled value */
- set_soft_enabled(en);
+ soft_enabled_set(en);
if (en == IRQ_DISABLE_MASK_LINUX)
return;
/*
@@ -259,7 +253,7 @@ notrace void arch_local_irq_restore(unsigned long en)
}
#endif /* CONFIG_TRACE_IRQFLAGS */
- set_soft_enabled(IRQ_DISABLE_MASK_LINUX);
+ soft_enabled_set(IRQ_DISABLE_MASK_LINUX);
/*
* Check if anything needs to be re-emitted. We haven't
@@ -269,7 +263,7 @@ notrace void arch_local_irq_restore(unsigned long en)
replay = __check_irq_replay();
/* We can soft-enable now */
- set_soft_enabled(IRQ_DISABLE_MASK_NONE);
+ soft_enabled_set(IRQ_DISABLE_MASK_NONE);
/*
* And replay if we have to. This will return with interrupts
--
2.7.4
^ permalink raw reply related
* [PATCH v3 00/11]powerpc: "paca->soft_enabled" based local atomic operation implementation
From: Madhavan Srinivasan @ 2016-11-14 18:04 UTC (permalink / raw)
To: mpe, benh; +Cc: anton, paulus, npiggin, linuxppc-dev, Madhavan Srinivasan
Local atomic operations are fast and highly reentrant per CPU counters.
Used for percpu variable updates. Local atomic operations only guarantee
variable modification atomicity wrt the CPU which owns the data and
these needs to be executed in a preemption safe way.
Here is the design of the patchset. Since local_* operations
are only need to be atomic to interrupts (IIUC), we have two options.
Either replay the "op" if interrupted or replay the interrupt after
the "op". Initial patchset posted was based on implementing local_* operation
based on CR5 which replay's the "op". Patchset had issues in case of
rewinding the address pointor from an array. This make the slow patch
really slow. Since CR5 based implementation proposed using __ex_table to find
the rewind address, this rasied concerns about size of __ex_table and vmlinux.
https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-December/123115.html
But this patchset uses Benjamin Herrenschmidt suggestion of using
arch_local_irq_disable() to soft_disable interrupts (including PMIs).
After finishing the "op", arch_local_irq_restore() called and correspondingly
interrupts are replayed if any occured.
Current paca->soft_enabled logic is reserved and MASKABLE_EXCEPTION_* macros
are extended to support this feature.
patch re-write the current local_* functions to use arch_local_irq_disbale.
Base flow for each function is
{
powerpc_local_irq_pmu_save(flags)
load
..
store
powerpc_local_irq_pmu_restore(flags)
}
Reason for the approach is that, currently l[w/d]arx/st[w/d]cx.
instruction pair is used for local_* operations, which are heavy
on cycle count and they dont support a local variant. So to
see whether the new implementation helps, used a modified
version of Rusty's benchmark code on local_t.
https://lkml.org/lkml/2008/12/16/450
Modifications to Rusty's benchmark code:
- Executed only local_t test
Here are the values with the patch.
Time in ns per iteration
Local_t Without Patch With Patch
_inc 28 8
_add 28 8
_read 3 3
_add_return 28 7
Currently only asm/local.h has been rewrite, and also
the entire change is tested only in PPC64 (pseries guest)
and PPC64 LE host. Have only compile tested ppc64e_*.
First five are the clean up patches which lays the foundation
to make things easier. Fifth patch in the patchset reverse the
current soft_enabled logic and commit message details the reason and
need for this change. Six and seventh patch refactor's the __EXPECTION_PROLOG_1
code to support addition of a new parameter to MASKABLE_* macros. New parameter
will give the possible mask for the interrupt. Rest of the patches are
to add support for maskable PMI and implementation of local_t using powerpc_local_irq_pmu_*().
Since the patchset is experimental, testing done only on pseries and
powernv platforms. Have only compile tested the patchset for Book3e.
Other suggestions from Nick: (planned to be handled via separate follow up patchset):
1)Rename the soft_enabled to soft_disable_mask
2)builtin_constants for the soft_enabled manipulation functions
3)Update the proper clobber for "r13->soft_enabled" updates and add barriers()
to caller functions
Changelog v2:
Rebased to latest upstream
Changelog v1:
1)squashed patches 1/2 together and 8/9/10 together for readability
2)Created a separate patch for the kconfig changes
3)Moved the new mask value commit to patch 11.
4)Renamed local_irq_pmu_*() to powerpc_irq_pmu_*() to avoid
namespaces matches with generic kernel local_irq*() functions
5)Renamed __EXCEPTION_PROLOG_1 macro to MASKABLE_EXCEPTION_PROLOG_1 macro
6)Made changes to commit messages
7)Add more comments to codes
Changelog RFC v5:
1)Implemented new set of soft_enabled manipulation functions
2)rewritten arch_local_irq_* functions to use the new soft_enabled_*()
3)Add WARN_ON to identify invalid soft_enabled transitions
4)Added powerpc_local_irq_pmu_save() and powerpc_local_irq_pmu_restore() to
support masking of irqs (with PMI).
5)Added local_irq_pmu_*()s macros with trace_hardirqs_on|off() to match
include/linux/irqflags.h
Changelog RFC v4:
1)Fix build breaks in in ppc64e_defconfig compilation
2)Merged PMI replay code with the exception vector changes patch
3)Renamed the new API to set PMI mask bit as suggested
4)Modified the current arch_local_save and new API function call to
"OR" and store the value to ->soft_enabled instead of just store.
5)Updated the check in the arch_local_irq_restore() to alway check for
greather than or zero to _LINUX mask bit.
6)Updated the commit messages.
Changelog RFC v3:
1)Squashed PMI masked interrupt patch and replay patch together
2)Have created a new patch which includes a new Kconfig and set_irq_set_mask()
3)Fixed the compilation issue with IRQ_DISABLE_MASK_* macros in book3e_*
Changelog RFC v2:
1)Renamed IRQ_DISABLE_LEVEL_* to IRQ_DISABLE_MASK_* and made logic changes
to treat soft_enabled as a mask and not a flag or level.
2)Added a new Kconfig variable to support a WARN_ON
3)Refactored patchset for eaiser review.
4)Made changes to commit messages.
5)Made changes for BOOK3E version
Changelog RFC v1:
1)Commit messages are improved.
2)Renamed the arch_local_irq_disable_var to soft_irq_set_level as suggested
3)Renamed the LAZY_INTERRUPT* macro to IRQ_DISABLE_LEVEL_* as suggested
4)Extended the MASKABLE_EXCEPTION* macros to support additional parameter.
5)Each MASKABLE_EXCEPTION_* macro will carry a "mask_level"
6)Logic to decide on jump to maskable_handler in SOFTEN_TEST is now based on
"mask_level"
7)__EXCEPTION_PROLOG_1 is factored out to support "mask_level" parameter.
This reduced the code changes needed for supporting "mask_level" parameters.
Madhavan Srinivasan (11):
powerpc: Add #defs for paca->soft_enabled flags
powerpc: move set_soft_enabled() and rename
powerpc: Use soft_enabled_set api to update paca->soft_enabled
powerpc: Add soft_enabled manipulation functions
powerpc: reverse the soft_enable logic
powerpc: Avoid using EXCEPTION_PROLOG_1 macro in MASKABLE_*
powerpc: Add support to take additional parameter in MASKABLE_* macro
powerpc: Add support to mask perf interrupts and replay them
powerpc:Add new kconfig IRQ_DEBUG_SUPPORT
powerpc: Add new set of soft_enabled_ functions
powerpc: rewrite local_t using soft_irq
arch/powerpc/Kconfig | 4 +
arch/powerpc/include/asm/exception-64s.h | 99 +++++++++------
arch/powerpc/include/asm/head-64.h | 40 +++---
arch/powerpc/include/asm/hw_irq.h | 112 +++++++++++++++--
arch/powerpc/include/asm/irqflags.h | 8 +-
arch/powerpc/include/asm/kvm_ppc.h | 2 +-
arch/powerpc/include/asm/local.h | 201 +++++++++++++++++++++++++++++++
arch/powerpc/kernel/entry_64.S | 24 ++--
arch/powerpc/kernel/exceptions-64e.S | 8 +-
arch/powerpc/kernel/exceptions-64s.S | 38 +++---
arch/powerpc/kernel/head_64.S | 5 +-
arch/powerpc/kernel/idle_book3e.S | 3 +-
arch/powerpc/kernel/idle_power4.S | 3 +-
arch/powerpc/kernel/irq.c | 48 ++++++--
arch/powerpc/kernel/process.c | 3 +-
arch/powerpc/kernel/setup_64.c | 5 +-
arch/powerpc/kernel/time.c | 6 +-
arch/powerpc/mm/hugetlbpage.c | 2 +-
arch/powerpc/perf/core-book3s.c | 2 +-
19 files changed, 490 insertions(+), 123 deletions(-)
--
2.7.4
^ permalink raw reply
* Re: [PATCHSET] Add support for simplified async direct-io
From: Christoph Hellwig @ 2016-11-14 18:05 UTC (permalink / raw)
To: Jens Axboe; +Cc: Christoph Hellwig, axboe, linux-block
In-Reply-To: <4f30a528-9996-4c6a-9513-8aa2054e4d4b@fb.com>
On Mon, Nov 14, 2016 at 11:02:47AM -0700, Jens Axboe wrote:
> > We need it unless we want unbounded allocations for the biovec. With a
> > 1GB I/O we're at a page size allocation, and with 64MB I/Os that aren't
> > unheard of we'd be up to a 64 pages or an order 6 allocation which will
> > take down the VM. We also need to pin down all the user memory while
> > doing the I/O instead of having throttling on the bio mempool before
> > doing the get_user_pages.
>
> Just add the iterator and loop for every X pages? We can even put a plug
> around it, if we have to.
That's pretty much what my patch does..
^ permalink raw reply
* Re: [Qemu-devel] [PATCH v6 1/2] block/vxhs.c: Add support for a new block device type called "vxhs"
From: Fam Zheng @ 2016-11-14 18:03 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: Ashish Mittal, qemu-devel, pbonzini, kwolf, armbru, berrange,
jcody, ashish.mittal, Rakesh.Ranjan, Buddhi.Madhav,
Ketan.Nilangekar, Abhijit.Dey, Venkatesha.Mg
In-Reply-To: <20161114165034.GA1352@stefanha-x1.localdomain>
On Mon, 11/14 16:50, Stefan Hajnoczi wrote:
> On Mon, Nov 14, 2016 at 11:49:06PM +0800, Fam Zheng wrote:
> > On Mon, 11/14 15:07, Stefan Hajnoczi wrote:
> > > On Mon, Nov 07, 2016 at 04:59:44PM -0800, Ashish Mittal wrote:
> > > > diff --git a/block/vxhs.c b/block/vxhs.c
> > > > new file mode 100644
> > > > index 0000000..8913e8f
> > > > --- /dev/null
> > > > +++ b/block/vxhs.c
> > > > @@ -0,0 +1,689 @@
> > > > +/*
> > > > + * QEMU Block driver for Veritas HyperScale (VxHS)
> > > > + *
> > > > + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> > > > + * See the COPYING file in the top-level directory.
> > > > + *
> > > > + */
> > > > +
> > > > +#include "qemu/osdep.h"
> > > > +#include "block/block_int.h"
> > > > +#include <qnio/qnio_api.h>
> > >
> > > Please move system headers (<>) above user headers (""). This way you
> > > can be sure the system header isn't affected by any macros defined by
> > > user headers.
> >
> > Yes, but still after "qemu/osdep.h", which prepares necessary bits for any other
> > headers.
>
> I disagree. qnio_api.h is a third-party library that doesn't need QEMU
> headers to fix up the environment for it.
>
> By including osdep.h first you mask bugs in qnio_api.h. Perhaps
> qnio_api.h forgot to include a header and we won't notice because
> osdep.h happened to bring in those headers first...
>
> Can you explain the rationale for your statement?
I point this out just because I rememebr this effort happened not long ago,
which is to make osdep.h always included first (there is also a
./scripts/clean-includes to reorder the include):
https://lists.nongnu.org/archive/html/qemu-devel/2015-12/msg01110.html
I think it is mostly for uncommon compilers that should have little to do with
libqnio in particular, but this is a common practice of current QEMU.
Fam
^ permalink raw reply
* Re: [PATCHSET] Add support for simplified async direct-io
From: Jens Axboe @ 2016-11-14 18:02 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: axboe, linux-block
In-Reply-To: <20161114180052.GA24476@infradead.org>
On 11/14/2016 11:00 AM, Christoph Hellwig wrote:
> On Mon, Nov 14, 2016 at 10:47:46AM -0700, Jens Axboe wrote:
>> This seems less clean in basically all ways, not sure I agree with you.
>> We already have 4 vecs inlined in a generic bio, and we might as well
>> use the fs bioset instead of creating our own. You also add a smallish
>> dio to track things, I don't think we need that.
>
> We need it unless we want unbounded allocations for the biovec. With a
> 1GB I/O we're at a page size allocation, and with 64MB I/Os that aren't
> unheard of we'd be up to a 64 pages or an order 6 allocation which will
> take down the VM. We also need to pin down all the user memory while
> doing the I/O instead of having throttling on the bio mempool before
> doing the get_user_pages.
Just add the iterator and loop for every X pages? We can even put a plug
around it, if we have to.
--
Jens Axboe
^ permalink raw reply
* [U-Boot] [ANN] U-Boot v2016.11 is released
From: Jagan Teki @ 2016-11-14 18:02 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20161114164605.GI27304@bill-the-cat>
On Mon, Nov 14, 2016 at 10:16 PM, Tom Rini <trini@konsulko.com> wrote:
> Hey all,
>
> I've released v2016.11 and it's now live on git and FTP and ACD (along
> with PGP sig file).
>
> In many ways it feels good to say that the highlights of the last
> release once again apply. We've had more DM conversion work, Kconfig
> conversion work and arch / SoC / platform updates. We've also had some
> important filesystem fixes come in and equally as important, test cases
> added. We also now support the new and default enabled ext4 64bit flag
> (thanks again Stefan!).
>
> And what I want to highlight here is going forward both relative ease
> of, and expectations on testing. Last time I talked about test.py and
> how I'm using it more myself now. This time, I want to talk about
> travis-ci support. If you use github you can get a more-or-less world
> build and test.py for all of the QEMU targets we support today done in
> about 2 and a half hours, wall clock. I don't expect people to do this
> for iterative development or "trivial" changes, but if you have a series
> that touches a lot of areas I think it's reasonable to expect that
> you'll test things out this way. And I'll say now it's not 100%. About
> once every 10 builds I'll have to go and re-start a sub-job because it
> will fail to fetch one of the PPAs we use for no apparent reason. But
> to be clear, it's a few minutes worth of setup and then you push a
> change and you get build coverage and test coverage. This is really
> awesome and I wish I had been paying more attention to this sooner.
>
> As always, I know I'm missing pointing out a few things that I should
> point out and would encourage folks to chime in if there's anything they
> would like to highlight.
>
> Thanks again everyone!
Unfortunately "Amarula Solutions" is not listed in Employers list [1]
for this I sent a domain-map mail to Wolfgang Denk during MW, any edit
for this?
[1] http://www.denx.de/wiki/U-Boot/UbootStat_2016_11
--
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
^ permalink raw reply
* Re: [RFC/PATCH 0/2] git diff <(command1) <(command2)
From: Junio C Hamano @ 2016-11-14 18:01 UTC (permalink / raw)
To: Michael J Gruber
Cc: Johannes Schindelin, Jacob Keller, Dennis Kaarsemaker,
Git mailing list
In-Reply-To: <0c39be16-76f8-0800-41a2-b7b1dccdd652@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
> *My* idea of --no-index was for it to behave as similar to the
> --index-version as possible, regarding formatting etc., and to be a good
> substitute for ordinary diff. The proposed patch achieves exactly that -
Does it? It looks to me that it does a lot more.
> why should a *file* argument (which is not a pathspec in --no-index
> mode) not be treated in the same way in which every other command treats
> a file argument? The patch un-breaks the most natural expectation.
I think a filename given as a command line argument, e.g. <(cmd), is
now treated more sensibly with [2/2]. Something that is not a
directory to be descended into and is not a regular file needs to be
made into a form that we can use as a blob, and reading it into an
in-core buffer is a workable way to do so.
However, when taken together with [1/2], doesn't the proposed patch
"achieves" a lot more than "exactly that", namely, by not treating
symbolic links discovered during traversals of directories given
from the command line as such and dereferencing?
^ permalink raw reply
* Re: Freescale Yocto Question - Building imx6dl-riotboard
From: Eric.Zaluzec @ 2016-11-14 18:00 UTC (permalink / raw)
To: daiane.list; +Cc: meta-freescale
In-Reply-To: <CA+jg_OWhzifJv1FEAWpMbL_ijuZv_SWZNQOhHmeWxbfaDfmzZQ@mail.gmail.com>
Thanks Daiane, maybe I am getting ahead of myself with the questions.
Under the FSL Community BSP's "Support Board List", I see the "imx6dl-riotboard / RIotboard / i.MX6S / meta-fsl-arm-extra".
http://freescale.github.io/doc/release-notes/2.1/index.html#supported-boards
Is this imx6dl-riotboard BSP and machine configuration file the one that can run on the RIoTboard evaluation platform found on http://riotboard.org/ ?
If it is not, do you have reference or a web URL for the one RIoTboard that you support?
Regards,
-Eric Zaluzec
(Eric.Zaluzec@Emerson.com)
-----Original Message-----
From: angolini@gmail.com [mailto:angolini@gmail.com] On Behalf Of Daiane Angolini
Sent: Monday, November 14, 2016 11:20 AM
To: Zaluzec, Eric [NETPWR/AL]
Cc: meta-freescale@yoctoproject.org
Subject: Re: [meta-freescale] Freescale Yocto Question - Building imx6dl-riotboard
On Fri, Nov 11, 2016 at 3:12 PM, <Eric.Zaluzec@emerson.com> wrote:
> Greeting,
>
> I have a quick question concerning the imx6dl-riotboard machine
> configuration file, maintained by the Yocto Freescale community.
>
> We have an upcoming project for which we are considering a i.MX6 Dual
> Lite processor. But since there are no Dual Lite evaluation boards, at
> this time, we were provided an i.mx6 solo RIoTboard to use for initial
> testing, by Avnet and NXP distributors.
>
>
>
> First off, thank you for providing up-to-date Yocto build repositories
> and documentation! This makes kicking-off a new Yocto BSP Project much simpler!
> Cheers.
>
> I read the Freescale Yocto User Guide here:
> http://www.bcmcom.com/CustomerDL/AR6MX/Yocto/Freescale_Yocto_Project_U
> ser's_Guide.pdf I then read the RIoTboard Yocto build guide here:
> https://www.element14.com/community/community/designcenter/single-boar
> d-computers/riotboard/blog/2014/09/22/riotboard-yocto-part1-getting-st
> arted
>
> Using both resources, I successfully built a Yocto image and was able
> to install onto my RIoTboard.
>
>
>
>
>
> Now, using Yocto, I would like to build a RIoTboard image with a fido
> or krogoth branch of Yocto, to make use of the updated packages &
> bitbake recipes, like boost and java, These versions are dependencies
> to my metadata layer’s packages.
>
> I went to the fsl-arm-yocto-bsp git repository site and found the
> imx-4.1-krogoth branch:
> http://git.freescale.com/git/cgit.cgi/imx/fsl-arm-yocto-bsp.git/?h=imx
> -4.1-krogoth
>
>
>
> I followed the User Guide steps, but this time cloned the
> imx-4.1-krogoth branch. I noticed the riotboard.conf machine
> configuration file no longer existed, but a imx6dl-riotboard machine
> was present in the meta-fsl-arm-extra & meta-freescale-3rdparty
> metadata layers. I successfully built an image with this machine conf
> file, but then realized that it was ‘dl’ (Dual Lite?) and would not
> boot with the solo RIoTboard that I was using.
>
>
>
> Question :
>
> Are there any branches on for the fsl-arm-yocto-bsp repository that
> are fido/jethro/krogoth compatible, that include the riotboard solo
> machine configuration file?
> http://git.freescale.com/git/cgit.cgi/imx/fsl-arm-yocto-bsp.git
>
> If not, is it possible for users, like me, to base a riotboard solo
> machine conf file off the imx6dl-riotboard machine and create a
> successful BSP image? Or are these unavoidable conflicts?
>
>
>
> The critical piece here is not necessarily having a v4.1 kernel but
> just the use of the updated package recipes & the dependency to custom
> packages trying to be installed & tested on the riotboard!
>
>
>
> Any help, suggestions, or feedback would greatly be appreciated! Right
> now I am just tinkering with learning about the riotboard machine conf
> file to see if I can port it to the imx-4.1-krogoth branch.
>
I'm not sure you're going to be able to use imx-4.1-krogoth branch with the riot board. Please, take a look at [1]
We have support for one riot board, double check if this is what you are looking for.
[1] http://freescale.github.io/doc/release-notes/2.1/index.html#the-differences-between-project-name-and-freescale-release-name
Daiane
>
>
> Thanks!
> -Eric Zaluzec
> (Eric.Zaluzec@Emerson.com)
>
>
>
>
> --
> _______________________________________________
> meta-freescale mailing list
> meta-freescale@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/meta-freescale
>
^ permalink raw reply
* Re: [Qemu-devel] [PATCH v7 RFC] block/vxhs: Initial commit to add Veritas HyperScale VxHS block device support
From: ashish mittal @ 2016-11-14 18:01 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: qemu-devel, Paolo Bonzini, Kevin Wolf, Markus Armbruster,
Daniel P. Berrange, Jeff Cody, Fam Zheng, Ashish Mittal,
Ketan Nilangekar, Abhijit Dey, Venkatesha.Mg, Buddhi.Madhav
In-Reply-To: <CAJSP0QW3EGxW+PYmb=ThEfv33+BH1xTyxWBEY1YZO+w21wtgSw@mail.gmail.com>
Will look into these ASAP.
On Mon, Nov 14, 2016 at 7:05 AM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> On Wed, Sep 28, 2016 at 10:45 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
>> On Tue, Sep 27, 2016 at 09:09:49PM -0700, Ashish Mittal wrote:
>>
>> Review of .bdrv_open() and .bdrv_aio_writev() code paths.
>>
>> The big issues I see in this driver and libqnio:
>>
>> 1. Showstoppers like broken .bdrv_open() and leaking memory on every
>> reply message.
>> 2. Insecure due to missing input validation (network packets and
>> configuration) and incorrect string handling.
>> 3. Not fully asynchronous so QEMU and the guest may hang.
>>
>> Please think about the whole codebase and not just the lines I've
>> pointed out in this review when fixing these sorts of issues. There may
>> be similar instances of these bugs elsewhere and it's important that
>> they are fixed so that this can be merged.
>
> Ping?
>
> You didn't respond to the comments I raised. The libqnio buffer
> overflows and other issues from this email are still present.
>
> I put a lot of time into reviewing this patch series and libqnio. If
> you want to get reviews please address feedback before sending a new
> patch series.
>
>>
>>> +/*
>>> + * Structure per vDisk maintained for state
>>> + */
>>> +typedef struct BDRVVXHSState {
>>> + int fds[2];
>>> + int64_t vdisk_size;
>>> + int64_t vdisk_blocks;
>>> + int64_t vdisk_flags;
>>> + int vdisk_aio_count;
>>> + int event_reader_pos;
>>> + VXHSAIOCB *qnio_event_acb;
>>> + void *qnio_ctx;
>>> + QemuSpin vdisk_lock; /* Lock to protect BDRVVXHSState */
>>> + QemuSpin vdisk_acb_lock; /* Protects ACB */
>>
>> These comments are insufficient for documenting locking. Not all fields
>> are actually protected by these locks. Please order fields according to
>> lock coverage:
>>
>> typedef struct VXHSAIOCB {
>> ...
>>
>> /* Protected by BDRVVXHSState->vdisk_acb_lock */
>> int segments;
>> ...
>> };
>>
>> typedef struct BDRVVXHSState {
>> ...
>>
>> /* Protected by vdisk_lock */
>> QemuSpin vdisk_lock;
>> int vdisk_aio_count;
>> QSIMPLEQ_HEAD(aio_retryq, VXHSAIOCB) vdisk_aio_retryq;
>> ...
>> }
>>
>>> +static void vxhs_qnio_iio_close(BDRVVXHSState *s, int idx)
>>> +{
>>> + /*
>>> + * Close vDisk device
>>> + */
>>> + if (s->vdisk_hostinfo[idx].vdisk_rfd >= 0) {
>>> + iio_devclose(s->qnio_ctx, 0, s->vdisk_hostinfo[idx].vdisk_rfd);
>>
>> libqnio comment:
>> Why does iio_devclose() take an unused cfd argument? Perhaps it can be
>> dropped.
>>
>>> + s->vdisk_hostinfo[idx].vdisk_rfd = -1;
>>> + }
>>> +
>>> + /*
>>> + * Close QNIO channel against cached channel-fd
>>> + */
>>> + if (s->vdisk_hostinfo[idx].qnio_cfd >= 0) {
>>> + iio_close(s->qnio_ctx, s->vdisk_hostinfo[idx].qnio_cfd);
>>
>> libqnio comment:
>> Why does iio_devclose() take an int32_t cfd argument but iio_close()
>> takes a uint32_t cfd argument?
>>
>>> + s->vdisk_hostinfo[idx].qnio_cfd = -1;
>>> + }
>>> +}
>>> +
>>> +static int vxhs_qnio_iio_open(int *cfd, const char *of_vsa_addr,
>>> + int *rfd, const char *file_name)
>>> +{
>>> + /*
>>> + * Open qnio channel to storage agent if not opened before.
>>> + */
>>> + if (*cfd < 0) {
>>> + *cfd = iio_open(global_qnio_ctx, of_vsa_addr, 0);
>>
>> libqnio comments:
>>
>> 1.
>> There is a buffer overflow in qnio_create_channel(). strncpy() is used
>> incorrectly so long hostname or port (both can be 99 characters long)
>> will overflow channel->name[] (64 characters) or channel->port[] (8
>> characters).
>>
>> strncpy(channel->name, hostname, strlen(hostname) + 1);
>> strncpy(channel->port, port, strlen(port) + 1);
>>
>> The third argument must be the size of the *destination* buffer, not the
>> source buffer. Also note that strncpy() doesn't NUL-terminate the
>> destination string so you must do that manually to ensure there is a NUL
>> byte at the end of the buffer.
>>
>> 2.
>> channel is leaked in the "Failed to open single connection" error case
>> in qnio_create_channel().
>>
>> 3.
>> If host is longer the 63 characters then the ioapi_ctx->channels and
>> qnio_ctx->channels maps will use different keys due to string truncation
>> in qnio_create_channel(). This means "Channel already exists" in
>> qnio_create_channel() and possibly other things will not work as
>> expected.
>>
>>> + if (*cfd < 0) {
>>> + trace_vxhs_qnio_iio_open(of_vsa_addr);
>>> + return -ENODEV;
>>> + }
>>> + }
>>> +
>>> + /*
>>> + * Open vdisk device
>>> + */
>>> + *rfd = iio_devopen(global_qnio_ctx, *cfd, file_name, 0);
>>
>> libqnio comment:
>> Buffer overflow in iio_devopen() since chandev[128] is not large enough
>> to hold channel[100] + " " + devpath[arbitrary length] chars:
>>
>> sprintf(chandev, "%s %s", channel, devpath);
>>
>>> +
>>> + if (*rfd < 0) {
>>> + if (*cfd >= 0) {
>>
>> This check is always true. Otherwise the return -ENODEV would have been
>> taken above. The if statement isn't necessary.
>>
>>> +static void vxhs_check_failover_status(int res, void *ctx)
>>> +{
>>> + BDRVVXHSState *s = ctx;
>>> +
>>> + if (res == 0) {
>>> + /* found failover target */
>>> + s->vdisk_cur_host_idx = s->vdisk_ask_failover_idx;
>>> + s->vdisk_ask_failover_idx = 0;
>>> + trace_vxhs_check_failover_status(
>>> + s->vdisk_hostinfo[s->vdisk_cur_host_idx].hostip,
>>> + s->vdisk_guid);
>>> + qemu_spin_lock(&s->vdisk_lock);
>>> + OF_VDISK_RESET_IOFAILOVER_IN_PROGRESS(s);
>>> + qemu_spin_unlock(&s->vdisk_lock);
>>> + vxhs_handle_queued_ios(s);
>>> + } else {
>>> + /* keep looking */
>>> + trace_vxhs_check_failover_status_retry(s->vdisk_guid);
>>> + s->vdisk_ask_failover_idx++;
>>> + if (s->vdisk_ask_failover_idx == s->vdisk_nhosts) {
>>> + /* pause and cycle through list again */
>>> + sleep(QNIO_CONNECT_RETRY_SECS);
>>
>> This code is called from a QEMU thread via vxhs_aio_rw(). It is not
>> permitted to call sleep() since it will freeze QEMU and probably the
>> guest.
>>
>> If you need a timer you can use QEMU's timer APIs. See aio_timer_new(),
>> timer_new_ns(), timer_mod(), timer_del(), timer_free().
>>
>>> + s->vdisk_ask_failover_idx = 0;
>>> + }
>>> + res = vxhs_switch_storage_agent(s);
>>> + }
>>> +}
>>> +
>>> +static int vxhs_failover_io(BDRVVXHSState *s)
>>> +{
>>> + int res = 0;
>>> +
>>> + trace_vxhs_failover_io(s->vdisk_guid);
>>> +
>>> + s->vdisk_ask_failover_idx = 0;
>>> + res = vxhs_switch_storage_agent(s);
>>> +
>>> + return res;
>>> +}
>>> +
>>> +static void vxhs_iio_callback(int32_t rfd, uint32_t reason, void *ctx,
>>> + uint32_t error, uint32_t opcode)
>>
>> This function is doing too much. Especially the failover code should
>> run in the AioContext since it's complex. Don't do failover here
>> because this function is outside the AioContext lock. Do it from
>> AioContext using a QEMUBH like block/rbd.c.
>>
>>> +static int32_t
>>> +vxhs_qnio_iio_writev(void *qnio_ctx, uint32_t rfd, QEMUIOVector *qiov,
>>> + uint64_t offset, void *ctx, uint32_t flags)
>>> +{
>>> + struct iovec cur;
>>> + uint64_t cur_offset = 0;
>>> + uint64_t cur_write_len = 0;
>>> + int segcount = 0;
>>> + int ret = 0;
>>> + int i, nsio = 0;
>>> + int iovcnt = qiov->niov;
>>> + struct iovec *iov = qiov->iov;
>>> +
>>> + errno = 0;
>>> + cur.iov_base = 0;
>>> + cur.iov_len = 0;
>>> +
>>> + ret = iio_writev(qnio_ctx, rfd, iov, iovcnt, offset, ctx, flags);
>>
>> libqnio comments:
>>
>> 1.
>> There are blocking connect(2) and getaddrinfo(3) calls in iio_writev()
>> so this may hang for arbitrary amounts of time. This is not permitted
>> in .bdrv_aio_readv()/.bdrv_aio_writev(). Please make qnio actually
>> asynchronous.
>>
>> 2.
>> Where does client_callback() free reply? It looks like every reply
>> message causes a memory leak!
>>
>> 3.
>> Buffer overflow in iio_writev() since device[128] cannot fit the device
>> string generated from the vdisk_guid.
>>
>> 4.
>> Buffer overflow in iio_writev() due to
>> strncpy(msg->hinfo.target,device,strlen(device)) where device[128] is
>> larger than target[64]. Also note the previous comments about strncpy()
>> usage.
>>
>> 5.
>> I don't see any endianness handling or portable alignment of struct
>> fields in the network protocol code. Binary network protocols need to
>> take care of these issue for portability. This means libqnio compiled
>> for different architectures will not work. Do you plan to support any
>> other architectures besides x86?
>>
>> 6.
>> The networking code doesn't look robust: kvset uses assert() on input
>> from the network so the other side of the connection could cause SIGABRT
>> (coredump), the client uses the msg pointer as the cookie for the
>> response packet so the server can easily crash the client by sending a
>> bogus cookie value, etc. Even on the client side these things are
>> troublesome but on a server they are guaranteed security issues. I
>> didn't look into it deeply. Please audit the code.
>>
>>> +static int vxhs_qemu_init(QDict *options, BDRVVXHSState *s,
>>> + int *cfd, int *rfd, Error **errp)
>>> +{
>>> + QDict *backing_options = NULL;
>>> + QemuOpts *opts, *tcp_opts;
>>> + const char *vxhs_filename;
>>> + char *of_vsa_addr = NULL;
>>> + Error *local_err = NULL;
>>> + const char *vdisk_id_opt;
>>> + char *file_name = NULL;
>>> + size_t num_servers = 0;
>>> + char *str = NULL;
>>> + int ret = 0;
>>> + int i;
>>> +
>>> + opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
>>> + qemu_opts_absorb_qdict(opts, options, &local_err);
>>> + if (local_err) {
>>> + error_propagate(errp, local_err);
>>> + ret = -EINVAL;
>>> + goto out;
>>> + }
>>> +
>>> + vxhs_filename = qemu_opt_get(opts, VXHS_OPT_FILENAME);
>>> + if (vxhs_filename) {
>>> + trace_vxhs_qemu_init_filename(vxhs_filename);
>>> + }
>>> +
>>> + vdisk_id_opt = qemu_opt_get(opts, VXHS_OPT_VDISK_ID);
>>> + if (!vdisk_id_opt) {
>>> + error_setg(&local_err, QERR_MISSING_PARAMETER, VXHS_OPT_VDISK_ID);
>>> + ret = -EINVAL;
>>> + goto out;
>>> + }
>>> + s->vdisk_guid = g_strdup(vdisk_id_opt);
>>> + trace_vxhs_qemu_init_vdisk(vdisk_id_opt);
>>> +
>>> + num_servers = qdict_array_entries(options, VXHS_OPT_SERVER);
>>> + if (num_servers < 1) {
>>> + error_setg(&local_err, QERR_MISSING_PARAMETER, "server");
>>> + ret = -EINVAL;
>>> + goto out;
>>> + } else if (num_servers > VXHS_MAX_HOSTS) {
>>> + error_setg(&local_err, QERR_INVALID_PARAMETER, "server");
>>> + error_append_hint(errp, "Maximum %d servers allowed.\n",
>>> + VXHS_MAX_HOSTS);
>>> + ret = -EINVAL;
>>> + goto out;
>>> + }
>>> + trace_vxhs_qemu_init_numservers(num_servers);
>>> +
>>> + for (i = 0; i < num_servers; i++) {
>>> + str = g_strdup_printf(VXHS_OPT_SERVER"%d.", i);
>>> + qdict_extract_subqdict(options, &backing_options, str);
>>> +
>>> + /* Create opts info from runtime_tcp_opts list */
>>> + tcp_opts = qemu_opts_create(&runtime_tcp_opts, NULL, 0, &error_abort);
>>> + qemu_opts_absorb_qdict(tcp_opts, backing_options, &local_err);
>>> + if (local_err) {
>>> + qdict_del(backing_options, str);
>>
>> backing_options is leaked and there's no need to delete the str key.
>>
>>> + qemu_opts_del(tcp_opts);
>>> + g_free(str);
>>> + ret = -EINVAL;
>>> + goto out;
>>> + }
>>> +
>>> + s->vdisk_hostinfo[i].hostip = g_strdup(qemu_opt_get(tcp_opts,
>>> + VXHS_OPT_HOST));
>>> + s->vdisk_hostinfo[i].port = g_ascii_strtoll(qemu_opt_get(tcp_opts,
>>> + VXHS_OPT_PORT),
>>> + NULL, 0);
>>
>> This will segfault if the port option was missing.
>>
>>> +
>>> + s->vdisk_hostinfo[i].qnio_cfd = -1;
>>> + s->vdisk_hostinfo[i].vdisk_rfd = -1;
>>> + trace_vxhs_qemu_init(s->vdisk_hostinfo[i].hostip,
>>> + s->vdisk_hostinfo[i].port);
>>
>> It's not safe to use the %s format specifier for a trace event with a
>> NULL value. In the case where hostip is NULL this could crash on some
>> systems.
>>
>>> +
>>> + qdict_del(backing_options, str);
>>> + qemu_opts_del(tcp_opts);
>>> + g_free(str);
>>> + }
>>
>> backing_options is leaked.
>>
>>> +
>>> + s->vdisk_nhosts = i;
>>> + s->vdisk_cur_host_idx = 0;
>>> + file_name = g_strdup_printf("%s%s", vdisk_prefix, s->vdisk_guid);
>>> + of_vsa_addr = g_strdup_printf("of://%s:%d",
>>> + s->vdisk_hostinfo[s->vdisk_cur_host_idx].hostip,
>>> + s->vdisk_hostinfo[s->vdisk_cur_host_idx].port);
>>
>> Can we get here with num_servers == 0? In that case this would access
>> uninitialized memory. I guess num_servers == 0 does not make sense and
>> there should be an error case for it.
>>
>>> +
>>> + /*
>>> + * .bdrv_open() and .bdrv_create() run under the QEMU global mutex.
>>> + */
>>> + if (global_qnio_ctx == NULL) {
>>> + global_qnio_ctx = vxhs_setup_qnio();
>>
>> libqnio comment:
>> The client epoll thread should mask all signals (like
>> qemu_thread_create()). Otherwise it may receive signals that it cannot
>> deal with.
>>
>>> + if (global_qnio_ctx == NULL) {
>>> + error_setg(&local_err, "Failed vxhs_setup_qnio");
>>> + ret = -EINVAL;
>>> + goto out;
>>> + }
>>> + }
>>> +
>>> + ret = vxhs_qnio_iio_open(cfd, of_vsa_addr, rfd, file_name);
>>> + if (!ret) {
>>> + error_setg(&local_err, "Failed qnio_iio_open");
>>> + ret = -EIO;
>>> + }
>>
>> The return value of vxhs_qnio_iio_open() is 0 for success or -errno for
>> error.
>>
>> I guess you never ran this code! The block driver won't even open
>> successfully.
>>
>>> +
>>> +out:
>>> + g_free(file_name);
>>> + g_free(of_vsa_addr);
>>> + qemu_opts_del(opts);
>>> +
>>> + if (ret < 0) {
>>> + for (i = 0; i < num_servers; i++) {
>>> + g_free(s->vdisk_hostinfo[i].hostip);
>>> + }
>>> + g_free(s->vdisk_guid);
>>> + s->vdisk_guid = NULL;
>>> + errno = -ret;
>>
>> There is no need to set errno here. The return value already contains
>> the error and the caller doesn't look at errno.
>>
>>> + }
>>> + error_propagate(errp, local_err);
>>> +
>>> + return ret;
>>> +}
>>> +
>>> +static int vxhs_open(BlockDriverState *bs, QDict *options,
>>> + int bdrv_flags, Error **errp)
>>> +{
>>> + BDRVVXHSState *s = bs->opaque;
>>> + AioContext *aio_context;
>>> + int qemu_qnio_cfd = -1;
>>> + int device_opened = 0;
>>> + int qemu_rfd = -1;
>>> + int ret = 0;
>>> + int i;
>>> +
>>> + ret = vxhs_qemu_init(options, s, &qemu_qnio_cfd, &qemu_rfd, errp);
>>> + if (ret < 0) {
>>> + trace_vxhs_open_fail(ret);
>>> + return ret;
>>> + }
>>> +
>>> + device_opened = 1;
>>> + s->qnio_ctx = global_qnio_ctx;
>>> + s->vdisk_hostinfo[0].qnio_cfd = qemu_qnio_cfd;
>>> + s->vdisk_hostinfo[0].vdisk_rfd = qemu_rfd;
>>> + s->vdisk_size = 0;
>>> + QSIMPLEQ_INIT(&s->vdisk_aio_retryq);
>>> +
>>> + /*
>>> + * Create a pipe for communicating between two threads in different
>>> + * context. Set handler for read event, which gets triggered when
>>> + * IO completion is done by non-QEMU context.
>>> + */
>>> + ret = qemu_pipe(s->fds);
>>> + if (ret < 0) {
>>> + trace_vxhs_open_epipe('.');
>>> + ret = -errno;
>>> + goto errout;
>>
>> This leaks s->vdisk_guid, s->vdisk_hostinfo[i].hostip, etc.
>> bdrv_close() will not be called so this function must do cleanup itself.
>>
>>> + }
>>> + fcntl(s->fds[VDISK_FD_READ], F_SETFL, O_NONBLOCK);
>>> +
>>> + aio_context = bdrv_get_aio_context(bs);
>>> + aio_set_fd_handler(aio_context, s->fds[VDISK_FD_READ],
>>> + false, vxhs_aio_event_reader, NULL, s);
>>> +
>>> + /*
>>> + * Initialize the spin-locks.
>>> + */
>>> + qemu_spin_init(&s->vdisk_lock);
>>> + qemu_spin_init(&s->vdisk_acb_lock);
>>> +
>>> + return 0;
>>> +
>>> +errout:
>>> + /*
>>> + * Close remote vDisk device if it was opened earlier
>>> + */
>>> + if (device_opened) {
>>
>> This is always true. The device_opened variable can be removed.
>>
>>> +/*
>>> + * This allocates QEMU-VXHS callback for each IO
>>> + * and is passed to QNIO. When QNIO completes the work,
>>> + * it will be passed back through the callback.
>>> + */
>>> +static BlockAIOCB *vxhs_aio_rw(BlockDriverState *bs,
>>> + int64_t sector_num, QEMUIOVector *qiov,
>>> + int nb_sectors,
>>> + BlockCompletionFunc *cb,
>>> + void *opaque, int iodir)
>>> +{
>>> + VXHSAIOCB *acb = NULL;
>>> + BDRVVXHSState *s = bs->opaque;
>>> + size_t size;
>>> + uint64_t offset;
>>> + int iio_flags = 0;
>>> + int ret = 0;
>>> + void *qnio_ctx = s->qnio_ctx;
>>> + uint32_t rfd = s->vdisk_hostinfo[s->vdisk_cur_host_idx].vdisk_rfd;
>>> +
>>> + offset = sector_num * BDRV_SECTOR_SIZE;
>>> + size = nb_sectors * BDRV_SECTOR_SIZE;
>>> +
>>> + acb = qemu_aio_get(&vxhs_aiocb_info, bs, cb, opaque);
>>> + /*
>>> + * Setup or initialize VXHSAIOCB.
>>> + * Every single field should be initialized since
>>> + * acb will be picked up from the slab without
>>> + * initializing with zero.
>>> + */
>>> + acb->io_offset = offset;
>>> + acb->size = size;
>>> + acb->ret = 0;
>>> + acb->flags = 0;
>>> + acb->aio_done = VXHS_IO_INPROGRESS;
>>> + acb->segments = 0;
>>> + acb->buffer = 0;
>>> + acb->qiov = qiov;
>>> + acb->direction = iodir;
>>> +
>>> + qemu_spin_lock(&s->vdisk_lock);
>>> + if (OF_VDISK_FAILED(s)) {
>>> + trace_vxhs_aio_rw(s->vdisk_guid, iodir, size, offset);
>>> + qemu_spin_unlock(&s->vdisk_lock);
>>> + goto errout;
>>> + }
>>> + if (OF_VDISK_IOFAILOVER_IN_PROGRESS(s)) {
>>> + QSIMPLEQ_INSERT_TAIL(&s->vdisk_aio_retryq, acb, retry_entry);
>>> + s->vdisk_aio_retry_qd++;
>>> + OF_AIOCB_FLAGS_SET_QUEUED(acb);
>>> + qemu_spin_unlock(&s->vdisk_lock);
>>> + trace_vxhs_aio_rw_retry(s->vdisk_guid, acb, 1);
>>> + goto out;
>>> + }
>>> + s->vdisk_aio_count++;
>>> + qemu_spin_unlock(&s->vdisk_lock);
>>> +
>>> + iio_flags = (IIO_FLAG_DONE | IIO_FLAG_ASYNC);
>>> +
>>> + switch (iodir) {
>>> + case VDISK_AIO_WRITE:
>>> + vxhs_inc_acb_segment_count(acb, 1);
>>> + ret = vxhs_qnio_iio_writev(qnio_ctx, rfd, qiov,
>>> + offset, (void *)acb, iio_flags);
>>> + break;
>>> + case VDISK_AIO_READ:
>>> + vxhs_inc_acb_segment_count(acb, 1);
>>> + ret = vxhs_qnio_iio_readv(qnio_ctx, rfd, qiov,
>>> + offset, (void *)acb, iio_flags);
>>> + break;
>>> + default:
>>> + trace_vxhs_aio_rw_invalid(iodir);
>>> + goto errout;
>>
>> s->vdisk_aio_count must be decremented before returning.
>>
>>> +static void vxhs_close(BlockDriverState *bs)
>>> +{
>>> + BDRVVXHSState *s = bs->opaque;
>>> + int i;
>>> +
>>> + trace_vxhs_close(s->vdisk_guid);
>>> + close(s->fds[VDISK_FD_READ]);
>>> + close(s->fds[VDISK_FD_WRITE]);
>>> +
>>> + /*
>>> + * Clearing all the event handlers for oflame registered to QEMU
>>> + */
>>> + aio_set_fd_handler(bdrv_get_aio_context(bs), s->fds[VDISK_FD_READ],
>>> + false, NULL, NULL, NULL);
>>
>> Please remove the event handler before closing the fd. I don't think it
>> matters in this case but in other scenarios there could be race
>> conditions if another thread opens an fd and the file descriptor number
>> is reused.
^ permalink raw reply
* Re: [PATCHSET] Add support for simplified async direct-io
From: Christoph Hellwig @ 2016-11-14 18:00 UTC (permalink / raw)
To: Jens Axboe; +Cc: Christoph Hellwig, axboe, linux-block
In-Reply-To: <71ce9ae3-214d-b248-3507-cc96bea41a9b@fb.com>
On Mon, Nov 14, 2016 at 10:47:46AM -0700, Jens Axboe wrote:
> This seems less clean in basically all ways, not sure I agree with you.
> We already have 4 vecs inlined in a generic bio, and we might as well
> use the fs bioset instead of creating our own. You also add a smallish
> dio to track things, I don't think we need that.
We need it unless we want unbounded allocations for the biovec. With a
1GB I/O we're at a page size allocation, and with 64MB I/Os that aren't
unheard of we'd be up to a 64 pages or an order 6 allocation which will
take down the VM. We also need to pin down all the user memory while
doing the I/O instead of having throttling on the bio mempool before
doing the get_user_pages.
^ permalink raw reply
* Re: [PATCH nf-next 1/4] netfilter: nf_conntrack_tuple_common.h: fix #include
From: mikko.rapeli @ 2016-11-14 17:59 UTC (permalink / raw)
To: dcaratti
Cc: davem, fw, yoshfuji, jmorris, kadlec, pablo, kaber, coreteam,
netfilter-devel, kuznet
In-Reply-To: <1479132117.2430.66.camel@redhat.com>
Hi,
Am Mo. Nov. 14 15:01:57 2016 GMT+0100 schrieb Davide Caratti:
> On Fri, 2016-11-11 at 13:02 +0100, Davide Caratti wrote:
> >
> > > Is there a kernel side conflict between uapi and net/netns headers?
> >
> > Looks like a circular dependency is here, or nf_conntrack_tuple_common.h
> > is including the wrong netfilter.h. From within net/netns/conntrack.h I
> > can include only those UAPI files that don't include <linux/netfilter.h>
> > (for example, nf_conntrack_tcp.h that uses '2' instead of
> > IP_CT_DIR_MAX).
>
> hello Mikko,
>
> I looked at the dependency issue:
>
> current include/linux/netfilter.h needs include/net/net_namespace.h (i.e.
> nf_hook() needs struct net), and include/net/net_namespace.h needs
> include/net/netns/conntrack.h (i.e. struct net needs struct netns_ct).
>
> That's why it's not possible to do #include <linux/netfilter.h> in
> include/net/netns/conntrack.h, and it's not possible in
> include/net/netns/conntrack.h to include any linux/netfilter/*.h UAPI
> header where #include <linux/netfilter.h> line is present: the
> preprocessor will prefer including include/linux/netfilter.h before
> include/uapi/linux/netfilter.h, thus generating the dependency error.
Thanks for digging into this. In many other subsystems the kernel side headers start by including the matching uapi header and then add the kernel side stuff. It seems netfilter has not done this and the split to uapi is not always clear.
> One possible fix for the above issue is to modify
> include/uapi/nf_conntrack_tuple_common.h in a way that it avoids including
> <linux/netfilter.h> when kernel sources are being built, and still exposes
> to userspace applications the same contents as commit 1ffad83dffd6
> ("netfilter: fix include files for compilation"):
>
> <...>
> #include <linux/types.h>
> #ifndef __KERNEL__
> #include <linux/netfilter.h>
> #endif
> #include <linux/netfilter/nf_conntrack_common.h> /* for IP_CT_IS_REPLY */
> <...>
>
> BTW, include/uapi/linux/capi.h apparently does something similar with
> linux/kernelcapi.h. With the above change, also the output of
>
> $ pushd usr/include
> $ ../../scripts/headers_compile_test.sh -k | grep FAILED
> $ popd
>
> is preserved.
>
> Are you ok if I post a v2 where the above change (and a minor fix: use
> _UAPI_NF_CONNTRACK_TUPLE_COMMON_H in place of NF_CONNTRACK_TUPLE_COMMON_H
> on the first lines) is done to nf_conntrack_tuple_common.h?
Yes, this looks ok for me.
-Mikko
> regards,
> --
> davide
>
>
--
Sent from my Jolla
^ permalink raw reply
* [PATCH tip/core/rcu 2/2] torture: Prevent jitter from delaying build-only runs
From: Paul E. McKenney @ 2016-11-14 17:59 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
tglx, peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani, Paul E. McKenney
In-Reply-To: <20161114175924.GA23488@linux.vnet.ibm.com>
Currently, if the --jitter flag specifies jitter for a --build-only
run, the system will obediently build a kernel, refuse to launch it,
launch the requested number of jitter processes, and wait for the
specified kernel run time, which defaults to 30 minutes. This is
of course quite pointless.
This commit therefore disables jitter on build-only runs.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
tools/testing/selftests/rcutorture/bin/kvm.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 0aed965f0062..3b3c1b693ee1 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -303,6 +303,7 @@ then
fi
___EOF___
awk < $T/cfgcpu.pack \
+ -v TORTURE_BUILDONLY="$TORTURE_BUILDONLY" \
-v CONFIGDIR="$CONFIGFRAG/" \
-v KVM="$KVM" \
-v ncpus=$cpus \
@@ -375,6 +376,10 @@ function dump(first, pastlast, batchnum)
njitter = ncpus;
else
njitter = ja[1];
+ if (TORTURE_BUILDONLY && njitter != 0) {
+ njitter = 0;
+ print "echo Build-only run, so suppressing jitter >> " rd "/log"
+ }
for (j = 0; j < njitter; j++)
print "jitter.sh " j " " dur " " ja[2] " " ja[3] "&"
print "wait"
--
2.5.2
^ permalink raw reply related
* [PATCH tip/core/rcu 1/2] torture: Remove obsolete files from rcutorture .gitignore
From: Paul E. McKenney @ 2016-11-14 17:59 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
tglx, peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani, Paul E. McKenney
In-Reply-To: <20161114175924.GA23488@linux.vnet.ibm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
tools/testing/selftests/rcutorture/.gitignore | 2 --
1 file changed, 2 deletions(-)
diff --git a/tools/testing/selftests/rcutorture/.gitignore b/tools/testing/selftests/rcutorture/.gitignore
index 05838f6f2ebe..ccc240275d1c 100644
--- a/tools/testing/selftests/rcutorture/.gitignore
+++ b/tools/testing/selftests/rcutorture/.gitignore
@@ -1,6 +1,4 @@
initrd
-linux-2.6
b[0-9]*
-rcu-test-image
res
*.swp
--
2.5.2
^ permalink raw reply related
* Re: [PATCH] binutils: Fix build for c293pcie PPC machine
From: Khem Raj @ 2016-11-14 17:59 UTC (permalink / raw)
To: Fabio Berton; +Cc: Patches and discussions about the oe-core layer
In-Reply-To: <1479126495-14047-1-git-send-email-fabio.berton@ossystems.com.br>
On Mon, Nov 14, 2016 at 4:28 AM, Fabio Berton
<fabio.berton@ossystems.com.br> wrote:
> The following patch fix build for c293pcie PPC machine :
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=8941017b
>
> This patch is a backport from master branch.
>
> Fix error:
> /
> |ERROR: binutils-2.27-r0 do_package: runstrip: ''powerpc-fslc-linux-gnuspe-strip'
> |--remove-section=.comment --remove-section=.note --strip-unneeded
> |'../tmp/work/ppce500v2-fslc-linux-gnuspe/binutils/2.27-r0/package/usr/lib/
> |libbfd-2.27.0.20160806.so'' strip command failed with 1
> |(b'powerpc-fslc-linux-gnuspe-strip: ../tmp/work/ppce500v2-fslc-linux-gnuspe/
> |binutils/2.27-r0/package/usr/lib/stJMAEnm: Not enough room for program headers,
> |try linking with -N\npowerpc-fslc-linux-gnuspe-strip:../tmp/work/
> |ppce500v2-fslc-linux-gnuspe/binutils/2.27-r0/package/usr/lib/stJMAEnm
> |[.note.gnu.build-id]: Bad value\n')
> \
This is ok.
>
> Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
> ---
> meta/recipes-devtools/binutils/binutils-2.27.inc | 1 +
> ...01-ppc-apuinfo-for-spe-parsed-incorrectly.patch | 37 ++++++++++++++++++++++
> 2 files changed, 38 insertions(+)
> create mode 100644 meta/recipes-devtools/binutils/binutils/0001-ppc-apuinfo-for-spe-parsed-incorrectly.patch
>
> diff --git a/meta/recipes-devtools/binutils/binutils-2.27.inc b/meta/recipes-devtools/binutils/binutils-2.27.inc
> index fc81721..75180ea 100644
> --- a/meta/recipes-devtools/binutils/binutils-2.27.inc
> +++ b/meta/recipes-devtools/binutils/binutils-2.27.inc
> @@ -37,6 +37,7 @@ SRC_URI = "\
> file://0015-binutils-mips-gas-pic-relax-linkonce.diff \
> file://0015-Refine-.cfi_sections-check-to-only-consider-compact-.patch \
> file://0016-Fix-seg-fault-in-ARM-linker-when-trying-to-parse-a-b.patch \
> + file://0001-ppc-apuinfo-for-spe-parsed-incorrectly.patch \
> "
> S = "${WORKDIR}/git"
>
> diff --git a/meta/recipes-devtools/binutils/binutils/0001-ppc-apuinfo-for-spe-parsed-incorrectly.patch b/meta/recipes-devtools/binutils/binutils/0001-ppc-apuinfo-for-spe-parsed-incorrectly.patch
> new file mode 100644
> index 0000000..d82a0b6
> --- /dev/null
> +++ b/meta/recipes-devtools/binutils/binutils/0001-ppc-apuinfo-for-spe-parsed-incorrectly.patch
> @@ -0,0 +1,37 @@
> +From 8941017bc0226b60ce306d5271df15820ce66a53 Mon Sep 17 00:00:00 2001
> +From: Alan Modra <amodra@gmail.com>
> +Date: Tue, 30 Aug 2016 20:57:32 +0930
> +Subject: [PATCH] ppc apuinfo for spe parsed incorrectly
> +Organization: O.S. Systems Software LTDA.
> +
> +apuinfo saying SPE resulted in mach = bfd_mach_ppc_vle due to a
> +missing break.
> +
> + PR 20531
> + * elf32-ppc.c (_bfd_elf_ppc_set_arch): Add missing "break".
> +
> +
> +Backport from :
> +https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=8941017b
> +
> +Upstream-Status: Backport
> +Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
> +---
> + bfd/elf32-ppc.c | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
> +index 95ce1dc..e42ef1c 100644
> +--- a/bfd/elf32-ppc.c
> ++++ b/bfd/elf32-ppc.c
> +@@ -2246,6 +2246,7 @@ _bfd_elf_ppc_set_arch (bfd *abfd)
> + case PPC_APUINFO_BRLOCK:
> + if (mach != bfd_mach_ppc_vle)
> + mach = bfd_mach_ppc_e500;
> ++ break;
> +
> + case PPC_APUINFO_VLE:
> + mach = bfd_mach_ppc_vle;
> +--
> +2.1.4
> +
> --
> 2.1.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
^ permalink raw reply
* Re: [PATCH v1 1/2] net/i40e: fix incorrect xstats value mapping
From: Kevin Traynor @ 2016-11-14 17:59 UTC (permalink / raw)
To: Remy Horton, dev; +Cc: Helin Zhang, Jingjing Wu, stable, Yuanhan Liu
In-Reply-To: <1479104089-27862-2-git-send-email-remy.horton@intel.com>
On 11/14/2016 06:14 AM, Remy Horton wrote:
> The offsets used in rte_i40evf_stats_strings for transmission
> statistics were wrong, returning the total byte count rather than
> the respective (unicast, multicast, broadcast, drop, & error)
> packet counts.
>
> Fixes: da61cd084976 ("i40evf: add extended stats")
This should go to the LTS branch also.
Acked-by: Kevin Traynor <ktraynor@redhat.com>
>
> Signed-off-by: Remy Horton <remy.horton@intel.com>
> ---
> drivers/net/i40e/i40e_ethdev_vf.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
> index aa306d6..afae2ec 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -176,11 +176,11 @@ static const struct rte_i40evf_xstats_name_off rte_i40evf_stats_strings[] = {
> {"rx_unknown_protocol_packets", offsetof(struct i40e_eth_stats,
> rx_unknown_protocol)},
> {"tx_bytes", offsetof(struct i40e_eth_stats, tx_bytes)},
> - {"tx_unicast_packets", offsetof(struct i40e_eth_stats, tx_bytes)},
> - {"tx_multicast_packets", offsetof(struct i40e_eth_stats, tx_bytes)},
> - {"tx_broadcast_packets", offsetof(struct i40e_eth_stats, tx_bytes)},
> - {"tx_dropped_packets", offsetof(struct i40e_eth_stats, tx_bytes)},
> - {"tx_error_packets", offsetof(struct i40e_eth_stats, tx_bytes)},
> + {"tx_unicast_packets", offsetof(struct i40e_eth_stats, tx_unicast)},
> + {"tx_multicast_packets", offsetof(struct i40e_eth_stats, tx_multicast)},
> + {"tx_broadcast_packets", offsetof(struct i40e_eth_stats, tx_broadcast)},
> + {"tx_dropped_packets", offsetof(struct i40e_eth_stats, tx_discards)},
> + {"tx_error_packets", offsetof(struct i40e_eth_stats, tx_errors)},
> };
>
> #define I40EVF_NB_XSTATS (sizeof(rte_i40evf_stats_strings) / \
>
^ permalink raw reply
* [PATCH tip/core/rcu 0/2] Torture-test changes for 4.10
From: Paul E. McKenney @ 2016-11-14 17:59 UTC (permalink / raw)
To: linux-kernel
Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
tglx, peterz, rostedt, dhowells, edumazet, dvhart, fweisbec, oleg,
bobby.prani
Hello!
This series contains a couple of torture-test changes:
1. Remove obsolete files from the rcutorture .gitignore file.
2. Prevent the --jitter flag from delaying --build-only runs.
Thanx, Paul
------------------------------------------------------------------------
.gitignore | 2 --
bin/kvm.sh | 5 +++++
2 files changed, 5 insertions(+), 2 deletions(-)
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.