Skip to contentSkip to conversation

backport: updates for 4.19

PATCH In review Luca Coelho 3 participants 20 messages Sep 20, 2018 – Sep 24, 2018

lore
Share & tools
lore
#0 lore raw

cover backport: updates for 4.19

From: Luca Coelho <[email protected]>

Hi,

I finally found the time to go through the backports I had made for our internal tree and send them upstream.

We've compile tested this on some old kernels, but the list is far from being comprehensive.

Please review.

Cheers,
Luca.

Johannes Berg (1):
backports: improve skb->xmit_more handling

Luca Coelho (12):
backport: fix compilation with IPV6 not set
backport: introduce match_string() for kernels < 4.6
backport: add patch to ignore iwlwifi removal on < 3.14 kernels
backport: convert tree section names to ascii
backport: add rhashtable-types.h
backport: remove duplicate leds.h inclusion from backport-4.5.c
backport: prevent unused subclass variable warning in < 3.18
backport: make ktime_get_boottime_seconds() non-inline
backport: update u64_stats_init() to a new version in kernels < 4.2
backport: update lib-rhashtable.c
backport: convert int led activate op to void when needed
backports: add __alloc_bucket_spinlocks() for < 4.19

Shahar S Matityahu (1):
backports: add wait_event_killable_timeout backport support

 backport/backport-include/linux/netdevice.h   | 10 ++++++
 backport/backport-include/linux/skbuff.h      |  9 ++++++
 backport/backport-include/linux/spinlock.h    | 32 +++++++++++++++++++
 backport/backport-include/linux/string.h      |  4 +++
 backport/backport-include/linux/timekeeping.h |  5 +--
 backport/backport-include/linux/wait.h        | 15 +++++++++
 backport/compat/Kconfig                       |  1 +
 backport/compat/Makefile                      |  1 +
 backport/compat/backport-4.18.c               | 11 +++++++
 backport/compat/backport-4.4.c                |  6 ++++
 backport/compat/backport-4.5.c                |  1 -
 backport/compat/backport-4.6.c                | 26 +++++++++++++++
 devel/git-tracker.py                          |  2 ++
 .../0059-skb_xmit_more/skb_no_xmit_more.cocci | 10 ++----
 patches/iwlwifi-pci-device-removal.patch      | 24 ++++++++++++++
 patches/led_activate.cocci                    | 24 ++++++++++++++
 patches/lib-rhashtable.patch                  | 14 ++++++++
 17 files changed, 183 insertions(+), 12 deletions(-)
 create mode 100644 backport/compat/backport-4.18.c
 create mode 100644 patches/iwlwifi-pci-device-removal.patch
 create mode 100644 patches/led_activate.cocci
 create mode 100644 patches/lib-rhashtable.patch
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#1 lore raw

PATCH 1/14 backport: fix compilation with IPV6 not set

From: Luca Coelho <[email protected]>

At least in some older kernel versions (e.g. 3.10), the tcp.h header file is not implicitly included from other headers if CONFIG_IPV6 is not set, so we need to include it in backport-4.4.c. Also, there is an IPv6 structure that is used, so we should ifdef it away when IPv6 is not enabled.

---
 backport/compat/backport-4.4.c | 6 ++++++
 1 file changed, 6 insertions(+)
backport/compat/backport-4.4.c +6 -0
index 1c11a2064e53..7966e94928e7 100644
@@ -15,6 +15,7 @@
 #include <linux/if_vlan.h>
 #include <linux/mm.h>
 #include <linux/skbuff.h>
+#include <linux/tcp.h>
 #include <net/ip.h>
 #include <net/tso.h>
 #include <asm/unaligned.h>
@@ -95,9 +96,14 @@ void tso_build_hdr(struct sk_buff *skb, char *hdr, struct tso_t *tso,
 		iph->tot_len = htons(size + hdr_len - mac_hdr_len);
 		tso->ip_id++;
 	} else {
+#ifdef CONFIG_IPV6
 		struct ipv6hdr *iph = (void *)(hdr + mac_hdr_len);
 
 		iph->payload_len = htons(size + tcp_hdrlen(skb));
+#else /* CONFIG_IPV6 */
+		/* tso->ipv6 should never be set if IPV6 is not enabeld */
+		WARN_ON(1);
+#endif /* CONFIG_IPV6 */
 	}
 	tcph = (struct tcphdr *)(hdr + skb_transport_offset(skb));
 	put_unaligned_be32(tso->tcp_seq, &tcph->seq);
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#2 lore raw

PATCH 2/14 backports: add wait_event_killable_timeout backport support

In reply to Luca Coelho

From: Shahar S Matityahu <[email protected]>

Allow using wait_event_killable_timeout function in kernel older then 4.13

---
 backport/backport-include/linux/wait.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
backport/backport-include/linux/wait.h +15 -0
index c4b1114e05ed..15a674cfe019 100644
@@ -78,6 +78,21 @@ wait_on_bit_timeout(void *word, int bit, unsigned mode, unsigned long timeout)
 
 #if LINUX_VERSION_IS_LESS(4,13,0)
 #define wait_queue_entry_t wait_queue_t
+
+#define wait_event_killable_timeout(wq_head, condition, timeout)	\
+({									\
+	long __ret = timeout;						\
+	might_sleep();							\
+	if (!___wait_cond_timeout(condition))				\
+		__ret = __wait_event_killable_timeout(wq_head,		\
+						condition, timeout);	\
+	__ret;								\
+})
+
+#define __wait_event_killable_timeout(wq_head, condition, timeout)	\
+	___wait_event(wq_head, ___wait_cond_timeout(condition),		\
+		      TASK_KILLABLE, 0, timeout,			\
+		      __ret = schedule_timeout(__ret))
 #endif
 
 #endif /* __BACKPORT_LINUX_WAIT_H */
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#3 lore raw

PATCH 3/14 backport: introduce match_string() for kernels < 4.6

In reply to Luca Coelho

From: Luca Coelho <[email protected]>

This function was introduced in v4.6 and now the iwlwifi driver uses it. Add the function for kernels older than v4.6.

---
 backport/backport-include/linux/string.h |  4 ++++
 backport/compat/backport-4.6.c           | 26 ++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
backport/backport-include/linux/string.h +4 -0
index b85d9c73dc27..df93bf79a691 100644
@@ -29,4 +29,8 @@ void memzero_explicit(void *s, size_t count);
 ssize_t strscpy(char *dest, const char *src, size_t count);
 #endif
 
+#if LINUX_VERSION_IS_LESS(4,6,0)
+int match_string(const char * const *array, size_t n, const char *string);
+#endif /* LINUX_VERSION_IS_LESS(4,5,0) */
+
 #endif /* __BACKPORT_LINUX_STRING_H */
backport/compat/backport-4.6.c +26 -0
index 54ff669df192..8d0ecf56526d 100644
@@ -75,3 +75,29 @@ int kstrtobool_from_user(const char __user *s, size_t count, bool *res)
 	return kstrtobool(buf, res);
 }
 EXPORT_SYMBOL_GPL(kstrtobool_from_user);
+
+/**
+ * match_string - matches given string in an array
+ * @array:	array of strings
+ * @n:		number of strings in the array or -1 for NULL terminated arrays
+ * @string:	string to match with
+ *
+ * Return:
+ * index of a @string in the @array if matches, or %-EINVAL otherwise.
+ */
+int match_string(const char * const *array, size_t n, const char *string)
+{
+	int index;
+	const char *item;
+
+	for (index = 0; index < n; index++) {
+		item = array[index];
+		if (!item)
+			break;
+		if (!strcmp(item, string))
+			return index;
+	}
+
+	return -EINVAL;
+}
+EXPORT_SYMBOL(match_string);
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#4 lore raw

PATCH 4/14 backport: add patch to ignore iwlwifi removal on < 3.14 kernels

In reply to Luca Coelho

From: Luca Coelho <[email protected]>

The iwlwifi driver has a workaround for some PCI bugs that require it to be removed and reinserted. Unfortunately, this doesn'w work on kernels < 3.14, so ignore the actual work function in that case and print out a message instead.

---
 patches/iwlwifi-pci-device-removal.patch | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 patches/iwlwifi-pci-device-removal.patch
patches/iwlwifi-pci-device-removal.patch new file +24 -0
new file mode 100644
index 000000000000..c72cd09f4634
@@ -0,0 +1,24 @@
+diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+index 7229991ae70d..d77d0aa3bf7b 100644
+--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+@@ -1946,6 +1946,11 @@ static void iwl_trans_pcie_removal_wk(struct work_struct *wk)
+ 	struct iwl_trans_pcie_removal *removal =
+ 		container_of(wk, struct iwl_trans_pcie_removal, work);
+ 	struct pci_dev *pdev = removal->pdev;
++#if LINUX_VERSION_IS_LESS(3,14,0)
++	dev_err(&rescan->pdev->dev,
++		"Device disconnected - can't rescan on old kernels.\n");
++	pci_dev_put(pdev);
++#else
+ 	char *prop[] = {"EVENT=INACCESSIBLE", NULL};
+ 
+ 	dev_err(&pdev->dev, "Device gone - attempting removal\n");
+@@ -1957,6 +1962,7 @@ static void iwl_trans_pcie_removal_wk(struct work_struct *wk)
+ 
+ 	kfree(removal);
+ 	module_put(THIS_MODULE);
++#endif /* LINUX_VERSION_IS_LESS(3,14,0) */
+ }
+ 
+ static bool iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans,
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#5 lore raw

PATCH 5/14 backport: convert tree section names to ascii

In reply to Luca Coelho

From: Luca Coelho <[email protected]>

For some reason, sometimes when the git logs contain non-ascii characters, we get some conversion errors. This only happens if one of the strings we use is explicitly unicode, otherwise everything is fine. The only string we use that is of unicode type is the tree names that comes from the configuration sections. To avoid issues, convert the strings we get from the config file into ascii before using it.

---
 devel/git-tracker.py | 2 ++
 1 file changed, 2 insertions(+)
devel/git-tracker.py +2 -0
index 1789ad975154..d51f59ba6507 100755
@@ -190,6 +190,8 @@ if __name__ == '__main__':
         backport_rev = git.rev_parse(tree=source_dir)
 
         for tree in trees:
+            # make sure tree is ascii to prevent conversion problems
+            tree = str(tree)
             input = config.get(tree, 'input')
             output = config.get(tree, 'output')
             defconfig = None
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#6 lore raw

PATCH 6/14 backport: add rhashtable-types.h

In reply to Luca Coelho

From: Luca Coelho <[email protected]>

This was introduced in 4.18 and is needed by rhashtable.h, that we copy. So copy it as well.

---
 backport/compat/Kconfig | 1 +
 1 file changed, 1 insertion(+)
backport/compat/Kconfig +1 -0
index ed3a58725d69..be07a1898f38 100644
@@ -130,6 +130,7 @@ config BPAUTO_RHASHTABLE
 	# not very nice - but better than always having it
 	default y if BACKPORTED_MAC80211
 	#h-file linux/rhashtable.h
+	#h-file linux/rhashtable-types.h
 	#c-file lib/rhashtable.c
 
 config BPAUTO_BUCKET_LOCKS
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#7 lore raw

PATCH 7/14 backport: remove duplicate leds.h inclusion from backport-4.5.c

In reply to Luca Coelho

From: Luca Coelho <[email protected]>

We were including leds.h twice in backport-4.5.c and one of them was very early, which caused inclusion conflicts at least with < 3.16 kernels.

---
 backport/compat/backport-4.5.c | 1 -
 1 file changed, 1 deletion(-)
backport/compat/backport-4.5.c +0 -1
index 69751d515234..13764dc76cd4 100644
@@ -8,7 +8,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/leds.h>
 #include <linux/device.h>
 #include <linux/export.h>
 #include <linux/errno.h>
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#8 lore raw

PATCH 8/14 backport: prevent unused subclass variable warning in < 3.18

In reply to Luca Coelho

From: Luca Coelho <[email protected]>

In kernels earlier than 3.18, the raw_spin_lock defininition when CONFIG_DEBUG_LOCK_ALLOC is not enabled, was dropping one of the parameters, which caused a few "unused variable" warnings at places where this argument was only used in the call to raw_spin_lock_nested(). Take the latest definition which evaluates the argument to avoid compiler warnings.

---
 backport/backport-include/linux/spinlock.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
backport/backport-include/linux/spinlock.h +15 -0
index 07daa358e25d..a46f6e33b241 100644
@@ -2,6 +2,21 @@
 #define __BACKPORT_SPINLOCK_H
 #include_next <linux/spinlock.h>
 
+#if LINUX_VERSION_IS_LESS(3,18,0)
+#ifndef CONFIG_DEBUG_LOCK_ALLOC
+#undef raw_spin_lock_nested
+/*
+ * Always evaluate the 'subclass' argument to avoid that the compiler
+ * warns about set-but-not-used variables when building with
+ * CONFIG_DEBUG_LOCK_ALLOC=n and with W=1.
+ */
+# define raw_spin_lock_nested(lock, subclass)		\
+	_raw_spin_lock(((void)(subclass), (lock)))
+# define raw_spin_lock_nest_lock(lock, nest_lock)	_raw_spin_lock(lock)
+#endif
+#endif /* LINUX_VERSION_IS_LESS(3,18,0) */
+
+
 #if LINUX_VERSION_IS_LESS(4,16,0)
 int alloc_bucket_spinlocks(spinlock_t **locks, unsigned int *lock_mask,
 			   size_t max_size, unsigned int cpu_mult,
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#9 lore raw

PATCH 9/14 backport: make ktime_get_boottime_seconds() non-inline

In reply to Luca Coelho

From: Luca Coelho <[email protected]>

With kernels < 3.17, we need to include hrtimer.h to get ktime_divns() for the ktime_get_boottime_seconds() backport. But we can't just include htrtimer.h in the backport timekeeping.h because we run into some cyclical inclusions that cause problems. To solve that make ktime_get_boottime_seconds() non-inline and add it to a new backport-4.18.c file.

---
 backport/backport-include/linux/timekeeping.h |  5 +----
 backport/compat/Makefile                      |  1 +
 backport/compat/backport-4.18.c               | 11 +++++++++++
 3 files changed, 13 insertions(+), 4 deletions(-)
 create mode 100644 backport/compat/backport-4.18.c
backport/backport-include/linux/timekeeping.h +1 -4
index 73ce9f1797ed..aebb00ca366b 100644
@@ -25,10 +25,7 @@ static inline u64 ktime_get_boot_ns(void)
 #endif /* < 3.17 */
 
 #if LINUX_VERSION_IS_LESS(4,18,0)
-static inline time64_t ktime_get_boottime_seconds(void)
-{
-	return ktime_divns(ktime_get_boottime(), NSEC_PER_SEC);
-}
+extern time64_t ktime_get_boottime_seconds(void);
 #endif /* < 4.18 */
 
 #if LINUX_VERSION_IS_LESS(3,19,0)
backport/compat/Makefile +1 -0
index 12c4121ff7e1..f5b1886e2d8e 100644
@@ -37,6 +37,7 @@ compat-$(CPTCFG_KERNEL_4_7) += backport-4.7.o
 compat-$(CPTCFG_KERNEL_4_8) += backport-4.8.o
 compat-$(CPTCFG_KERNEL_4_10) += backport-4.10.o
 compat-$(CPTCFG_KERNEL_4_12) += backport-4.12.o
+compat-$(CPTCFG_KERNEL_4_18) += backport-4.18.o
 
 compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o
 
backport/compat/backport-4.18.c new file +11 -0
new file mode 100644
index 000000000000..c47fabe5a7a1
@@ -0,0 +1,11 @@
+/*
+ * Copyright (C) 2018 Intel Corporation
+ */
+
+#include <linux/hrtimer.h>
+
+time64_t ktime_get_boottime_seconds(void)
+{
+	return ktime_divns(ktime_get_boottime(), NSEC_PER_SEC);
+}
+EXPORT_SYMBOL_GPL(ktime_get_boottime_seconds);
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#10 lore raw

PATCH 10/14 backport: update u64_stats_init() to a new version in kernels < 4.2

In reply to Luca Coelho

From: Luca Coelho <[email protected]>

The u64_stats_init() macro was turned into a static inline function in v4.2 to prevent warnings that happen when its argument is not used elsewhere.

Since we started hitting these warnings, undefine the macro and define the static inline to prevent them.

---
 backport/backport-include/linux/netdevice.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
backport/backport-include/linux/netdevice.h +10 -0
index 8723f8c58e84..44319331fce8 100644
@@ -263,6 +263,16 @@ netdev_features_t passthru_features_check(struct sk_buff *skb,
 					  netdev_features_t features);
 #endif /* LINUX_VERSION_IS_LESS(4,1,0) */
 
+#if LINUX_VERSION_IS_LESS(4,2,0)
+#undef u64_stats_init
+static inline void u64_stats_init(struct u64_stats_sync *syncp)
+{
+#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
+	seqcount_init(&syncp->seq);
+#endif
+}
+#endif /* LINUX_VERSION_IS_LESS(4,2,0) */
+
 #ifndef netdev_alloc_pcpu_stats
 #define netdev_alloc_pcpu_stats(type)				\
 ({								\
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#11 lore raw

PATCH 11/14 backports: improve skb->xmit_more handling

In reply to Luca Coelho

From: Johannes Berg <[email protected]>

Replace the existing skb->xmit_more semantic patch rule with a more generic one that uses a helper inline function.

---
 backport/backport-include/linux/skbuff.h          |  9 +++++++++
 patches/0059-skb_xmit_more/skb_no_xmit_more.cocci | 10 +++-------
 2 files changed, 12 insertions(+), 7 deletions(-)
backport/backport-include/linux/skbuff.h +9 -0
index 034206b6649d..61133c4277cc 100644
@@ -200,6 +200,15 @@ static inline struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb,
 struct sk_buff *skb_clone_sk(struct sk_buff *skb);
 #endif
 
+static inline bool skb_xmit_more(struct sk_buff *skb)
+{
+#if LINUX_VERSION_IS_LESS(3,18,0)
+	return false;
+#else
+	return skb->xmit_more;
+#endif
+}
+
 #if LINUX_VERSION_IS_LESS(3,19,0)
 /**
  * __dev_alloc_pages - allocate page for network Rx
patches/0059-skb_xmit_more/skb_no_xmit_more.cocci +3 -7
index ab20c833af40..bf7f22e267a3 100644
@@ -1,9 +1,5 @@
-@r1@
+@@
 struct sk_buff *skb;
-expression E1;
 @@
- if (E1
-+#if LINUX_VERSION_IS_GEQ(3,18,0)
- || !skb->xmit_more
-+#endif /* if LINUX_VERSION_IS_GEQ(3,18,0) */
- ) {...}
+-skb->xmit_more
++skb_xmit_more(skb)
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#12 lore raw

PATCH 12/14 backport: update lib-rhashtable.c

In reply to Luca Coelho

From: Luca Coelho <[email protected]>

The bucket_table_alloc() function was reworked, so update the patch accordingly. It's much simpler now, if !GFP_KERNEL, we just fail (like we used to). This is not a problem because we only use this function with GFP_KERNEL anyway.

---
 patches/lib-rhashtable.patch | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 patches/lib-rhashtable.patch
patches/lib-rhashtable.patch new file +14 -0
new file mode 100644
index 000000000000..a538d0c83fc7
@@ -0,0 +1,14 @@
+diff --git a/compat/lib-rhashtable.c b/compat/lib-rhashtable.c
+index 30526afa8343..bee37f2682dd 100644
+--- a/compat/lib-rhashtable.c
++++ b/compat/lib-rhashtable.c
+@@ -173,7 +173,8 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht,
+ 	int i;
+ 
+ 	size = sizeof(*tbl) + nbuckets * sizeof(tbl->buckets[0]);
+-	tbl = kvzalloc(size, gfp);
++	if (gfp == GFP_KERNEL)
++		tbl = vzalloc(size);
+ 
+ 	size = nbuckets;
+ 
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#13 lore raw

Re: [PATCH 12/14] backport: update lib-rhashtable.c

Quoted 9 lines · Luca Coelho

From: Luca Coelho <[email protected]>

The bucket_table_alloc() function was reworked, so update the patch accordingly. It's much simpler now, if !GFP_KERNEL, we just fail (like we used to). This is not a problem because we only use this function with GFP_KERNEL anyway.

---

As Johannes pointed out, this patch is not needed, so please ignore it.

The reason I kept it is because I mistakenly didn't add the kvzalloc() backport to one of our internal tree generations and had to keep the this patch after I rebased on top of Felix's patch that removed this entirely.

--
Cheers,
Luca.

--
To unsubscribe from this list: send the line "unsubscribe backports" in

#14 lore raw

PATCH 13/14 backport: convert int led activate op to void when needed

In reply to Luca Coelho

From: Luca Coelho <[email protected]>

In kernel v4.19-rc1, the activate op in struct led_trigger, changed from void to int. To solve this, add a semantic patch to insert a wrapper function that returns void and calls the function that returns int.

---
 patches/led_activate.cocci | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 patches/led_activate.cocci
patches/led_activate.cocci new file +24 -0
new file mode 100644
index 000000000000..df8211d29462
@@ -0,0 +1,24 @@
+@act@
+identifier activate_fn, p;
+identifier m =~ "rx_led|tx_led|assoc_led|radio_led|tpt_led";
+fresh identifier activate_fn_wrap = "bp_" ## activate_fn;
+@@
+<...
++#if LINUX_VERSION_IS_GEQ(4,19,0)
+p->m.activate = activate_fn;
++#else
++p->m.activate = activate_fn_wrap;
++#endif
+...>
+
+@@
+identifier act.activate_fn;
+identifier act.activate_fn_wrap;
+@@
+int activate_fn(...) {...}
++#if LINUX_VERSION_IS_LESS(4,19,0)
++static void activate_fn_wrap(struct led_classdev *led_cdev)
++{
++	activate_fn(led_cdev);
++}
++#endif
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#15 lore raw

Re: [PATCH 13/14] backport: convert int led activate op to void when needed

Quoted 21 lines · Luca Coelho

From: Luca Coelho <[email protected]>

In kernel v4.19-rc1, the activate op in struct led_trigger, changed from void to int. To solve this, add a semantic patch to insert a wrapper function that returns void and calls the function that returns int.

---
 patches/led_activate.cocci | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 patches/led_activate.cocci
patches/led_activate.cocci new file +2 -0
new file mode 100644
index 000000000000..df8211d29462
@@ -0,0 +1,24 @@
+@act@
+identifier activate_fn, p;

patches/led_activate.cocci line 12

Quoted 10 lines
patches/led_activate.cocci new file +10 -0
+identifier m =~ "rx_led|tx_led|assoc_led|radio_led|tpt_led";
+fresh identifier activate_fn_wrap = "bp_" ## activate_fn;
+@@
+<...
++#if LINUX_VERSION_IS_GEQ(4,19,0)
+p->m.activate = activate_fn;
++#else
++p->m.activate = activate_fn_wrap;
++#endif
+...>

Please use <+--- ---+> here it improves the speed by some magnitudes.

Quoted 13 lines
patches/led_activate.cocci new file +12 -0
+
+@@
+identifier act.activate_fn;
+identifier act.activate_fn_wrap;
+@@
+int activate_fn(...) {...}
++#if LINUX_VERSION_IS_LESS(4,19,0)
++static void activate_fn_wrap(struct led_classdev *led_cdev)
++{
++	activate_fn(led_cdev);
++}
++#endif
#16 lore raw

Re: [PATCH 13/14] backport: convert int led activate op to void when needed

Quoted 28 lines · Hauke Mehrtens
Quoted 27 lines · Luca Coelho

From: Luca Coelho <[email protected]>

In kernel v4.19-rc1, the activate op in struct led_trigger, changed from void to int. To solve this, add a semantic patch to insert a wrapper function that returns void and calls the function that returns
int.

---
 patches/led_activate.cocci | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 patches/led_activate.cocci
patches/led_activate.cocci new file +6 -0
new file mode 100644
index 000000000000..df8211d29462
@@ -0,0 +1,24 @@
+@act@
+identifier activate_fn, p;
+identifier m =~ "rx_led|tx_led|assoc_led|radio_led|tpt_led";
+fresh identifier activate_fn_wrap = "bp_" ## activate_fn;
+@@
+<...
Quoted 8 lines

patches/led_activate.cocci line 12

Quoted 6 lines
patches/led_activate.cocci new file +6 -0
++#if LINUX_VERSION_IS_GEQ(4,19,0)
+p->m.activate = activate_fn;
++#else
++p->m.activate = activate_fn_wrap;
++#endif
+...>

Please use <+--- ---+> here it improves the speed by some magnitudes.

Thanks for pointing out. I remember the discussion about this with Julia. Johannes already fixed this in-place before applying my patch.

--
Cheers,
Luca.

--
To unsubscribe from this list: send the line "unsubscribe backports" in

#17 lore raw

PATCH 14/14 backports: add __alloc_bucket_spinlocks() for < 4.19

In reply to Luca Coelho

From: Luca Coelho <[email protected]>

---
 backport/backport-include/linux/spinlock.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
backport/backport-include/linux/spinlock.h +17 -0
index a46f6e33b241..b27f91716ca7 100644
@@ -25,4 +25,21 @@ int alloc_bucket_spinlocks(spinlock_t **locks, unsigned int *lock_mask,
 void free_bucket_spinlocks(spinlock_t *locks);
 #endif /* LINUX_VERSION_IS_LESS(4,16,0) */
 
+#if LINUX_VERSION_IS_LESS(4,19,0)
+int __alloc_bucket_spinlocks(spinlock_t **locks, unsigned int *lock_mask,
+			     size_t max_size, unsigned int cpu_mult,
+			     gfp_t gfp, const char *name,
+			     struct lock_class_key *key);
+
+#define alloc_bucket_spinlocks(locks, lock_mask, max_size, cpu_mult, gfp)    \
+	({								     \
+		static struct lock_class_key key;			     \
+		int ret;						     \
+									     \
+		ret = __alloc_bucket_spinlocks(locks, lock_mask, max_size,   \
+					       cpu_mult, gfp, #locks, &key); \
+		ret;							\
+	})
+#endif /* LINUX_VERSION_IS_LESS(4,19,0) */
+
 #endif /* __BACKPORT_SPINLOCK_H */
Signature · 4 lines
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#18 lore raw
In reply to Luca Coelho
Quoted 6 lines · Luca Coelho

From: Luca Coelho <[email protected]>

Hi,

I finally found the time to go through the backports I had made for our internal tree and send them upstream.

Thank you for the patches. I had some comments, but in general they look good.

Quoted 2 lines

We've compile tested this on some old kernels, but the list is far from being comprehensive.

Which kernel versions do you support internally?

I tested this with some kernel versions and saw many problems with < 4.0 but I do not really care about them any more. The problems where mostly not caused by these patches.

Quoted 49 lines

Please review.

Cheers,
Luca.

Johannes Berg (1):
backports: improve skb->xmit_more handling

Luca Coelho (12):
backport: fix compilation with IPV6 not set
backport: introduce match_string() for kernels < 4.6
backport: add patch to ignore iwlwifi removal on < 3.14 kernels
backport: convert tree section names to ascii
backport: add rhashtable-types.h
backport: remove duplicate leds.h inclusion from backport-4.5.c
backport: prevent unused subclass variable warning in < 3.18
backport: make ktime_get_boottime_seconds() non-inline
backport: update u64_stats_init() to a new version in kernels < 4.2
backport: update lib-rhashtable.c
backport: convert int led activate op to void when needed
backports: add __alloc_bucket_spinlocks() for < 4.19

Shahar S Matityahu (1):
backports: add wait_event_killable_timeout backport support

 backport/backport-include/linux/netdevice.h   | 10 ++++++
 backport/backport-include/linux/skbuff.h      |  9 ++++++
 backport/backport-include/linux/spinlock.h    | 32 +++++++++++++++++++
 backport/backport-include/linux/string.h      |  4 +++
 backport/backport-include/linux/timekeeping.h |  5 +--
 backport/backport-include/linux/wait.h        | 15 +++++++++
 backport/compat/Kconfig                       |  1 +
 backport/compat/Makefile                      |  1 +
 backport/compat/backport-4.18.c               | 11 +++++++
 backport/compat/backport-4.4.c                |  6 ++++
 backport/compat/backport-4.5.c                |  1 -
 backport/compat/backport-4.6.c                | 26 +++++++++++++++
 devel/git-tracker.py                          |  2 ++
 .../0059-skb_xmit_more/skb_no_xmit_more.cocci | 10 ++----
 patches/iwlwifi-pci-device-removal.patch      | 24 ++++++++++++++
 patches/led_activate.cocci                    | 24 ++++++++++++++
 patches/lib-rhashtable.patch                  | 14 ++++++++
 17 files changed, 183 insertions(+), 12 deletions(-)
 create mode 100644 backport/compat/backport-4.18.c
 create mode 100644 patches/iwlwifi-pci-device-removal.patch
 create mode 100644 patches/led_activate.cocci
 create mode 100644 patches/lib-rhashtable.patch
#19 lore raw
Quoted 10 lines · Hauke Mehrtens
Quoted 6 lines · Luca Coelho

From: Luca Coelho <[email protected]>

Hi,

I finally found the time to go through the backports I had made for our internal tree and send them upstream.

Thank you for the patches. I had some comments, but in general they look good.

Than you too for yours! :)

Quoted 8 lines
Quoted 2 lines

We've compile tested this on some old kernels, but the list is far from being comprehensive.

Which kernel versions do you support internally?

I tested this with some kernel versions and saw many problems with < 4.0 but I do not really care about them any more. The problems where mostly not caused by these patches.

I don't really remember... I should write them down next time. But at least 4.4, 3.18... 3.14 IIRC. We have many build machines with different kernels and I only really notice them when something fails.

--
Cheers,
Luca.

--
To unsubscribe from this list: send the line "unsubscribe backports" in