From: Sasha Levin Date: Sun, 4 Oct 2020 22:23:49 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v4.19.150~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aed7def6502a65be6173b958f926f0f69ddc5f71;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/clocksource-drivers-timer-gx6605s-fixup-counter-relo.patch b/queue-5.4/clocksource-drivers-timer-gx6605s-fixup-counter-relo.patch new file mode 100644 index 00000000000..d059bd6803f --- /dev/null +++ b/queue-5.4/clocksource-drivers-timer-gx6605s-fixup-counter-relo.patch @@ -0,0 +1,41 @@ +From 996357e6e9a440f0f775f12ff232910197ce9750 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 Aug 2020 07:31:17 +0000 +Subject: clocksource/drivers/timer-gx6605s: Fixup counter reload + +From: Guo Ren + +[ Upstream commit bc6717d55d07110d8f3c6d31ec2af50c11b07091 ] + +When the timer counts to the upper limit, an overflow interrupt is +generated, and the count is reset with the value in the TIME_INI +register. But the software expects to start counting from 0 when +the count overflows, so it forces TIME_INI to 0 to solve the +potential interrupt storm problem. + +Signed-off-by: Guo Ren +Tested-by: Xu Kai +Cc: Daniel Lezcano +Cc: Thomas Gleixner +Signed-off-by: Daniel Lezcano +Link: https://lore.kernel.org/r/1597735877-71115-1-git-send-email-guoren@kernel.org +Signed-off-by: Sasha Levin +--- + drivers/clocksource/timer-gx6605s.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/clocksource/timer-gx6605s.c b/drivers/clocksource/timer-gx6605s.c +index 80d0939d040b5..8d386adbe8009 100644 +--- a/drivers/clocksource/timer-gx6605s.c ++++ b/drivers/clocksource/timer-gx6605s.c +@@ -28,6 +28,7 @@ static irqreturn_t gx6605s_timer_interrupt(int irq, void *dev) + void __iomem *base = timer_of_base(to_timer_of(ce)); + + writel_relaxed(GX6605S_STATUS_CLR, base + TIMER_STATUS); ++ writel_relaxed(0, base + TIMER_INI); + + ce->event_handler(ce); + +-- +2.25.1 + diff --git a/queue-5.4/drivers-net-wan-hdlc-set-skb-protocol-before-transmi.patch b/queue-5.4/drivers-net-wan-hdlc-set-skb-protocol-before-transmi.patch new file mode 100644 index 00000000000..0ff141beff9 --- /dev/null +++ b/queue-5.4/drivers-net-wan-hdlc-set-skb-protocol-before-transmi.patch @@ -0,0 +1,106 @@ +From e140e47132028c5c0cbe4d176724238b91e043e2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 16 Sep 2020 14:25:07 -0700 +Subject: drivers/net/wan/hdlc: Set skb->protocol before transmitting + +From: Xie He + +[ Upstream commit 9fb030a70431a2a2a1b292dbf0b2f399cc072c16 ] + +This patch sets skb->protocol before transmitting frames on the HDLC +device, so that a user listening on the HDLC device with an AF_PACKET +socket will see outgoing frames' sll_protocol field correctly set and +consistent with that of incoming frames. + +1. Control frames in hdlc_cisco and hdlc_ppp + +When these drivers send control frames, skb->protocol is not set. + +This value should be set to htons(ETH_P_HDLC), because when receiving +control frames, their skb->protocol is set to htons(ETH_P_HDLC). + +When receiving, hdlc_type_trans in hdlc.h is called, which then calls +cisco_type_trans or ppp_type_trans. The skb->protocol of control frames +is set to htons(ETH_P_HDLC) so that the control frames can be received +by hdlc_rcv in hdlc.c, which calls cisco_rx or ppp_rx to process the +control frames. + +2. hdlc_fr + +When this driver sends control frames, skb->protocol is set to internal +values used in this driver. + +When this driver sends data frames (from upper stacked PVC devices), +skb->protocol is the same as that of the user data packet being sent on +the upper PVC device (for normal PVC devices), or is htons(ETH_P_802_3) +(for Ethernet-emulating PVC devices). + +However, skb->protocol for both control frames and data frames should be +set to htons(ETH_P_HDLC), because when receiving, all frames received on +the HDLC device will have their skb->protocol set to htons(ETH_P_HDLC). + +When receiving, hdlc_type_trans in hdlc.h is called, and because this +driver doesn't provide a type_trans function in struct hdlc_proto, +all frames will have their skb->protocol set to htons(ETH_P_HDLC). +The frames are then received by hdlc_rcv in hdlc.c, which calls fr_rx +to process the frames (control frames are consumed and data frames +are re-received on upper PVC devices). + +Cc: Krzysztof Halasa +Signed-off-by: Xie He +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/wan/hdlc_cisco.c | 1 + + drivers/net/wan/hdlc_fr.c | 3 +++ + drivers/net/wan/hdlc_ppp.c | 1 + + 3 files changed, 5 insertions(+) + +diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c +index cc33441af4691..50804d0473083 100644 +--- a/drivers/net/wan/hdlc_cisco.c ++++ b/drivers/net/wan/hdlc_cisco.c +@@ -118,6 +118,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type, + skb_put(skb, sizeof(struct cisco_packet)); + skb->priority = TC_PRIO_CONTROL; + skb->dev = dev; ++ skb->protocol = htons(ETH_P_HDLC); + skb_reset_network_header(skb); + + dev_queue_xmit(skb); +diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c +index 12b35404cd8e7..d6cfd51613ed8 100644 +--- a/drivers/net/wan/hdlc_fr.c ++++ b/drivers/net/wan/hdlc_fr.c +@@ -433,6 +433,8 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev) + if (pvc->state.fecn) /* TX Congestion counter */ + dev->stats.tx_compressed++; + skb->dev = pvc->frad; ++ skb->protocol = htons(ETH_P_HDLC); ++ skb_reset_network_header(skb); + dev_queue_xmit(skb); + return NETDEV_TX_OK; + } +@@ -555,6 +557,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep) + skb_put(skb, i); + skb->priority = TC_PRIO_CONTROL; + skb->dev = dev; ++ skb->protocol = htons(ETH_P_HDLC); + skb_reset_network_header(skb); + + dev_queue_xmit(skb); +diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c +index 16f33d1ffbfb9..64f8556513369 100644 +--- a/drivers/net/wan/hdlc_ppp.c ++++ b/drivers/net/wan/hdlc_ppp.c +@@ -251,6 +251,7 @@ static void ppp_tx_cp(struct net_device *dev, u16 pid, u8 code, + + skb->priority = TC_PRIO_CONTROL; + skb->dev = dev; ++ skb->protocol = htons(ETH_P_HDLC); + skb_reset_network_header(skb); + skb_queue_tail(&tx_queue, skb); + } +-- +2.25.1 + diff --git a/queue-5.4/drivers-net-wan-hdlc_fr-add-needed_headroom-for-pvc-.patch b/queue-5.4/drivers-net-wan-hdlc_fr-add-needed_headroom-for-pvc-.patch new file mode 100644 index 00000000000..dd345d0b263 --- /dev/null +++ b/queue-5.4/drivers-net-wan-hdlc_fr-add-needed_headroom-for-pvc-.patch @@ -0,0 +1,59 @@ +From 09409599970b0ba685e065834c84a3d0256ecba8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 2 Sep 2020 17:06:58 -0700 +Subject: drivers/net/wan/hdlc_fr: Add needed_headroom for PVC devices + +From: Xie He + +[ Upstream commit 44a049c42681de71c783d75cd6e56b4e339488b0 ] + +PVC devices are virtual devices in this driver stacked on top of the +actual HDLC device. They are the devices normal users would use. +PVC devices have two types: normal PVC devices and Ethernet-emulating +PVC devices. + +When transmitting data with PVC devices, the ndo_start_xmit function +will prepend a header of 4 or 10 bytes. Currently this driver requests +this headroom to be reserved for normal PVC devices by setting their +hard_header_len to 10. However, this does not work when these devices +are used with AF_PACKET/RAW sockets. Also, this driver does not request +this headroom for Ethernet-emulating PVC devices (but deals with this +problem by reallocating the skb when needed, which is not optimal). + +This patch replaces hard_header_len with needed_headroom, and set +needed_headroom for Ethernet-emulating PVC devices, too. This makes +the driver to request headroom for all PVC devices in all cases. + +Cc: Krzysztof Halasa +Cc: Martin Schiller +Signed-off-by: Xie He +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/wan/hdlc_fr.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c +index 9acad651ea1f6..12b35404cd8e7 100644 +--- a/drivers/net/wan/hdlc_fr.c ++++ b/drivers/net/wan/hdlc_fr.c +@@ -1041,7 +1041,7 @@ static void pvc_setup(struct net_device *dev) + { + dev->type = ARPHRD_DLCI; + dev->flags = IFF_POINTOPOINT; +- dev->hard_header_len = 10; ++ dev->hard_header_len = 0; + dev->addr_len = 2; + netif_keep_dst(dev); + } +@@ -1093,6 +1093,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) + dev->mtu = HDLC_MAX_MTU; + dev->min_mtu = 68; + dev->max_mtu = HDLC_MAX_MTU; ++ dev->needed_headroom = 10; + dev->priv_flags |= IFF_NO_QUEUE; + dev->ml_priv = pvc; + +-- +2.25.1 + diff --git a/queue-5.4/drivers-net-wan-lapbether-make-skb-protocol-consiste.patch b/queue-5.4/drivers-net-wan-lapbether-make-skb-protocol-consiste.patch new file mode 100644 index 00000000000..e98a8661a43 --- /dev/null +++ b/queue-5.4/drivers-net-wan-lapbether-make-skb-protocol-consiste.patch @@ -0,0 +1,58 @@ +From 98bfd66549f316fb443987416a84f3ce57ff1995 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 16 Sep 2020 09:49:18 -0700 +Subject: drivers/net/wan/lapbether: Make skb->protocol consistent with the + header + +From: Xie He + +[ Upstream commit 83f9a9c8c1edc222846dc1bde6e3479703e8e5a3 ] + +This driver is a virtual driver stacked on top of Ethernet interfaces. + +When this driver transmits data on the Ethernet device, the skb->protocol +setting is inconsistent with the Ethernet header prepended to the skb. + +This causes a user listening on the Ethernet interface with an AF_PACKET +socket, to see different sll_protocol values for incoming and outgoing +frames, because incoming frames would have this value set by parsing the +Ethernet header. + +This patch changes the skb->protocol value for outgoing Ethernet frames, +making it consistent with the Ethernet header prepended. This makes a +user listening on the Ethernet device with an AF_PACKET socket, to see +the same sll_protocol value for incoming and outgoing frames. + +Cc: Martin Schiller +Signed-off-by: Xie He +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/wan/lapbether.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c +index 2cff914aada55..709e3de0f6af1 100644 +--- a/drivers/net/wan/lapbether.c ++++ b/drivers/net/wan/lapbether.c +@@ -198,8 +198,6 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) + struct net_device *dev; + int size = skb->len; + +- skb->protocol = htons(ETH_P_X25); +- + ptr = skb_push(skb, 2); + + *ptr++ = size % 256; +@@ -210,6 +208,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) + + skb->dev = dev = lapbeth->ethdev; + ++ skb->protocol = htons(ETH_P_DEC); ++ + skb_reset_network_header(skb); + + dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0); +-- +2.25.1 + diff --git a/queue-5.4/drm-sun4i-mixer-extend-regmap-max_register.patch b/queue-5.4/drm-sun4i-mixer-extend-regmap-max_register.patch new file mode 100644 index 00000000000..39f19adf4cd --- /dev/null +++ b/queue-5.4/drm-sun4i-mixer-extend-regmap-max_register.patch @@ -0,0 +1,36 @@ +From dfc62fad8b7c2ca94d90c78f2619724e27392815 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 6 Sep 2020 18:21:40 +0200 +Subject: drm/sun4i: mixer: Extend regmap max_register + +From: Martin Cerveny + +[ Upstream commit 74ea06164cda81dc80e97790164ca533fd7e3087 ] + +Better guess. Secondary CSC registers are from 0xF0000. + +Signed-off-by: Martin Cerveny +Reviewed-by: Jernej Skrabec +Signed-off-by: Maxime Ripard +Link: https://patchwork.freedesktop.org/patch/msgid/20200906162140.5584-3-m.cerveny@computer.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/sun4i/sun8i_mixer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c +index 18b4881f44814..12b99ba575017 100644 +--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c ++++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c +@@ -396,7 +396,7 @@ static struct regmap_config sun8i_mixer_regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +- .max_register = 0xbfffc, /* guessed */ ++ .max_register = 0xffffc, /* guessed */ + }; + + static int sun8i_mixer_of_get_id(struct device_node *node) +-- +2.25.1 + diff --git a/queue-5.4/fuse-fix-the-direct_io-treatment-of-iov_iter.patch b/queue-5.4/fuse-fix-the-direct_io-treatment-of-iov_iter.patch new file mode 100644 index 00000000000..d51cf2e7d03 --- /dev/null +++ b/queue-5.4/fuse-fix-the-direct_io-treatment-of-iov_iter.patch @@ -0,0 +1,92 @@ +From 1515c7a072a32f0a13769607c970501b7c9cb70f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 17 Sep 2020 17:26:56 -0400 +Subject: fuse: fix the ->direct_IO() treatment of iov_iter + +From: Al Viro + +[ Upstream commit 933a3752babcf6513117d5773d2b70782d6ad149 ] + +the callers rely upon having any iov_iter_truncate() done inside +->direct_IO() countered by iov_iter_reexpand(). + +Reported-by: Qian Cai +Tested-by: Qian Cai +Signed-off-by: Al Viro +Signed-off-by: Sasha Levin +--- + fs/fuse/file.c | 25 ++++++++++++------------- + 1 file changed, 12 insertions(+), 13 deletions(-) + +diff --git a/fs/fuse/file.c b/fs/fuse/file.c +index f8d8a8e34b808..ab4fc1255aca8 100644 +--- a/fs/fuse/file.c ++++ b/fs/fuse/file.c +@@ -3074,11 +3074,10 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) + ssize_t ret = 0; + struct file *file = iocb->ki_filp; + struct fuse_file *ff = file->private_data; +- bool async_dio = ff->fc->async_dio; + loff_t pos = 0; + struct inode *inode; + loff_t i_size; +- size_t count = iov_iter_count(iter); ++ size_t count = iov_iter_count(iter), shortened = 0; + loff_t offset = iocb->ki_pos; + struct fuse_io_priv *io; + +@@ -3086,17 +3085,9 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) + inode = file->f_mapping->host; + i_size = i_size_read(inode); + +- if ((iov_iter_rw(iter) == READ) && (offset > i_size)) ++ if ((iov_iter_rw(iter) == READ) && (offset >= i_size)) + return 0; + +- /* optimization for short read */ +- if (async_dio && iov_iter_rw(iter) != WRITE && offset + count > i_size) { +- if (offset >= i_size) +- return 0; +- iov_iter_truncate(iter, fuse_round_up(ff->fc, i_size - offset)); +- count = iov_iter_count(iter); +- } +- + io = kmalloc(sizeof(struct fuse_io_priv), GFP_KERNEL); + if (!io) + return -ENOMEM; +@@ -3112,15 +3103,22 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) + * By default, we want to optimize all I/Os with async request + * submission to the client filesystem if supported. + */ +- io->async = async_dio; ++ io->async = ff->fc->async_dio; + io->iocb = iocb; + io->blocking = is_sync_kiocb(iocb); + ++ /* optimization for short read */ ++ if (io->async && !io->write && offset + count > i_size) { ++ iov_iter_truncate(iter, fuse_round_up(ff->fc, i_size - offset)); ++ shortened = count - iov_iter_count(iter); ++ count -= shortened; ++ } ++ + /* + * We cannot asynchronously extend the size of a file. + * In such case the aio will behave exactly like sync io. + */ +- if ((offset + count > i_size) && iov_iter_rw(iter) == WRITE) ++ if ((offset + count > i_size) && io->write) + io->blocking = true; + + if (io->async && io->blocking) { +@@ -3138,6 +3136,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) + } else { + ret = __fuse_direct_read(io, iter, &pos); + } ++ iov_iter_reexpand(iter, iov_iter_count(iter) + shortened); + + if (io->async) { + bool blocking = io->blocking; +-- +2.25.1 + diff --git a/queue-5.4/libbpf-remove-arch-specific-include-path-in-makefile.patch b/queue-5.4/libbpf-remove-arch-specific-include-path-in-makefile.patch new file mode 100644 index 00000000000..96107facb86 --- /dev/null +++ b/queue-5.4/libbpf-remove-arch-specific-include-path-in-makefile.patch @@ -0,0 +1,64 @@ +From fa80316585d6c489be502976d345d01d8177f8aa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 2 Sep 2020 14:12:46 +0530 +Subject: libbpf: Remove arch-specific include path in Makefile + +From: Naveen N. Rao + +[ Upstream commit 21e9ba5373fc2cec608fd68301a1dbfd14df3172 ] + +Ubuntu mainline builds for ppc64le are failing with the below error (*): + CALL /home/kernel/COD/linux/scripts/atomic/check-atomics.sh + DESCEND bpf/resolve_btfids + + Auto-detecting system features: + ... libelf: [ [32mon[m ] + ... zlib: [ [32mon[m ] + ... bpf: [ [31mOFF[m ] + + BPF API too old + make[6]: *** [Makefile:295: bpfdep] Error 1 + make[5]: *** [Makefile:54: /home/kernel/COD/linux/debian/build/build-generic/tools/bpf/resolve_btfids//libbpf.a] Error 2 + make[4]: *** [Makefile:71: bpf/resolve_btfids] Error 2 + make[3]: *** [/home/kernel/COD/linux/Makefile:1890: tools/bpf/resolve_btfids] Error 2 + make[2]: *** [/home/kernel/COD/linux/Makefile:335: __build_one_by_one] Error 2 + make[2]: Leaving directory '/home/kernel/COD/linux/debian/build/build-generic' + make[1]: *** [Makefile:185: __sub-make] Error 2 + make[1]: Leaving directory '/home/kernel/COD/linux' + +resolve_btfids needs to be build as a host binary and it needs libbpf. +However, libbpf Makefile hardcodes an include path utilizing $(ARCH). +This results in mixing of cross-architecture headers resulting in a +build failure. + +The specific header include path doesn't seem necessary for a libbpf +build. Hence, remove the same. + +(*) https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.9-rc3/ppc64el/log + +Reported-by: Vaidyanathan Srinivasan +Signed-off-by: Naveen N. Rao +Signed-off-by: Daniel Borkmann +Acked-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/20200902084246.1513055-1-naveen.n.rao@linux.vnet.ibm.com +Signed-off-by: Sasha Levin +--- + tools/lib/bpf/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile +index d045707e7c9a4..283caeaaffc30 100644 +--- a/tools/lib/bpf/Makefile ++++ b/tools/lib/bpf/Makefile +@@ -59,7 +59,7 @@ FEATURE_USER = .libbpf + FEATURE_TESTS = libelf libelf-mmap bpf reallocarray cxx + FEATURE_DISPLAY = libelf bpf + +-INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi ++INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi + FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES) + + check_feat := 1 +-- +2.25.1 + diff --git a/queue-5.4/mac80211-do-not-allow-bigger-vht-mpdus-than-the-hard.patch b/queue-5.4/mac80211-do-not-allow-bigger-vht-mpdus-than-the-hard.patch new file mode 100644 index 00000000000..87557ac4f0b --- /dev/null +++ b/queue-5.4/mac80211-do-not-allow-bigger-vht-mpdus-than-the-hard.patch @@ -0,0 +1,48 @@ +From 6a9ddf030158421d41f7321b6641e54c4da82044 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 17 Sep 2020 14:50:31 +0200 +Subject: mac80211: do not allow bigger VHT MPDUs than the hardware supports + +From: Felix Fietkau + +[ Upstream commit 3bd5c7a28a7c3aba07a2d300d43f8e988809e147 ] + +Limit maximum VHT MPDU size by local capability. + +Signed-off-by: Felix Fietkau +Link: https://lore.kernel.org/r/20200917125031.45009-1-nbd@nbd.name +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/vht.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c +index ccdcb9ad9ac72..aabc63dadf176 100644 +--- a/net/mac80211/vht.c ++++ b/net/mac80211/vht.c +@@ -168,10 +168,7 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, + /* take some capabilities as-is */ + cap_info = le32_to_cpu(vht_cap_ie->vht_cap_info); + vht_cap->cap = cap_info; +- vht_cap->cap &= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 | +- IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 | +- IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 | +- IEEE80211_VHT_CAP_RXLDPC | ++ vht_cap->cap &= IEEE80211_VHT_CAP_RXLDPC | + IEEE80211_VHT_CAP_VHT_TXOP_PS | + IEEE80211_VHT_CAP_HTC_VHT | + IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK | +@@ -180,6 +177,9 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, + IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN | + IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; + ++ vht_cap->cap |= min_t(u32, cap_info & IEEE80211_VHT_CAP_MAX_MPDU_MASK, ++ own_cap.cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK); ++ + /* and some based on our own capabilities */ + switch (own_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { + case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ: +-- +2.25.1 + diff --git a/queue-5.4/mac80211-fix-radiotap-header-channel-flag-for-6ghz-b.patch b/queue-5.4/mac80211-fix-radiotap-header-channel-flag-for-6ghz-b.patch new file mode 100644 index 00000000000..a3f125e7539 --- /dev/null +++ b/queue-5.4/mac80211-fix-radiotap-header-channel-flag-for-6ghz-b.patch @@ -0,0 +1,38 @@ +From 2d598ddc0fac041161a3b4069bbc939384a9101e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 11 Sep 2020 01:11:35 +0000 +Subject: mac80211: Fix radiotap header channel flag for 6GHz band + +From: Aloka Dixit + +[ Upstream commit 412a84b5714af56f3eb648bba155107b5edddfdf ] + +Radiotap header field 'Channel flags' has '2 GHz spectrum' set to +'true' for 6GHz packet. +Change it to 5GHz as there isn't a separate option available for 6GHz. + +Signed-off-by: Aloka Dixit +Link: https://lore.kernel.org/r/010101747ab7b703-1d7c9851-1594-43bf-81f7-f79ce7a67cc6-000000@us-west-2.amazonses.com +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/rx.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c +index e5fb9002d3147..3ab85e1e38d82 100644 +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -419,7 +419,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, + else if (status->bw == RATE_INFO_BW_5) + channel_flags |= IEEE80211_CHAN_QUARTER; + +- if (status->band == NL80211_BAND_5GHZ) ++ if (status->band == NL80211_BAND_5GHZ || ++ status->band == NL80211_BAND_6GHZ) + channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ; + else if (status->encoding != RX_ENC_LEGACY) + channel_flags |= IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ; +-- +2.25.1 + diff --git a/queue-5.4/net-dec-de2104x-increase-receive-ring-size-for-tulip.patch b/queue-5.4/net-dec-de2104x-increase-receive-ring-size-for-tulip.patch new file mode 100644 index 00000000000..224011f7f37 --- /dev/null +++ b/queue-5.4/net-dec-de2104x-increase-receive-ring-size-for-tulip.patch @@ -0,0 +1,43 @@ +From 71cb84914adf553eeab906fe46ba7ca3e7abe464 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Sep 2020 12:05:09 -0700 +Subject: net: dec: de2104x: Increase receive ring size for Tulip + +From: Lucy Yan + +[ Upstream commit ee460417d254d941dfea5fb7cff841f589643992 ] + +Increase Rx ring size to address issue where hardware is reaching +the receive work limit. + +Before: + +[ 102.223342] de2104x 0000:17:00.0 eth0: rx work limit reached +[ 102.245695] de2104x 0000:17:00.0 eth0: rx work limit reached +[ 102.251387] de2104x 0000:17:00.0 eth0: rx work limit reached +[ 102.267444] de2104x 0000:17:00.0 eth0: rx work limit reached + +Signed-off-by: Lucy Yan +Reviewed-by: Moritz Fischer +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/dec/tulip/de2104x.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c +index f1a2da15dd0a6..b14d93da242f1 100644 +--- a/drivers/net/ethernet/dec/tulip/de2104x.c ++++ b/drivers/net/ethernet/dec/tulip/de2104x.c +@@ -91,7 +91,7 @@ MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copi + #define DSL CONFIG_DE2104X_DSL + #endif + +-#define DE_RX_RING_SIZE 64 ++#define DE_RX_RING_SIZE 128 + #define DE_TX_RING_SIZE 64 + #define DE_RING_BYTES \ + ((sizeof(struct de_desc) * DE_RX_RING_SIZE) + \ +-- +2.25.1 + diff --git a/queue-5.4/nvme-core-get-put-ctrl-and-transport-module-in-nvme_.patch b/queue-5.4/nvme-core-get-put-ctrl-and-transport-module-in-nvme_.patch new file mode 100644 index 00000000000..12ef75680e4 --- /dev/null +++ b/queue-5.4/nvme-core-get-put-ctrl-and-transport-module-in-nvme_.patch @@ -0,0 +1,103 @@ +From 5789226eee2ae196d789fdd00d75b095996c7b86 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Sep 2020 20:53:25 -0700 +Subject: nvme-core: get/put ctrl and transport module in + nvme_dev_open/release() + +From: Chaitanya Kulkarni + +[ Upstream commit 52a3974feb1a3eec25d8836d37a508b67b0a9cd0 ] + +Get and put the reference to the ctrl in the nvme_dev_open() and +nvme_dev_release() before and after module get/put for ctrl in char +device file operations. + +Introduce char_dev relase function, get/put the controller and module +which allows us to fix the potential Oops which can be easily reproduced +with a passthru ctrl (although the problem also exists with pure user +access): + +Entering kdb (current=0xffff8887f8290000, pid 3128) on processor 30 Oops: (null) +due to oops @ 0xffffffffa01019ad +CPU: 30 PID: 3128 Comm: bash Tainted: G W OE 5.8.0-rc4nvme-5.9+ #35 +Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.4 +RIP: 0010:nvme_free_ctrl+0x234/0x285 [nvme_core] +Code: 57 10 a0 e8 73 bf 02 e1 ba 3d 11 00 00 48 c7 c6 98 33 10 a0 48 c7 c7 1d 57 10 a0 e8 5b bf 02 e1 8 +RSP: 0018:ffffc90001d63de0 EFLAGS: 00010246 +RAX: ffffffffa05c0440 RBX: ffff8888119e45a0 RCX: 0000000000000000 +RDX: 0000000000000000 RSI: ffff8888177e9550 RDI: ffff8888119e43b0 +RBP: ffff8887d4768000 R08: 0000000000000000 R09: 0000000000000000 +R10: 0000000000000000 R11: ffffc90001d63c90 R12: ffff8888119e43b0 +R13: ffff8888119e5108 R14: dead000000000100 R15: ffff8888119e5108 +FS: 00007f1ef27b0740(0000) GS:ffff888817600000(0000) knlGS:0000000000000000 +CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +CR2: ffffffffa05c0470 CR3: 00000007f6bee000 CR4: 00000000003406e0 +Call Trace: + device_release+0x27/0x80 + kobject_put+0x98/0x170 + nvmet_passthru_ctrl_disable+0x4a/0x70 [nvmet] + nvmet_passthru_enable_store+0x4c/0x90 [nvmet] + configfs_write_file+0xe6/0x150 + vfs_write+0xba/0x1e0 + ksys_write+0x5f/0xe0 + do_syscall_64+0x52/0xb0 + entry_SYSCALL_64_after_hwframe+0x44/0xa9 +RIP: 0033:0x7f1ef1eb2840 +Code: Bad RIP value. +RSP: 002b:00007fffdbff0eb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 +RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f1ef1eb2840 +RDX: 0000000000000002 RSI: 00007f1ef27d2000 RDI: 0000000000000001 +RBP: 00007f1ef27d2000 R08: 000000000000000a R09: 00007f1ef27b0740 +R10: 0000000000000001 R11: 0000000000000246 R12: 00007f1ef2186400 +R13: 0000000000000002 R14: 0000000000000001 R15: 0000000000000000 + +With this patch fix we take the module ref count in nvme_dev_open() and +release that ref count in newly introduced nvme_dev_release(). + +Signed-off-by: Chaitanya Kulkarni +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 2cd32901d95c7..24c6d5a446b79 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -2933,10 +2933,24 @@ static int nvme_dev_open(struct inode *inode, struct file *file) + return -EWOULDBLOCK; + } + ++ nvme_get_ctrl(ctrl); ++ if (!try_module_get(ctrl->ops->module)) ++ return -EINVAL; ++ + file->private_data = ctrl; + return 0; + } + ++static int nvme_dev_release(struct inode *inode, struct file *file) ++{ ++ struct nvme_ctrl *ctrl = ++ container_of(inode->i_cdev, struct nvme_ctrl, cdev); ++ ++ module_put(ctrl->ops->module); ++ nvme_put_ctrl(ctrl); ++ return 0; ++} ++ + static int nvme_dev_user_cmd(struct nvme_ctrl *ctrl, void __user *argp) + { + struct nvme_ns *ns; +@@ -2999,6 +3013,7 @@ static long nvme_dev_ioctl(struct file *file, unsigned int cmd, + static const struct file_operations nvme_dev_fops = { + .owner = THIS_MODULE, + .open = nvme_dev_open, ++ .release = nvme_dev_release, + .unlocked_ioctl = nvme_dev_ioctl, + .compat_ioctl = nvme_dev_ioctl, + }; +-- +2.25.1 + diff --git a/queue-5.4/nvme-fc-fail-new-connections-to-a-deleted-host-or-re.patch b/queue-5.4/nvme-fc-fail-new-connections-to-a-deleted-host-or-re.patch new file mode 100644 index 00000000000..626b8a64503 --- /dev/null +++ b/queue-5.4/nvme-fc-fail-new-connections-to-a-deleted-host-or-re.patch @@ -0,0 +1,49 @@ +From 29672e6375a80eff0393970151b2e2eab5d0d85f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 17 Sep 2020 13:33:22 -0700 +Subject: nvme-fc: fail new connections to a deleted host or remote port + +From: James Smart + +[ Upstream commit 9e0e8dac985d4bd07d9e62922b9d189d3ca2fccf ] + +The lldd may have made calls to delete a remote port or local port and +the delete is in progress when the cli then attempts to create a new +controller. Currently, this proceeds without error although it can't be +very successful. + +Fix this by validating that both the host port and remote port are +present when a new controller is to be created. + +Signed-off-by: James Smart +Reviewed-by: Himanshu Madhani +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/fc.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c +index da801a14cd13d..65b3dc9cd693b 100644 +--- a/drivers/nvme/host/fc.c ++++ b/drivers/nvme/host/fc.c +@@ -3319,12 +3319,14 @@ nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts) + spin_lock_irqsave(&nvme_fc_lock, flags); + list_for_each_entry(lport, &nvme_fc_lport_list, port_list) { + if (lport->localport.node_name != laddr.nn || +- lport->localport.port_name != laddr.pn) ++ lport->localport.port_name != laddr.pn || ++ lport->localport.port_state != FC_OBJSTATE_ONLINE) + continue; + + list_for_each_entry(rport, &lport->endp_list, endp_list) { + if (rport->remoteport.node_name != raddr.nn || +- rport->remoteport.port_name != raddr.pn) ++ rport->remoteport.port_name != raddr.pn || ++ rport->remoteport.port_state != FC_OBJSTATE_ONLINE) + continue; + + /* if fail to get reference fall through. Will error */ +-- +2.25.1 + diff --git a/queue-5.4/nvme-pci-fix-null-req-in-completion-handler.patch b/queue-5.4/nvme-pci-fix-null-req-in-completion-handler.patch new file mode 100644 index 00000000000..ecb7c653b0f --- /dev/null +++ b/queue-5.4/nvme-pci-fix-null-req-in-completion-handler.patch @@ -0,0 +1,65 @@ +From c4d5c2c6e87bd8c25ea279a8a5e91cb758404a12 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Sep 2020 14:25:17 +0800 +Subject: nvme-pci: fix NULL req in completion handler + +From: Xianting Tian + +[ Upstream commit 50b7c24390a53c78de546215282fb52980f1d7b7 ] + +Currently, we use nvmeq->q_depth as the upper limit for a valid tag in +nvme_handle_cqe(), it is not correct. Because the available tag number +is recorded in tagset, which is not equal to nvmeq->q_depth. + +The nvme driver registers interrupts for queues before initializing the +tagset, because it uses the number of successful request_irq() calls to +configure the tagset parameters. This allows a race condition with the +current tag validity check if the controller happens to produce an +interrupt with a corrupted CQE before the tagset is initialized. + +Replace the driver's indirect tag check with the one already provided by +the block layer. + +Signed-off-by: Xianting Tian +Reviewed-by: Keith Busch +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/pci.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c +index 75f26d2ec6429..af0b51d1d43e8 100644 +--- a/drivers/nvme/host/pci.c ++++ b/drivers/nvme/host/pci.c +@@ -941,13 +941,6 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx) + volatile struct nvme_completion *cqe = &nvmeq->cqes[idx]; + struct request *req; + +- if (unlikely(cqe->command_id >= nvmeq->q_depth)) { +- dev_warn(nvmeq->dev->ctrl.device, +- "invalid id %d completed on queue %d\n", +- cqe->command_id, le16_to_cpu(cqe->sq_id)); +- return; +- } +- + /* + * AEN requests are special as they don't time out and can + * survive any kind of queue freeze and often don't respond to +@@ -962,6 +955,13 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx) + } + + req = blk_mq_tag_to_rq(nvme_queue_tagset(nvmeq), cqe->command_id); ++ if (unlikely(!req)) { ++ dev_warn(nvmeq->dev->ctrl.device, ++ "invalid id %d completed on queue %d\n", ++ cqe->command_id, le16_to_cpu(cqe->sq_id)); ++ return; ++ } ++ + trace_nvme_sq(req, cqe->sq_head, nvmeq->sq_tail); + nvme_end_request(req, cqe->status, cqe->result); + } +-- +2.25.1 + diff --git a/queue-5.4/rndis_host-increase-sleep-time-in-the-query-response.patch b/queue-5.4/rndis_host-increase-sleep-time-in-the-query-response.patch new file mode 100644 index 00000000000..383b6e780cd --- /dev/null +++ b/queue-5.4/rndis_host-increase-sleep-time-in-the-query-response.patch @@ -0,0 +1,49 @@ +From 9825c0665d944b63d02ab2b533a33659219f12cb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 11 Sep 2020 14:17:24 +0000 +Subject: rndis_host: increase sleep time in the query-response loop + +From: Olympia Giannou + +[ Upstream commit 4202c9fdf03d79dedaa94b2c4cf574f25793d669 ] + +Some WinCE devices face connectivity issues via the NDIS interface. They +fail to register, resulting in -110 timeout errors and failures during the +probe procedure. + +In this kind of WinCE devices, the Windows-side ndis driver needs quite +more time to be loaded and configured, so that the linux rndis host queries +to them fail to be responded correctly on time. + +More specifically, when INIT is called on the WinCE side - no other +requests can be served by the Client and this results in a failed QUERY +afterwards. + +The increase of the waiting time on the side of the linux rndis host in +the command-response loop leaves the INIT process to complete and respond +to a QUERY, which comes afterwards. The WinCE devices with this special +"feature" in their ndis driver are satisfied by this fix. + +Signed-off-by: Olympia Giannou +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/rndis_host.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c +index bd9c07888ebb4..6fa7a009a24a4 100644 +--- a/drivers/net/usb/rndis_host.c ++++ b/drivers/net/usb/rndis_host.c +@@ -201,7 +201,7 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen) + dev_dbg(&info->control->dev, + "rndis response error, code %d\n", retval); + } +- msleep(20); ++ msleep(40); + } + dev_dbg(&info->control->dev, "rndis response timeout\n"); + return -ETIMEDOUT; +-- +2.25.1 + diff --git a/queue-5.4/series b/queue-5.4/series index 0f78bded6b9..2d907389919 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -13,3 +13,20 @@ iio-adc-qcom-spmi-adc5-fix-driver-name.patch ftrace-move-rcu-is-watching-check-after-recursion-check.patch memstick-skip-allocating-card-when-removing-host.patch drm-amdgpu-restore-proper-ref-count-in-amdgpu_display_crtc_set_config.patch +clocksource-drivers-timer-gx6605s-fixup-counter-relo.patch +libbpf-remove-arch-specific-include-path-in-makefile.patch +drivers-net-wan-hdlc_fr-add-needed_headroom-for-pvc-.patch +drm-sun4i-mixer-extend-regmap-max_register.patch +net-dec-de2104x-increase-receive-ring-size-for-tulip.patch +rndis_host-increase-sleep-time-in-the-query-response.patch +nvme-core-get-put-ctrl-and-transport-module-in-nvme_.patch +fuse-fix-the-direct_io-treatment-of-iov_iter.patch +drivers-net-wan-lapbether-make-skb-protocol-consiste.patch +drivers-net-wan-hdlc-set-skb-protocol-before-transmi.patch +mac80211-fix-radiotap-header-channel-flag-for-6ghz-b.patch +mac80211-do-not-allow-bigger-vht-mpdus-than-the-hard.patch +tracing-make-the-space-reserved-for-the-pid-wider.patch +tools-io_uring-fix-compile-breakage.patch +spi-fsl-espi-only-process-interrupts-for-expected-ev.patch +nvme-pci-fix-null-req-in-completion-handler.patch +nvme-fc-fail-new-connections-to-a-deleted-host-or-re.patch diff --git a/queue-5.4/spi-fsl-espi-only-process-interrupts-for-expected-ev.patch b/queue-5.4/spi-fsl-espi-only-process-interrupts-for-expected-ev.patch new file mode 100644 index 00000000000..199fe0337d9 --- /dev/null +++ b/queue-5.4/spi-fsl-espi-only-process-interrupts-for-expected-ev.patch @@ -0,0 +1,49 @@ +From b1ad77d1798a30431418b7aacbdcbc6a0ae28ae9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 4 Sep 2020 12:28:12 +1200 +Subject: spi: fsl-espi: Only process interrupts for expected events + +From: Chris Packham + +[ Upstream commit b867eef4cf548cd9541225aadcdcee644669b9e1 ] + +The SPIE register contains counts for the TX FIFO so any time the irq +handler was invoked we would attempt to process the RX/TX fifos. Use the +SPIM value to mask the events so that we only process interrupts that +were expected. + +This was a latent issue exposed by commit 3282a3da25bd ("powerpc/64: +Implement soft interrupt replay in C"). + +Signed-off-by: Chris Packham +Link: https://lore.kernel.org/r/20200904002812.7300-1-chris.packham@alliedtelesis.co.nz +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-fsl-espi.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c +index f20326714b9d5..215bf6624e7c3 100644 +--- a/drivers/spi/spi-fsl-espi.c ++++ b/drivers/spi/spi-fsl-espi.c +@@ -555,13 +555,14 @@ static void fsl_espi_cpu_irq(struct fsl_espi *espi, u32 events) + static irqreturn_t fsl_espi_irq(s32 irq, void *context_data) + { + struct fsl_espi *espi = context_data; +- u32 events; ++ u32 events, mask; + + spin_lock(&espi->lock); + + /* Get interrupt events(tx/rx) */ + events = fsl_espi_read_reg(espi, ESPI_SPIE); +- if (!events) { ++ mask = fsl_espi_read_reg(espi, ESPI_SPIM); ++ if (!(events & mask)) { + spin_unlock(&espi->lock); + return IRQ_NONE; + } +-- +2.25.1 + diff --git a/queue-5.4/tools-io_uring-fix-compile-breakage.patch b/queue-5.4/tools-io_uring-fix-compile-breakage.patch new file mode 100644 index 00000000000..7510d961617 --- /dev/null +++ b/queue-5.4/tools-io_uring-fix-compile-breakage.patch @@ -0,0 +1,67 @@ +From 112ea92d6b46324b163a61bdf2e45c7cf12c27fc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Sep 2020 17:36:09 -0400 +Subject: tools/io_uring: fix compile breakage +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Douglas Gilbert + +[ Upstream commit 72f04da48a9828ba3ae8ac77bea648bda8b7d0ff ] + +It would seem none of the kernel continuous integration does this: + $ cd tools/io_uring + $ make + +Otherwise it may have noticed: + cc -Wall -Wextra -g -D_GNU_SOURCE -c -o io_uring-bench.o + io_uring-bench.c +io_uring-bench.c:133:12: error: static declaration of ‘gettid’ + follows non-static declaration + 133 | static int gettid(void) + | ^~~~~~ +In file included from /usr/include/unistd.h:1170, + from io_uring-bench.c:27: +/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:34:16: note: + previous declaration of ‘gettid’ was here + 34 | extern __pid_t gettid (void) __THROW; + | ^~~~~~ +make: *** [: io_uring-bench.o] Error 1 + +The problem on Ubuntu 20.04 (with lk 5.9.0-rc5) is that unistd.h +already defines gettid(). So prefix the local definition with +"lk_". + +Signed-off-by: Douglas Gilbert +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + tools/io_uring/io_uring-bench.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/io_uring/io_uring-bench.c b/tools/io_uring/io_uring-bench.c +index 0f257139b003e..7703f01183854 100644 +--- a/tools/io_uring/io_uring-bench.c ++++ b/tools/io_uring/io_uring-bench.c +@@ -130,7 +130,7 @@ static int io_uring_register_files(struct submitter *s) + s->nr_files); + } + +-static int gettid(void) ++static int lk_gettid(void) + { + return syscall(__NR_gettid); + } +@@ -281,7 +281,7 @@ static void *submitter_fn(void *data) + struct io_sq_ring *ring = &s->sq_ring; + int ret, prepped; + +- printf("submitter=%d\n", gettid()); ++ printf("submitter=%d\n", lk_gettid()); + + srand48_r(pthread_self(), &s->rand); + +-- +2.25.1 + diff --git a/queue-5.4/tracing-make-the-space-reserved-for-the-pid-wider.patch b/queue-5.4/tracing-make-the-space-reserved-for-the-pid-wider.patch new file mode 100644 index 00000000000..ef707348eb0 --- /dev/null +++ b/queue-5.4/tracing-make-the-space-reserved-for-the-pid-wider.patch @@ -0,0 +1,151 @@ +From b14c00674cde85f4bfc7cc1b3d16a5c6fb14738f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 4 Sep 2020 10:23:31 +0200 +Subject: tracing: Make the space reserved for the pid wider + +From: Sebastian Andrzej Siewior + +[ Upstream commit 795d6379a47bcbb88bd95a69920e4acc52849f88 ] + +For 64bit CONFIG_BASE_SMALL=0 systems PID_MAX_LIMIT is set by default to +4194304. During boot the kernel sets a new value based on number of CPUs +but no lower than 32768. It is 1024 per CPU so with 128 CPUs the default +becomes 131072 which needs six digits. +This value can be increased during run time but must not exceed the +initial upper limit. + +Systemd sometime after v241 sets it to the upper limit during boot. The +result is that when the pid exceeds five digits, the trace output is a +little hard to read because it is no longer properly padded (same like +on big iron with 98+ CPUs). + +Increase the pid padding to seven digits. + +Link: https://lkml.kernel.org/r/20200904082331.dcdkrr3bkn3e4qlg@linutronix.de + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +Signed-off-by: Sasha Levin +--- + kernel/trace/trace.c | 38 ++++++++++++++++++------------------- + kernel/trace/trace_output.c | 12 ++++++------ + 2 files changed, 25 insertions(+), 25 deletions(-) + +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c +index db8162b34ef64..5b2a664812b10 100644 +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -3584,14 +3584,14 @@ unsigned long trace_total_entries(struct trace_array *tr) + + static void print_lat_help_header(struct seq_file *m) + { +- seq_puts(m, "# _------=> CPU# \n" +- "# / _-----=> irqs-off \n" +- "# | / _----=> need-resched \n" +- "# || / _---=> hardirq/softirq \n" +- "# ||| / _--=> preempt-depth \n" +- "# |||| / delay \n" +- "# cmd pid ||||| time | caller \n" +- "# \\ / ||||| \\ | / \n"); ++ seq_puts(m, "# _------=> CPU# \n" ++ "# / _-----=> irqs-off \n" ++ "# | / _----=> need-resched \n" ++ "# || / _---=> hardirq/softirq \n" ++ "# ||| / _--=> preempt-depth \n" ++ "# |||| / delay \n" ++ "# cmd pid ||||| time | caller \n" ++ "# \\ / ||||| \\ | / \n"); + } + + static void print_event_info(struct trace_buffer *buf, struct seq_file *m) +@@ -3612,26 +3612,26 @@ static void print_func_help_header(struct trace_buffer *buf, struct seq_file *m, + + print_event_info(buf, m); + +- seq_printf(m, "# TASK-PID %s CPU# TIMESTAMP FUNCTION\n", tgid ? "TGID " : ""); +- seq_printf(m, "# | | %s | | |\n", tgid ? " | " : ""); ++ seq_printf(m, "# TASK-PID %s CPU# TIMESTAMP FUNCTION\n", tgid ? " TGID " : ""); ++ seq_printf(m, "# | | %s | | |\n", tgid ? " | " : ""); + } + + static void print_func_help_header_irq(struct trace_buffer *buf, struct seq_file *m, + unsigned int flags) + { + bool tgid = flags & TRACE_ITER_RECORD_TGID; +- const char *space = " "; +- int prec = tgid ? 10 : 2; ++ const char *space = " "; ++ int prec = tgid ? 12 : 2; + + print_event_info(buf, m); + +- seq_printf(m, "# %.*s _-----=> irqs-off\n", prec, space); +- seq_printf(m, "# %.*s / _----=> need-resched\n", prec, space); +- seq_printf(m, "# %.*s| / _---=> hardirq/softirq\n", prec, space); +- seq_printf(m, "# %.*s|| / _--=> preempt-depth\n", prec, space); +- seq_printf(m, "# %.*s||| / delay\n", prec, space); +- seq_printf(m, "# TASK-PID %.*sCPU# |||| TIMESTAMP FUNCTION\n", prec, " TGID "); +- seq_printf(m, "# | | %.*s | |||| | |\n", prec, " | "); ++ seq_printf(m, "# %.*s _-----=> irqs-off\n", prec, space); ++ seq_printf(m, "# %.*s / _----=> need-resched\n", prec, space); ++ seq_printf(m, "# %.*s| / _---=> hardirq/softirq\n", prec, space); ++ seq_printf(m, "# %.*s|| / _--=> preempt-depth\n", prec, space); ++ seq_printf(m, "# %.*s||| / delay\n", prec, space); ++ seq_printf(m, "# TASK-PID %.*s CPU# |||| TIMESTAMP FUNCTION\n", prec, " TGID "); ++ seq_printf(m, "# | | %.*s | |||| | |\n", prec, " | "); + } + + void +diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c +index d54ce252b05a8..a0a45901dc027 100644 +--- a/kernel/trace/trace_output.c ++++ b/kernel/trace/trace_output.c +@@ -482,7 +482,7 @@ lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu) + + trace_find_cmdline(entry->pid, comm); + +- trace_seq_printf(s, "%8.8s-%-5d %3d", ++ trace_seq_printf(s, "%8.8s-%-7d %3d", + comm, entry->pid, cpu); + + return trace_print_lat_fmt(s, entry); +@@ -573,15 +573,15 @@ int trace_print_context(struct trace_iterator *iter) + + trace_find_cmdline(entry->pid, comm); + +- trace_seq_printf(s, "%16s-%-5d ", comm, entry->pid); ++ trace_seq_printf(s, "%16s-%-7d ", comm, entry->pid); + + if (tr->trace_flags & TRACE_ITER_RECORD_TGID) { + unsigned int tgid = trace_find_tgid(entry->pid); + + if (!tgid) +- trace_seq_printf(s, "(-----) "); ++ trace_seq_printf(s, "(-------) "); + else +- trace_seq_printf(s, "(%5d) ", tgid); ++ trace_seq_printf(s, "(%7d) ", tgid); + } + + trace_seq_printf(s, "[%03d] ", iter->cpu); +@@ -624,7 +624,7 @@ int trace_print_lat_context(struct trace_iterator *iter) + trace_find_cmdline(entry->pid, comm); + + trace_seq_printf( +- s, "%16s %5d %3d %d %08x %08lx ", ++ s, "%16s %7d %3d %d %08x %08lx ", + comm, entry->pid, iter->cpu, entry->flags, + entry->preempt_count, iter->idx); + } else { +@@ -905,7 +905,7 @@ static enum print_line_t trace_ctxwake_print(struct trace_iterator *iter, + S = task_index_to_char(field->prev_state); + trace_find_cmdline(field->next_pid, comm); + trace_seq_printf(&iter->seq, +- " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n", ++ " %7d:%3d:%c %s [%03d] %7d:%3d:%c %s\n", + field->prev_pid, + field->prev_prio, + S, delim, +-- +2.25.1 +