* [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon
@ 2016-08-19 6:52 Jiri Slaby
2016-08-19 6:52 ` [patch added to 3.12-stable] ftrace/recordmcount: Work around for addition of metag magic but not relocations Jiri Slaby
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Jiri Slaby @ 2016-08-19 6:52 UTC (permalink / raw)
To: stable; +Cc: Konstantin Neumoin, Denis V . Lunev, Michael S . Tsirkin,
Jiri Slaby
From: Konstantin Neumoin <kneumoin@virtuozzo.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 37cf99e08c6fb4dcea0f9ad2b13b6daa8c76a711 upstream.
The balloon has a special mechanism that is subscribed to the oom
notification which leads to deflation for a fixed number of pages.
The number is always fixed even when the balloon is fully deflated.
But leak_balloon did not expect that the pages to deflate will be more
than taken, and raise a "BUG" in balloon_page_dequeue when page list
will be empty.
So, the simplest solution would be to check that the number of releases
pages is less or equal to the number taken pages.
Signed-off-by: Konstantin Neumoin <kneumoin@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/virtio/virtio_balloon.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 55e284935f10..d6fa59e447c5 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -178,6 +178,8 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num)
num = min(num, ARRAY_SIZE(vb->pfns));
mutex_lock(&vb->balloon_lock);
+ /* We can't release more pages than taken */
+ num = min(num, (size_t)vb->num_pages);
for (vb->num_pfns = 0; vb->num_pfns < num;
vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) {
page = balloon_page_dequeue(vb_dev_info);
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to 3.12-stable] ftrace/recordmcount: Work around for addition of metag magic but not relocations
2016-08-19 6:52 [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon Jiri Slaby
@ 2016-08-19 6:52 ` Jiri Slaby
2016-08-19 6:52 ` [patch added to 3.12-stable] metag: Fix __cmpxchg_u32 asm constraint for CMP Jiri Slaby
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2016-08-19 6:52 UTC (permalink / raw)
To: stable; +Cc: Laura Abbott, James Hogan, Steven Rostedt, Jiri Slaby
From: Laura Abbott <labbott@redhat.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit b2e1c26f0b62531636509fbcb6dab65617ed8331 upstream.
glibc recently did a sync up (94e73c95d9b5 "elf.h: Sync with the gabi
webpage") that added a #define for EM_METAG but did not add relocations
This triggers build errors:
scripts/recordmcount.c: In function 'do_file':
scripts/recordmcount.c:466:28: error: 'R_METAG_ADDR32' undeclared (first use in this function)
case EM_METAG: reltype = R_METAG_ADDR32;
^~~~~~~~~~~~~~
scripts/recordmcount.c:466:28: note: each undeclared identifier is reported only once for each function it appears in
scripts/recordmcount.c:468:20: error: 'R_METAG_NONE' undeclared (first use in this function)
rel_type_nop = R_METAG_NONE;
^~~~~~~~~~~~
Work around this change with some more #ifdefery for the relocations.
Fedora Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1354034
Link: http://lkml.kernel.org/r/1468005530-14757-1-git-send-email-labbott@redhat.com
Cc: James Hogan <james.hogan@imgtec.com>
Fixes: 00512bdd4573 ("metag: ftrace support")
Reported-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
scripts/recordmcount.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
index ee625e3a56ba..4f7d13da04a5 100644
--- a/scripts/recordmcount.c
+++ b/scripts/recordmcount.c
@@ -33,10 +33,17 @@
#include <string.h>
#include <unistd.h>
+/*
+ * glibc synced up and added the metag number but didn't add the relocations.
+ * Work around this in a crude manner for now.
+ */
#ifndef EM_METAG
-/* Remove this when these make it to the standard system elf.h. */
#define EM_METAG 174
+#endif
+#ifndef R_METAG_ADDR32
#define R_METAG_ADDR32 2
+#endif
+#ifndef R_METAG_NONE
#define R_METAG_NONE 3
#endif
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to 3.12-stable] metag: Fix __cmpxchg_u32 asm constraint for CMP
2016-08-19 6:52 [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon Jiri Slaby
2016-08-19 6:52 ` [patch added to 3.12-stable] ftrace/recordmcount: Work around for addition of metag magic but not relocations Jiri Slaby
@ 2016-08-19 6:52 ` Jiri Slaby
2016-08-19 6:52 ` [patch added to 3.12-stable] IB/mlx5: Fix MODIFY_QP command input structure Jiri Slaby
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2016-08-19 6:52 UTC (permalink / raw)
To: stable; +Cc: James Hogan, linux-metag, Jiri Slaby
From: James Hogan <james.hogan@imgtec.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 6154c187b97ee7513046bb4eb317a89f738f13ef upstream.
The LNKGET based atomic sequence in __cmpxchg_u32 has slightly incorrect
constraints for the return value which under certain circumstances can
allow an address unit register to be used as the first operand of a CMP
instruction. This isn't a valid instruction however as the encodings
only allow a data unit to be specified. This would result in an
assembler error like the following:
Error: failed to assemble instruction: "CMP A0.2,D0Ar6"
Fix by changing the constraint from "=&da" (assigned, early clobbered,
data or address unit register) to "=&d" (data unit register only).
The constraint for the second operand, "bd" (an op2 register where op1
is a data unit register and the instruction supports O2R) is already
correct assuming the first operand is a data unit register.
Other cases of CMP in inline asm have had their constraints checked, and
appear to all be fine.
Fixes: 6006c0d8ce94 ("metag: Atomics, locks and bitops")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/metag/include/asm/cmpxchg_lnkget.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/metag/include/asm/cmpxchg_lnkget.h b/arch/metag/include/asm/cmpxchg_lnkget.h
index 0154e2807ebb..2369ad394876 100644
--- a/arch/metag/include/asm/cmpxchg_lnkget.h
+++ b/arch/metag/include/asm/cmpxchg_lnkget.h
@@ -73,7 +73,7 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
" DCACHE [%2], %0\n"
#endif
"2:\n"
- : "=&d" (temp), "=&da" (retval)
+ : "=&d" (temp), "=&d" (retval)
: "da" (m), "bd" (old), "da" (new)
: "cc"
);
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to 3.12-stable] IB/mlx5: Fix MODIFY_QP command input structure
2016-08-19 6:52 [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon Jiri Slaby
2016-08-19 6:52 ` [patch added to 3.12-stable] ftrace/recordmcount: Work around for addition of metag magic but not relocations Jiri Slaby
2016-08-19 6:52 ` [patch added to 3.12-stable] metag: Fix __cmpxchg_u32 asm constraint for CMP Jiri Slaby
@ 2016-08-19 6:52 ` Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] IB/mlx5: Fix returned values of query QP Jiri Slaby
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2016-08-19 6:52 UTC (permalink / raw)
To: stable; +Cc: Artemy Kovalyov, Leon Romanovsky, Doug Ledford, Jiri Slaby
From: Artemy Kovalyov <artemyko@mellanox.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit e3353c268b06236d6c40fa1714c114f21f44451c upstream.
Make MODIFY_QP command input structure compliant to specification
Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Artemy Kovalyov <artemyko@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
include/linux/mlx5/qp.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index d9e3eacb3a7f..4cf637bd42ab 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -378,9 +378,9 @@ struct mlx5_destroy_qp_mbox_out {
struct mlx5_modify_qp_mbox_in {
struct mlx5_inbox_hdr hdr;
__be32 qpn;
- u8 rsvd1[4];
- __be32 optparam;
u8 rsvd0[4];
+ __be32 optparam;
+ u8 rsvd1[4];
struct mlx5_qp_context ctx;
};
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to 3.12-stable] IB/mlx5: Fix returned values of query QP
2016-08-19 6:52 [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon Jiri Slaby
` (2 preceding siblings ...)
2016-08-19 6:52 ` [patch added to 3.12-stable] IB/mlx5: Fix MODIFY_QP command input structure Jiri Slaby
@ 2016-08-19 6:53 ` Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] IB/mlx5: Fix post send fence logic Jiri Slaby
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2016-08-19 6:53 UTC (permalink / raw)
To: stable; +Cc: Noa Osherovich, Leon Romanovsky, Doug Ledford, Jiri Slaby
From: Noa Osherovich <noaos@mellanox.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 0540d8148d419bf769e5aa99c77027febd8922f0 upstream.
Some variables were not initialized properly: max_recv_wr,
max_recv_sge, max_send_wr, qp_context and max_inline_data.
Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB...')
Signed-off-by: Noa Osherovich <noaos@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/infiniband/hw/mlx5/qp.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 5659ea880741..7ece1059f263 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -169,6 +169,8 @@ static int set_rq_size(struct mlx5_ib_dev *dev, struct ib_qp_cap *cap,
qp->rq.max_gs = 0;
qp->rq.wqe_cnt = 0;
qp->rq.wqe_shift = 0;
+ cap->max_recv_wr = 0;
+ cap->max_recv_sge = 0;
} else {
if (ucmd) {
qp->rq.wqe_cnt = ucmd->rq_wqe_count;
@@ -2433,17 +2435,19 @@ int mlx5_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr
qp_attr->cap.max_recv_sge = qp->rq.max_gs;
if (!ibqp->uobject) {
- qp_attr->cap.max_send_wr = qp->sq.wqe_cnt;
+ qp_attr->cap.max_send_wr = qp->sq.max_post;
qp_attr->cap.max_send_sge = qp->sq.max_gs;
+ qp_init_attr->qp_context = ibqp->qp_context;
} else {
qp_attr->cap.max_send_wr = 0;
qp_attr->cap.max_send_sge = 0;
}
- /* We don't support inline sends for kernel QPs (yet), and we
- * don't know what userspace's value should be.
- */
- qp_attr->cap.max_inline_data = 0;
+ qp_init_attr->qp_type = ibqp->qp_type;
+ qp_init_attr->recv_cq = ibqp->recv_cq;
+ qp_init_attr->send_cq = ibqp->send_cq;
+ qp_init_attr->srq = ibqp->srq;
+ qp_attr->cap.max_inline_data = qp->max_inline_data;
qp_init_attr->cap = qp_attr->cap;
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to 3.12-stable] IB/mlx5: Fix post send fence logic
2016-08-19 6:52 [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon Jiri Slaby
` (3 preceding siblings ...)
2016-08-19 6:53 ` [patch added to 3.12-stable] IB/mlx5: Fix returned values of query QP Jiri Slaby
@ 2016-08-19 6:53 ` Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] IB/IPoIB: Don't update neigh validity for unresolved entries Jiri Slaby
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2016-08-19 6:53 UTC (permalink / raw)
To: stable; +Cc: Eli Cohen, Leon Romanovsky, Doug Ledford, Jiri Slaby
From: Eli Cohen <eli@mellanox.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit c9b254955b9f8814966f5dabd34c39d0e0a2b437 upstream.
If the caller specified IB_SEND_FENCE in the send flags of the work
request and no previous work request stated that the successive one
should be fenced, the work request would be executed without a fence.
This could result in RDMA read or atomic operations failure due to a MR
being invalidated. Fix this by adding the mlx5 enumeration for fencing
RDMA/atomic operations and fix the logic to apply this.
Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/infiniband/hw/mlx5/qp.c | 7 ++++---
include/linux/mlx5/qp.h | 1 +
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 7ece1059f263..2b5fac5c34f6 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -1971,10 +1971,11 @@ static u8 get_fence(u8 fence, struct ib_send_wr *wr)
return MLX5_FENCE_MODE_SMALL_AND_FENCE;
else
return fence;
-
- } else {
- return 0;
+ } else if (unlikely(wr->send_flags & IB_SEND_FENCE)) {
+ return MLX5_FENCE_MODE_FENCE;
}
+
+ return 0;
}
int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index 4cf637bd42ab..8720a044dfbe 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -137,6 +137,7 @@ enum {
enum {
MLX5_FENCE_MODE_NONE = 0 << 5,
MLX5_FENCE_MODE_INITIATOR_SMALL = 1 << 5,
+ MLX5_FENCE_MODE_FENCE = 2 << 5,
MLX5_FENCE_MODE_STRONG_ORDERING = 3 << 5,
MLX5_FENCE_MODE_SMALL_AND_FENCE = 4 << 5,
};
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to 3.12-stable] IB/IPoIB: Don't update neigh validity for unresolved entries
2016-08-19 6:52 [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon Jiri Slaby
` (4 preceding siblings ...)
2016-08-19 6:53 ` [patch added to 3.12-stable] IB/mlx5: Fix post send fence logic Jiri Slaby
@ 2016-08-19 6:53 ` Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] IB/mlx4: Fix the SQ size of an RC QP Jiri Slaby
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2016-08-19 6:53 UTC (permalink / raw)
To: stable; +Cc: Erez Shitrit, Leon Romanovsky, Doug Ledford, Jiri Slaby
From: Erez Shitrit <erezsh@mellanox.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 61c78eea9516a921799c17b4c20558e2aa780fd3 upstream.
ipoib_neigh_get unconditionally updates the "alive" variable member on
any packet send. This prevents the neighbor garbage collection from
cleaning out a dead neighbor entry if we are still queueing packets
for it. If the queue for this neighbor is full, then don't update the
alive timestamp. That way the neighbor can time out even if packets
are still being queued as long as none of them are being sent.
Fixes: b63b70d87741 ("IPoIB: Use a private hash table for path lookup in xmit path")
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/infiniband/ulp/ipoib/ipoib_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 82cec1af902c..9cd105ff2427 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -882,7 +882,9 @@ struct ipoib_neigh *ipoib_neigh_get(struct net_device *dev, u8 *daddr)
neigh = NULL;
goto out_unlock;
}
- neigh->alive = jiffies;
+
+ if (likely(skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE))
+ neigh->alive = jiffies;
goto out_unlock;
}
}
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to 3.12-stable] IB/mlx4: Fix the SQ size of an RC QP
2016-08-19 6:52 [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon Jiri Slaby
` (5 preceding siblings ...)
2016-08-19 6:53 ` [patch added to 3.12-stable] IB/IPoIB: Don't update neigh validity for unresolved entries Jiri Slaby
@ 2016-08-19 6:53 ` Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] ubi: Make volume resize power cut aware Jiri Slaby
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2016-08-19 6:53 UTC (permalink / raw)
To: stable; +Cc: Yishai Hadas, Leon Romanovsky, Doug Ledford, Jiri Slaby
From: Yishai Hadas <yishaih@mellanox.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit f2940e2c76bb554a7fbdd28ca5b90904117a9e96 upstream.
When calculating the required size of an RC QP send queue, leave
enough space for masked atomic operations, which require more space than
"regular" atomic operation.
Fixes: 6fa8f719844b ("IB/mlx4: Add support for masked atomic operations")
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Reviewed-by: Jack Morgenstein <jackm@mellanox.co.il>
Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/infiniband/hw/mlx4/qp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 262a18437ceb..1fe3bdb0da14 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -346,7 +346,7 @@ static int send_wqe_overhead(enum mlx4_ib_qp_type type, u32 flags)
sizeof (struct mlx4_wqe_raddr_seg);
case MLX4_IB_QPT_RC:
return sizeof (struct mlx4_wqe_ctrl_seg) +
- sizeof (struct mlx4_wqe_atomic_seg) +
+ sizeof (struct mlx4_wqe_masked_atomic_seg) +
sizeof (struct mlx4_wqe_raddr_seg);
case MLX4_IB_QPT_SMI:
case MLX4_IB_QPT_GSI:
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to 3.12-stable] ubi: Make volume resize power cut aware
2016-08-19 6:52 [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon Jiri Slaby
` (6 preceding siblings ...)
2016-08-19 6:53 ` [patch added to 3.12-stable] IB/mlx4: Fix the SQ size of an RC QP Jiri Slaby
@ 2016-08-19 6:53 ` Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] ubi: Fix race condition between ubi device creation and udev Jiri Slaby
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2016-08-19 6:53 UTC (permalink / raw)
To: stable; +Cc: Richard Weinberger, Jiri Slaby
From: Richard Weinberger <richard@nod.at>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 4946784bd3924b1374f05eebff2fd68660bae866 upstream.
When the volume resize operation shrinks a volume,
LEBs will be unmapped. Since unmapping will not erase these
LEBs immediately we have to wait for that operation to finish.
Otherwise in case of a power cut right after writing the new
volume table the UBI attach process can find more LEBs than the
volume table knows. This will render the UBI image unattachable.
Fix this issue by waiting for erase to complete and write the new
volume table afterward.
Reported-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/mtd/ubi/vmt.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 8330703c098f..96131eb34c9f 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -534,13 +534,6 @@ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs)
spin_unlock(&ubi->volumes_lock);
}
- /* Change volume table record */
- vtbl_rec = ubi->vtbl[vol_id];
- vtbl_rec.reserved_pebs = cpu_to_be32(reserved_pebs);
- err = ubi_change_vtbl_record(ubi, vol_id, &vtbl_rec);
- if (err)
- goto out_acc;
-
if (pebs < 0) {
for (i = 0; i < -pebs; i++) {
err = ubi_eba_unmap_leb(ubi, vol, reserved_pebs + i);
@@ -558,6 +551,24 @@ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs)
spin_unlock(&ubi->volumes_lock);
}
+ /*
+ * When we shrink a volume we have to flush all pending (erase) work.
+ * Otherwise it can happen that upon next attach UBI finds a LEB with
+ * lnum > highest_lnum and refuses to attach.
+ */
+ if (pebs < 0) {
+ err = ubi_wl_flush(ubi, vol_id, UBI_ALL);
+ if (err)
+ goto out_acc;
+ }
+
+ /* Change volume table record */
+ vtbl_rec = ubi->vtbl[vol_id];
+ vtbl_rec.reserved_pebs = cpu_to_be32(reserved_pebs);
+ err = ubi_change_vtbl_record(ubi, vol_id, &vtbl_rec);
+ if (err)
+ goto out_acc;
+
vol->reserved_pebs = reserved_pebs;
if (vol->vol_type == UBI_DYNAMIC_VOLUME) {
vol->used_ebs = reserved_pebs;
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to 3.12-stable] ubi: Fix race condition between ubi device creation and udev
2016-08-19 6:52 [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon Jiri Slaby
` (7 preceding siblings ...)
2016-08-19 6:53 ` [patch added to 3.12-stable] ubi: Make volume resize power cut aware Jiri Slaby
@ 2016-08-19 6:53 ` Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] Input: i8042 - break load dependency between atkbd/psmouse and i8042 Jiri Slaby
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2016-08-19 6:53 UTC (permalink / raw)
To: stable; +Cc: Iosif Harutyunov, Iosif Harutyunov, Richard Weinberger,
Jiri Slaby
From: Iosif Harutyunov <iharutyunov@SonicWALL.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 714fb87e8bc05ff78255afc0dca981e8c5242785 upstream.
Install the UBI device object before we arm sysfs.
Otherwise udev tries to read sysfs attributes before UBI is ready and
udev rules will not match.
Signed-off-by: Iosif Harutyunov <iharutyunov@sonicwall.com>
[rw: massaged commit message]
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/mtd/ubi/build.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 315dcc6ec1f5..9b89f3dd112c 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -998,6 +998,9 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
goto out_detach;
}
+ /* Make device "available" before it becomes accessible via sysfs */
+ ubi_devices[ubi_num] = ubi;
+
err = uif_init(ubi, &ref);
if (err)
goto out_detach;
@@ -1042,7 +1045,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
wake_up_process(ubi->bgt_thread);
spin_unlock(&ubi->wl_lock);
- ubi_devices[ubi_num] = ubi;
ubi_notify_all(ubi, UBI_VOLUME_ADDED, NULL);
return ubi_num;
@@ -1053,6 +1055,7 @@ out_uif:
ubi_assert(ref);
uif_close(ubi);
out_detach:
+ ubi_devices[ubi_num] = NULL;
ubi_wl_close(ubi);
ubi_free_internal_volumes(ubi);
vfree(ubi->vtbl);
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to 3.12-stable] Input: i8042 - break load dependency between atkbd/psmouse and i8042
2016-08-19 6:52 [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon Jiri Slaby
` (8 preceding siblings ...)
2016-08-19 6:53 ` [patch added to 3.12-stable] ubi: Fix race condition between ubi device creation and udev Jiri Slaby
@ 2016-08-19 6:53 ` Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] dm flakey: error READ bios during the down_interval Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] module: Invalidate signatures on force-loaded modules Jiri Slaby
11 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2016-08-19 6:53 UTC (permalink / raw)
To: stable; +Cc: Dmitry Torokhov, Jiri Slaby
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 4097461897df91041382ff6fcd2bfa7ee6b2448c upstream.
As explained in 1407814240-4275-1-git-send-email-decui@microsoft.com we
have a hard load dependency between i8042 and atkbd which prevents
keyboard from working on Gen2 Hyper-V VMs.
> hyperv_keyboard invokes serio_interrupt(), which needs a valid serio
> driver like atkbd.c. atkbd.c depends on libps2.c because it invokes
> ps2_command(). libps2.c depends on i8042.c because it invokes
> i8042_check_port_owner(). As a result, hyperv_keyboard actually
> depends on i8042.c.
>
> For a Generation 2 Hyper-V VM (meaning no i8042 device emulated), if a
> Linux VM (like Arch Linux) happens to configure CONFIG_SERIO_I8042=m
> rather than =y, atkbd.ko can't load because i8042.ko can't load(due to
> no i8042 device emulated) and finally hyperv_keyboard can't work and
> the user can't input: https://bugs.archlinux.org/task/39820
> (Ubuntu/RHEL/SUSE aren't affected since they use CONFIG_SERIO_I8042=y)
To break the dependency we move away from using i8042_check_port_owner()
and instead allow serio port owner specify a mutex that clients should use
to serialize PS/2 command stream.
Reported-by: Mark Laws <mdl@60hz.org>
Tested-by: Mark Laws <mdl@60hz.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/input/serio/i8042.c | 16 +---------------
drivers/input/serio/libps2.c | 10 ++++------
include/linux/i8042.h | 6 ------
include/linux/serio.h | 24 +++++++++++++++++++-----
4 files changed, 24 insertions(+), 32 deletions(-)
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 42825216e83d..7ecca05bd7a5 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1230,6 +1230,7 @@ static int __init i8042_create_kbd_port(void)
serio->start = i8042_start;
serio->stop = i8042_stop;
serio->close = i8042_port_close;
+ serio->ps2_cmd_mutex = &i8042_mutex;
serio->port_data = port;
serio->dev.parent = &i8042_platform_device->dev;
strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name));
@@ -1321,21 +1322,6 @@ static void i8042_unregister_ports(void)
}
}
-/*
- * Checks whether port belongs to i8042 controller.
- */
-bool i8042_check_port_owner(const struct serio *port)
-{
- int i;
-
- for (i = 0; i < I8042_NUM_PORTS; i++)
- if (i8042_ports[i].serio == port)
- return true;
-
- return false;
-}
-EXPORT_SYMBOL(i8042_check_port_owner);
-
static void i8042_free_irqs(void)
{
if (i8042_aux_irq_registered)
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c
index 07a8363f3c5c..b5ec313cb9c9 100644
--- a/drivers/input/serio/libps2.c
+++ b/drivers/input/serio/libps2.c
@@ -57,19 +57,17 @@ EXPORT_SYMBOL(ps2_sendbyte);
void ps2_begin_command(struct ps2dev *ps2dev)
{
- mutex_lock(&ps2dev->cmd_mutex);
+ struct mutex *m = ps2dev->serio->ps2_cmd_mutex ?: &ps2dev->cmd_mutex;
- if (i8042_check_port_owner(ps2dev->serio))
- i8042_lock_chip();
+ mutex_lock(m);
}
EXPORT_SYMBOL(ps2_begin_command);
void ps2_end_command(struct ps2dev *ps2dev)
{
- if (i8042_check_port_owner(ps2dev->serio))
- i8042_unlock_chip();
+ struct mutex *m = ps2dev->serio->ps2_cmd_mutex ?: &ps2dev->cmd_mutex;
- mutex_unlock(&ps2dev->cmd_mutex);
+ mutex_unlock(m);
}
EXPORT_SYMBOL(ps2_end_command);
diff --git a/include/linux/i8042.h b/include/linux/i8042.h
index 0f9bafa17a02..d98780ca9604 100644
--- a/include/linux/i8042.h
+++ b/include/linux/i8042.h
@@ -62,7 +62,6 @@ struct serio;
void i8042_lock_chip(void);
void i8042_unlock_chip(void);
int i8042_command(unsigned char *param, int command);
-bool i8042_check_port_owner(const struct serio *);
int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
struct serio *serio));
int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
@@ -83,11 +82,6 @@ static inline int i8042_command(unsigned char *param, int command)
return -ENODEV;
}
-static inline bool i8042_check_port_owner(const struct serio *serio)
-{
- return false;
-}
-
static inline int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
struct serio *serio))
{
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 9f779c7a2da4..27ae809edd70 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -29,7 +29,8 @@ struct serio {
struct serio_device_id id;
- spinlock_t lock; /* protects critical sections from port's interrupt handler */
+ /* Protects critical sections from port's interrupt handler */
+ spinlock_t lock;
int (*write)(struct serio *, unsigned char);
int (*open)(struct serio *);
@@ -38,16 +39,29 @@ struct serio {
void (*stop)(struct serio *);
struct serio *parent;
- struct list_head child_node; /* Entry in parent->children list */
+ /* Entry in parent->children list */
+ struct list_head child_node;
struct list_head children;
- unsigned int depth; /* level of nesting in serio hierarchy */
+ /* Level of nesting in serio hierarchy */
+ unsigned int depth;
- struct serio_driver *drv; /* accessed from interrupt, must be protected by serio->lock and serio->sem */
- struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */
+ /*
+ * serio->drv is accessed from interrupt handlers; when modifying
+ * caller should acquire serio->drv_mutex and serio->lock.
+ */
+ struct serio_driver *drv;
+ /* Protects serio->drv so attributes can pin current driver */
+ struct mutex drv_mutex;
struct device dev;
struct list_head node;
+
+ /*
+ * For use by PS/2 layer when several ports share hardware and
+ * may get indigestion when exposed to concurrent access (i8042).
+ */
+ struct mutex *ps2_cmd_mutex;
};
#define to_serio_port(d) container_of(d, struct serio, dev)
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to 3.12-stable] dm flakey: error READ bios during the down_interval
2016-08-19 6:52 [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon Jiri Slaby
` (9 preceding siblings ...)
2016-08-19 6:53 ` [patch added to 3.12-stable] Input: i8042 - break load dependency between atkbd/psmouse and i8042 Jiri Slaby
@ 2016-08-19 6:53 ` Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] module: Invalidate signatures on force-loaded modules Jiri Slaby
11 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2016-08-19 6:53 UTC (permalink / raw)
To: stable; +Cc: Mike Snitzer, Jiri Slaby
From: Mike Snitzer <snitzer@redhat.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 99f3c90d0d85708e7401a81ce3314e50bf7f2819 upstream.
When the corrupt_bio_byte feature was introduced it caused READ bios to
no longer be errored with -EIO during the down_interval. This had to do
with the complexity of needing to submit READs if the corrupt_bio_byte
feature was used.
Fix it so READ bios are properly errored with -EIO; doing so early in
flakey_map() as long as there isn't a match for the corrupt_bio_byte
feature.
Fixes: a3998799fb4df ("dm flakey: add corrupt_bio_byte feature")
Reported-by: Akira Hayakawa <ruby.wktk@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/md/dm-flakey.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c
index c80a0ec5f126..8e36248f729f 100644
--- a/drivers/md/dm-flakey.c
+++ b/drivers/md/dm-flakey.c
@@ -286,10 +286,16 @@ static int flakey_map(struct dm_target *ti, struct bio *bio)
pb->bio_submitted = true;
/*
- * Map reads as normal.
+ * Map reads as normal only if corrupt_bio_byte set.
*/
- if (bio_data_dir(bio) == READ)
- goto map_bio;
+ if (bio_data_dir(bio) == READ) {
+ /* If flags were specified, only corrupt those that match. */
+ if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) &&
+ all_corrupt_bio_flags_match(bio, fc))
+ goto map_bio;
+ else
+ return -EIO;
+ }
/*
* Drop writes?
@@ -327,12 +333,13 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error)
/*
* Corrupt successful READs while in down state.
- * If flags were specified, only corrupt those that match.
*/
- if (fc->corrupt_bio_byte && !error && pb->bio_submitted &&
- (bio_data_dir(bio) == READ) && (fc->corrupt_bio_rw == READ) &&
- all_corrupt_bio_flags_match(bio, fc))
- corrupt_bio_data(bio, fc);
+ if (!error && pb->bio_submitted && (bio_data_dir(bio) == READ)) {
+ if (fc->corrupt_bio_byte)
+ corrupt_bio_data(bio, fc);
+ else
+ return -EIO;
+ }
return error;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to 3.12-stable] module: Invalidate signatures on force-loaded modules
2016-08-19 6:52 [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon Jiri Slaby
` (10 preceding siblings ...)
2016-08-19 6:53 ` [patch added to 3.12-stable] dm flakey: error READ bios during the down_interval Jiri Slaby
@ 2016-08-19 6:53 ` Jiri Slaby
11 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2016-08-19 6:53 UTC (permalink / raw)
To: stable; +Cc: Ben Hutchings, Rusty Russell, Jiri Slaby
From: Ben Hutchings <ben@decadent.org.uk>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit bca014caaa6130e57f69b5bf527967aa8ee70fdd upstream.
Signing a module should only make it trusted by the specific kernel it
was built for, not anything else. Loading a signed module meant for a
kernel with a different ABI could have interesting effects.
Therefore, treat all signatures as invalid when a module is
force-loaded.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
kernel/module.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/kernel/module.c b/kernel/module.c
index ec40f03aa473..a8c4d4163a41 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2491,13 +2491,18 @@ static inline void kmemleak_load_module(const struct module *mod,
#endif
#ifdef CONFIG_MODULE_SIG
-static int module_sig_check(struct load_info *info)
+static int module_sig_check(struct load_info *info, int flags)
{
int err = -ENOKEY;
const unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1;
const void *mod = info->hdr;
- if (info->len > markerlen &&
+ /*
+ * Require flags == 0, as a module with version information
+ * removed is no longer the module that was signed
+ */
+ if (flags == 0 &&
+ info->len > markerlen &&
memcmp(mod + info->len - markerlen, MODULE_SIG_STRING, markerlen) == 0) {
/* We truncate the module to discard the signature */
info->len -= markerlen;
@@ -2519,7 +2524,7 @@ static int module_sig_check(struct load_info *info)
return err;
}
#else /* !CONFIG_MODULE_SIG */
-static int module_sig_check(struct load_info *info)
+static int module_sig_check(struct load_info *info, int flags)
{
return 0;
}
@@ -3247,7 +3252,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
struct module *mod;
long err;
- err = module_sig_check(info);
+ err = module_sig_check(info, flags);
if (err)
goto free_copy;
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2016-08-19 6:53 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-19 6:52 [patch added to 3.12-stable] balloon: check the number of available pages in leak balloon Jiri Slaby
2016-08-19 6:52 ` [patch added to 3.12-stable] ftrace/recordmcount: Work around for addition of metag magic but not relocations Jiri Slaby
2016-08-19 6:52 ` [patch added to 3.12-stable] metag: Fix __cmpxchg_u32 asm constraint for CMP Jiri Slaby
2016-08-19 6:52 ` [patch added to 3.12-stable] IB/mlx5: Fix MODIFY_QP command input structure Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] IB/mlx5: Fix returned values of query QP Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] IB/mlx5: Fix post send fence logic Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] IB/IPoIB: Don't update neigh validity for unresolved entries Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] IB/mlx4: Fix the SQ size of an RC QP Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] ubi: Make volume resize power cut aware Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] ubi: Fix race condition between ubi device creation and udev Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] Input: i8042 - break load dependency between atkbd/psmouse and i8042 Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] dm flakey: error READ bios during the down_interval Jiri Slaby
2016-08-19 6:53 ` [patch added to 3.12-stable] module: Invalidate signatures on force-loaded modules Jiri Slaby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).