Skip to contentSkip to conversation

updates & improvements

PATCH In review Johannes Berg 2 participants 25 messages Feb 21, 2020 – Mar 25, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover updates & improvements

This is what we have now to make our driver (only) work on 5.5, and because I got tired of waiting for the devel/git-tracker.py I threw in a speed improvement for the gentree --git option, using git's cat-file --batch API. We should use that for much more, and perhaps implicitly in the git library, but getting the files was one of the slower things, now it's barely noticable.

johannes

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

#1 lore raw

PATCH 1/15 backports: handle RHEL 7.6 kernel

From: Luca Coelho <[email protected]>

RHEL 7.6 uses kernel v3.10 with a lot of backports from newer kernels. This causes compilation to break in many places when the backports project is used. To solve the issue, check for RHEL release code 7.6 where appropriate. This doesn't take into consideration lower versions of the kernel (i.e. < 7.6), because it's very difficult to find the information about when each feature was backported.

type=maint
ticket=none

Reviewed-on: https://git-ger-8.devtools.intel.com/gerrit/71953

---
 .../backport-include/linux/bp-devcoredump.h   |   3 +-
 backport/backport-include/linux/etherdevice.h |   6 +-
 backport/backport-include/linux/firmware.h    |   6 +-
 backport/backport-include/linux/jiffies.h     |   5 +
 backport/backport-include/linux/kernel.h      |   3 +-
 backport/backport-include/linux/ktime.h       |   4 +-
 backport/backport-include/linux/mm.h          |  55 ++++++
 backport/backport-include/linux/netdevice.h   |   9 +-
 backport/backport-include/linux/netlink.h     |   3 +-
 backport/backport-include/linux/page_ref.h    |   3 +-
 backport/backport-include/linux/pci.h         |   3 +-
 backport/backport-include/linux/percpu.h      |   3 +-
 backport/backport-include/linux/pm_runtime.h  |   3 +-
 backport/backport-include/linux/property.h    |   3 +-
 backport/backport-include/linux/rtnetlink.h   |   3 +-
 backport/backport-include/linux/skbuff.h      |   6 +-
 backport/backport-include/linux/time.h        |   6 +
 backport/backport-include/linux/time64.h      |   3 +-
 backport/backport-include/linux/timekeeping.h |  15 +-
 .../backport-include/linux/u64_stats_sync.h   |   3 +-
 backport/backport-include/linux/uuid.h        |   3 +-
 backport/backport-include/linux/wait.h        |   3 +-
 backport/backport-include/net/genetlink.h     |   3 +-
 backport/backport-include/net/iw_handler.h    |   3 +-
 backport/backport-include/net/net_namespace.h |   3 +-
 backport/backport-include/net/netlink.h       |   6 +-
 backport/compat/backport-3.11.c               |   2 +
 backport/compat/backport-3.17.c               |   2 +
 backport/compat/backport-3.19.c               |   2 +
 backport/compat/backport-4.0.c                | 182 +++++++++++++++++-
 backport/compat/backport-4.2.c                |   4 +-
 backport/compat/backport-4.4.c                |   3 +-
 backport/compat/backport-genetlink.c          |  22 ++-
 patches/0028-select_queue/mac80211.patch      |  10 +-
 patches/0073-netdevice-mtu-range.cocci        |   4 +-
 patches/0075-ndo-stats-64.cocci               |   4 +-
 36 files changed, 351 insertions(+), 50 deletions(-)
backport/backport-include/linux/bp-devcoredump.h +2 -1
index 1e4abf646d65..8826cc1fee4b 100644
@@ -7,7 +7,8 @@
  * 4.6, outside that we can let our BPAUTO mechanism handle it.
  */
 #if (LINUX_VERSION_IS_GEQ(3,18,0) &&	\
-     LINUX_VERSION_IS_LESS(4,7,0))
+     LINUX_VERSION_IS_LESS(4,7,0)) ||   \
+	RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 static inline
 void backport_dev_coredumpm(struct device *dev, struct module *owner,
 			    void *data, size_t datalen, gfp_t gfp,
backport/backport-include/linux/etherdevice.h +4 -2
index a00e66608eae..6bb7467c4ce1 100644
@@ -80,7 +80,8 @@ extern int eth_prepare_mac_addr_change(struct net_device *dev, void *p);
 extern void eth_commit_mac_addr_change(struct net_device *dev, void *p);
 #endif /* < 3.9 */
 
-#if LINUX_VERSION_IS_LESS(3,12,0)
+#if LINUX_VERSION_IS_LESS(3,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 /**
  * eth_hw_addr_inherit - Copy dev_addr from another net_device
  * @dst: pointer to net_device to copy dev_addr to
@@ -193,7 +194,8 @@ static inline int eth_skb_pad(struct sk_buff *skb)
 }
 #endif /* LINUX_VERSION_IS_LESS(3,19,0) */
 
-#if LINUX_VERSION_IS_LESS(4,11,0)
+#if LINUX_VERSION_IS_LESS(4,11,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 /**
  * ether_addr_to_u64 - Convert an Ethernet address into a u64 value.
  * @addr: Pointer to a six-byte array containing the Ethernet address
backport/backport-include/linux/firmware.h +4 -2
index b5bc16befb85..9b2c01b2d8a5 100644
@@ -2,10 +2,12 @@
 #define __BACKPORT_LINUX_FIRMWARE_H
 #include_next <linux/firmware.h>
 
-#if LINUX_VERSION_IS_LESS(3,14,0)
+#if LINUX_VERSION_IS_LESS(3,14,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define request_firmware_direct(fw, name, device) request_firmware(fw, name, device)
 #endif
-#if LINUX_VERSION_IS_LESS(4,18,0)
+#if LINUX_VERSION_IS_LESS(4,18,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define firmware_request_nowarn(fw, name, device) request_firmware(fw, name, device)
 #endif
 
backport/backport-include/linux/jiffies.h +5 -0
index bbadcc8cd27e..caef7db30004 100644
@@ -1,5 +1,10 @@
 #ifndef __BACKPORT_LNIUX_JIFFIES_H
 #define __BACKPORT_LNIUX_JIFFIES_H
+
+#ifndef NSEC_PER_SEC
+#define NSEC_PER_SEC	1000000000L
+#endif
+
 #include_next <linux/jiffies.h>
 
 #ifndef time_is_before_jiffies
backport/backport-include/linux/kernel.h +2 -1
index f508166340f5..bf0889737497 100644
@@ -207,7 +207,8 @@ int __must_check kstrtobool_from_user(const char __user *s, size_t count, bool *
 
 #endif
 
-#if LINUX_VERSION_IS_LESS(3,14,0)
+#if LINUX_VERSION_IS_LESS(3,14,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline u32 reciprocal_scale(u32 val, u32 ep_ro)
 {
 	return (u32)(((u64) val * ep_ro) >> 32);
backport/backport-include/linux/ktime.h +3 -1
index 942729682c42..6ce22657b7f3 100644
@@ -4,7 +4,9 @@
 #include <linux/timekeeping.h>
 #include <linux/version.h>
 
-#if  LINUX_VERSION_IS_LESS(3,17,0)
+#if  LINUX_VERSION_IS_LESS(3,17,0) && \
+     RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
+
 #define ktime_get_raw LINUX_BACKPORT(ktime_get_raw)
 extern ktime_t ktime_get_raw(void);
 
backport/backport-include/linux/mm.h +55 -0

61 lines not on this page · raw message

backport/backport-include/linux/netdevice.h +6 -3
index 76b57e4df067..dd8a103d034d 100644
@@ -21,7 +21,8 @@ struct inet6_dev;
  */
 #include <linux/hardirq.h>
 
-#if LINUX_VERSION_IS_LESS(3,14,0)
+#if LINUX_VERSION_IS_LESS(3,14,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 /*
  * Backports note: if in-kernel support is provided we could then just
  * take the kernel's implementation of __dev_kfree_skb_irq() as it requires
@@ -237,7 +238,8 @@ static inline void backport_unregister_netdevice_many(struct list_head *head)
 #define napi_alloc_frag(fragsz) netdev_alloc_frag(fragsz)
 #endif
 
-#if LINUX_VERSION_IS_LESS(3,19,0)
+#if LINUX_VERSION_IS_LESS(3,19,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 /* RSS keys are 40 or 52 bytes long */
 #define NETDEV_RSS_KEY_LEN 52
 #define netdev_rss_key_fill LINUX_BACKPORT(netdev_rss_key_fill)
@@ -331,7 +333,8 @@ static inline void netif_tx_napi_add(struct net_device *dev,
 #define NETIF_F_CSUM_MASK NETIF_F_ALL_CSUM
 #endif
 
-#if LINUX_VERSION_IS_LESS(4,7,0)
+#if LINUX_VERSION_IS_LESS(4,7,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define netif_trans_update LINUX_BACKPORT(netif_trans_update)
 static inline void netif_trans_update(struct net_device *dev)
 {
backport/backport-include/linux/netlink.h +2 -1
index 0fb8e0f39b7a..f5ff9bc18598 100644
@@ -3,7 +3,8 @@
 #include_next <linux/netlink.h>
 #include <linux/version.h>
 
-#if LINUX_VERSION_IS_LESS(4,14,0)
+#if LINUX_VERSION_IS_LESS(4,14,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 struct nla_bitfield32 {
 	__u32 value;
 	__u32 selector;
backport/backport-include/linux/page_ref.h +2 -1
index e45734ecd96e..9c62ff2f72bb 100644
@@ -1,7 +1,8 @@
 #ifndef __BP_PAGE_REF_H
 #define __BP_PAGE_REF_H
 #include <linux/version.h>
-#if LINUX_VERSION_IS_GEQ(4,6,0)
+#if LINUX_VERSION_IS_GEQ(4,6,0) || \
+	RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 #include_next <linux/page_ref.h>
 #else
 static inline void page_ref_inc(struct page *page)
backport/backport-include/linux/pci.h +2 -1
index 1cc5f28192bb..377e9f99e5a7 100644
@@ -210,7 +210,8 @@ static inline int pci_enable_msix_exact(struct pci_dev *dev,
 #if LINUX_VERSION_IS_LESS(4,9,0) &&			\
 	!LINUX_VERSION_IN_RANGE(3,12,69, 3,13,0) &&	\
 	!LINUX_VERSION_IN_RANGE(4,4,37, 4,5,0) &&	\
-	!LINUX_VERSION_IN_RANGE(4,8,13, 4,9,0)
+	!LINUX_VERSION_IN_RANGE(4,8,13, 4,9,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 
 static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev)
 {
backport/backport-include/linux/percpu.h +2 -1
index 10be03cba795..16f3656f1ad9 100644
@@ -5,7 +5,8 @@
 #define __BACKPORT_PERCPU_H
 #include_next <linux/percpu.h>
 
-#if LINUX_VERSION_IS_LESS(3,18,0)
+#if LINUX_VERSION_IS_LESS(3,18,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline void __percpu *__alloc_gfp_warn(void)
 {
 	WARN(1, "Cannot backport alloc_percpu_gfp");
backport/backport-include/linux/pm_runtime.h +2 -1
index e16cd30bf5c7..0e77292f53ea 100644
@@ -16,7 +16,8 @@ static inline bool pm_runtime_active(struct device *dev) { return true; }
 
 #endif /* LINUX_VERSION_IS_LESS(3,9,0) */
 
-#if LINUX_VERSION_IS_LESS(3,15,0)
+#if LINUX_VERSION_IS_LESS(3,15,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline int pm_runtime_force_suspend(struct device *dev)
 {
 #ifdef CONFIG_PM
backport/backport-include/linux/property.h +2 -1
index a0d7bed12af3..cef521c07863 100644
@@ -1,7 +1,8 @@
 #ifndef __BACKPORT_LINUX_PROPERTY_H_
 #define __BACKPORT_LINUX_PROPERTY_H_
 #include <linux/version.h>
-#if LINUX_VERSION_IS_GEQ(3,18,17)
+#if LINUX_VERSION_IS_GEQ(3,18,17) || \
+	RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 #include_next <linux/property.h>
 #endif
 
backport/backport-include/linux/rtnetlink.h +2 -1
index 59beffa8316a..5b9eea64b7e6 100644
@@ -19,7 +19,8 @@
 #endif
 
 #if LINUX_VERSION_IS_LESS(3,13,0) &&		\
-	!defined(CONFIG_PROVE_LOCKING)
+	!defined(CONFIG_PROVE_LOCKING) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline bool lockdep_rtnl_is_held(void)
 {
 	return true;
backport/backport-include/linux/skbuff.h +4 -2
index 42b048ad14bf..8af34146432e 100644
@@ -300,7 +300,8 @@ int skb_ensure_writable(struct sk_buff *skb, int write_len);
 
 #endif /* LINUX_VERSION_IS_LESS(3,19,0) */
 
-#if LINUX_VERSION_IS_LESS(4,2,0)
+#if LINUX_VERSION_IS_LESS(4,2,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline void skb_free_frag(void *data)
 {
 	put_page(virt_to_head_page(data));
@@ -329,7 +330,8 @@ static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key)
 #endif /* LINUX_VERSION_IS_LESS(3,3,0) */
 #endif /* LINUX_VERSION_IS_LESS(4,2,0) */
 
-#if LINUX_VERSION_IS_LESS(4,13,0)
+#if LINUX_VERSION_IS_LESS(4,13,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline void *backport_skb_put(struct sk_buff *skb, unsigned int len)
 {
 	return skb_put(skb, len);
backport/backport-include/linux/time.h +6 -0
index 3191047dcfbc..c3a902ebd268 100644
@@ -1,5 +1,11 @@
 #ifndef __BACKPORT_LINUX_TIME_H
 #define __BACKPORT_LINUX_TIME_H
+
+#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
+#include_next <linux/time64.h>
+#include <uapi/linux/time.h>
+#endif
+
 #include_next <linux/time.h>
 
 #include <linux/time64.h>
backport/backport-include/linux/time64.h +2 -1
index 49805da9dfce..62a7a1947f48 100644
@@ -6,7 +6,8 @@
 #include <linux/time.h>
 #endif
 
-#if LINUX_VERSION_IS_LESS(3,17,0)
+#if LINUX_VERSION_IS_LESS(3,17,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define timespec64_equal		timespec_equal
 #define timespec64_compare		timespec_compare
 #define set_normalized_timespec64	set_normalized_timespec
backport/backport-include/linux/timekeeping.h +10 -5
index 25ceaf3eec77..3f4a211721b2 100644
@@ -3,11 +3,13 @@
 #include <linux/version.h>
 #include <linux/types.h>
 
-#if LINUX_VERSION_IS_GEQ(3,17,0)
+#if LINUX_VERSION_IS_GEQ(3,17,0) || \
+	RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 #include_next <linux/timekeeping.h>
 #endif
 
-#if LINUX_VERSION_IS_LESS(3,17,0)
+#if LINUX_VERSION_IS_LESS(3,17,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define ktime_get_ns LINUX_BACKPORT(ktime_get_ns)
 extern ktime_t ktime_get(void);
 #define ktime_get_ns LINUX_BACKPORT(ktime_get_ns)
@@ -54,14 +56,16 @@ static inline time64_t ktime_get_real_seconds(void)
 }
 #endif
 
-#if LINUX_VERSION_IS_LESS(3,17,0)
+#if LINUX_VERSION_IS_LESS(3,17,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline void ktime_get_ts64(struct timespec64 *ts)
 {
 	ktime_get_ts(ts);
 }
 #endif
 
-#if LINUX_VERSION_IS_LESS(3,17,0)
+#if LINUX_VERSION_IS_LESS(3,17,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 /* This was introduced in 4.15, but we only need it in the
  * ktime_get_raw_ts64 backport() for < 3.17.
  */
@@ -83,7 +87,8 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
 #endif
 #endif /* < 3.17 */
 
-#if LINUX_VERSION_IS_LESS(4,18,0)
+#if LINUX_VERSION_IS_LESS(4,18,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define ktime_get_raw_ts64 LINUX_BACKPORT(ktime_get_raw_ts64)
 static inline void ktime_get_raw_ts64(struct timespec64 *ts)
 {
backport/backport-include/linux/u64_stats_sync.h +2 -1
index 251373a74139..33278d509863 100644
@@ -115,7 +115,8 @@ static inline bool u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
 #endif /* LINUX_VERSION_IS_GEQ(3,6,0) */
 
 #if LINUX_VERSION_IS_LESS(3,15,0) && \
-    !(LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30)
+    !(LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline unsigned int u64_stats_fetch_begin_irq(const struct u64_stats_sync *syncp)
 {
 #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
backport/backport-include/linux/uuid.h +2 -1
index bc6fbe17cb08..69f7d8c8b733 100644
@@ -11,7 +11,8 @@
 #define	UUID_STRING_LEN		36
 #endif
 
-#if LINUX_VERSION_IS_LESS(4,13,0)
+#if LINUX_VERSION_IS_LESS(4,13,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define guid_t uuid_le
 #define uuid_t uuid_be
 
backport/backport-include/linux/wait.h +2 -1
index 15a674cfe019..fc5b52c4d457 100644
@@ -2,7 +2,8 @@
 #define __BACKPORT_LINUX_WAIT_H
 #include_next <linux/wait.h>
 
-#if LINUX_VERSION_IS_LESS(3,17,0)
+#if LINUX_VERSION_IS_LESS(3,17,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 extern int bit_wait(void *);
 extern int bit_wait_io(void *);
 
backport/backport-include/net/genetlink.h +2 -1
index 747b6dac2df5..e6b78e02afe3 100644
@@ -27,7 +27,8 @@ static inline int genl_err_attr(struct genl_info *info, int err,
 /* this is for patches we apply */
 static inline struct netlink_ext_ack *genl_info_extack(struct genl_info *info)
 {
-#if LINUX_VERSION_IS_GEQ(4,12,0)
+#if LINUX_VERSION_IS_GEQ(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 	return info->extack;
 #else
 	return info->userhdr;
backport/backport-include/net/iw_handler.h +2 -1
index 84d63b30953e..f908446661c4 100644
@@ -2,7 +2,8 @@
 #define __BACKPORT_IW_HANDLER_H
 #include_next <net/iw_handler.h>
 
-#if LINUX_VERSION_IS_LESS(4,1,0)
+#if LINUX_VERSION_IS_LESS(4,1,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline char *
 iwe_stream_add_event_check(struct iw_request_info *info, char *stream,
 			   char *ends, struct iw_event *iwe, int event_len)
backport/backport-include/net/net_namespace.h +2 -1
index 1e84297c9476..e8438cbcd4df 100644
@@ -14,7 +14,8 @@ static inline struct net *get_net_ns_by_fd(int fd)
 }
 #endif
 
-#if LINUX_VERSION_IS_LESS(4,1,0)
+#if LINUX_VERSION_IS_LESS(4,1,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 typedef struct {
 #ifdef CONFIG_NET_NS
 	struct net *net;
backport/backport-include/net/netlink.h +4 -2
index b2045e44737a..bc24adfb4d63 100644
@@ -557,7 +557,8 @@ static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value)
 #define NLA_TYPE_MAX (__NLA_TYPE_MAX - 1)
 #endif
 
-#if LINUX_VERSION_IS_LESS(4,1,0)
+#if LINUX_VERSION_IS_LESS(4,1,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define nla_put_in_addr LINUX_BACKPORT(nla_put_in_addr)
 static inline int nla_put_in_addr(struct sk_buff *skb, int attrtype,
 				  __be32 addr)
@@ -706,7 +707,8 @@ static inline int nla_put_s64(struct sk_buff *skb, int attrtype, s64 value,
 }
 #endif /* < 4.7 */
 
-#if LINUX_VERSION_IS_LESS(4,10,0)
+#if LINUX_VERSION_IS_LESS(4,10,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 /**
  * nla_memdup - duplicate attribute memory (kmemdup)
  * @src: netlink attribute to duplicate from
backport/compat/backport-3.11.c +2 -0
index 7f9ff3419344..a3d4ea54e3eb 100644
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/scatterlist.h>
 
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static bool sg_miter_get_next_page(struct sg_mapping_iter *miter)
 {
 	if (!miter->__remaining) {
@@ -122,3 +123,4 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf,
 	return offset;
 }
 EXPORT_SYMBOL_GPL(sg_copy_buffer);
+#endif
backport/compat/backport-3.17.c +2 -0
index bf6027cbeb5e..adabec1b5367 100644
@@ -15,6 +15,7 @@
 #include <linux/jiffies.h>
 #include <linux/moduleparam.h>
 
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 int bit_wait(void *word)
 {
 	schedule();
@@ -28,6 +29,7 @@ int bit_wait_io(void *word)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(bit_wait_io);
+#endif
 
 /**
  * ktime_get_raw - Returns the raw monotonic time in ktime_t format
backport/compat/backport-3.19.c +2 -0
index 019644dfab42..ec44130e1dbd 100644
@@ -83,6 +83,7 @@ int woken_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key)
 EXPORT_SYMBOL(woken_wake_function);
 #endif
 
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static u8 netdev_rss_key[NETDEV_RSS_KEY_LEN];
 
 void netdev_rss_key_fill(void *buffer, size_t len)
@@ -96,6 +97,7 @@ void netdev_rss_key_fill(void *buffer, size_t len)
 #endif
 }
 EXPORT_SYMBOL_GPL(netdev_rss_key_fill);
+#endif
 
 #if defined(CONFIG_DEBUG_FS)
 struct debugfs_devm_entry {
backport/compat/backport-4.0.c +181 -1

194 lines not on this page · raw message

backport/compat/backport-4.2.c +3 -1
index b275d349f7eb..85c7d594f05f 100644
@@ -11,7 +11,8 @@
 #include <crypto/scatterwalk.h>
 #include <crypto/aead.h>
 
-static struct scatterlist *scatterwalk_ffwd(struct scatterlist dst[2],
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
+ static struct scatterlist *scatterwalk_ffwd(struct scatterlist dst[2],
 					    struct scatterlist *src,
 					    unsigned int len)
 {
@@ -32,6 +33,7 @@ static struct scatterlist *scatterwalk_ffwd(struct scatterlist dst[2],
 
 	return dst;
 }
+#endif
 
 struct aead_old_request {
 	struct scatterlist srcbuf[2];
backport/compat/backport-4.4.c +2 -1
index 7966e94928e7..1782a03486fb 100644
@@ -21,7 +21,8 @@
 #include <asm/unaligned.h>
 
 #ifdef CONFIG_DEBUG_FS
-#if LINUX_VERSION_IS_LESS(4,3,0)
+#if LINUX_VERSION_IS_LESS(4,3,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static ssize_t debugfs_read_file_bool(struct file *file, char __user *user_buf,
 				      size_t count, loff_t *ppos)
 {
backport/compat/backport-genetlink.c +16 -6
index 4707858990e2..c7f350f6f33e 100644
@@ -17,6 +17,7 @@
 #include <net/netlink.h>
 #include <net/sock.h>
 
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static const struct genl_family *find_family_real_ops(__genl_const struct genl_ops **ops)
 {
 	const struct genl_family *family;
@@ -33,7 +34,8 @@ static const struct genl_family *find_family_real_ops(__genl_const struct genl_o
 	return family;
 }
 
-#if LINUX_VERSION_IS_LESS(4,12,0)
+#if LINUX_VERSION_IS_LESS(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 enum nlmsgerr_attrs {
 	NLMSGERR_ATTR_UNUSED,
 	NLMSGERR_ATTR_MSG,
@@ -154,7 +156,8 @@ static int backport_pre_doit(__genl_const struct genl_ops *ops,
 {
 	const struct genl_family *family = find_family_real_ops(&ops);
 	int err;
-#if LINUX_VERSION_IS_LESS(4,12,0)
+#if LINUX_VERSION_IS_LESS(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 	struct netlink_ext_ack *extack = kzalloc(sizeof(*extack), GFP_KERNEL);
 
 	if (!extack)
@@ -179,7 +182,8 @@ static int backport_pre_doit(__genl_const struct genl_ops *ops,
 	if (!err && family->pre_doit)
 		err = family->pre_doit(ops, skb, info);
 
-#if LINUX_VERSION_IS_LESS(4,12,0)
+#if LINUX_VERSION_IS_LESS(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 	if (err) {
 		/* signal to do nothing */
 		extack->__bp_doit = NULL;
@@ -204,7 +208,8 @@ static void backport_post_doit(__genl_const struct genl_ops *ops,
 {
 	const struct genl_family *family = find_family_real_ops(&ops);
 
-#if LINUX_VERSION_IS_LESS(4,12,0)
+#if LINUX_VERSION_IS_LESS(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 	if (genl_info_extack(info)->__bp_doit)
 #else
 	if (1)
@@ -212,11 +217,13 @@ static void backport_post_doit(__genl_const struct genl_ops *ops,
 		if (family->post_doit)
 			family->post_doit(ops, skb, info);
 
-#if LINUX_VERSION_IS_LESS(4,12,0)
+#if LINUX_VERSION_IS_LESS(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 	kfree(__bp_genl_info_userhdr(info));
 #endif
 }
 
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 int backport_genl_register_family(struct genl_family *family)
 {
 	struct genl_ops *ops;
@@ -237,7 +244,8 @@ int backport_genl_register_family(struct genl_family *family)
 	 * memory layout isn't compatible with the old version
 	 */
 	for (i = 0; i < family->n_ops; i++) {
-#if LINUX_VERSION_IS_LESS(4,12,0)
+#if LINUX_VERSION_IS_LESS(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 		if (ops[i].doit)
 			ops[i].doit = extack_doit;
 #endif
@@ -311,6 +319,7 @@ int backport_genl_unregister_family(struct genl_family *family)
 	return __real_backport_genl_unregister_family(&family->family);
 }
 EXPORT_SYMBOL_GPL(backport_genl_unregister_family);
+#endif
 
 #define INVALID_GROUP	0xffffffff
 
@@ -441,3 +450,4 @@ int backport_genlmsg_multicast_allns(const struct genl_family *family,
 	return genlmsg_mcast(skb, portid, group, flags);
 }
 EXPORT_SYMBOL_GPL(backport_genlmsg_multicast_allns);
+#endif /* RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6) */
patches/0028-select_queue/mac80211.patch +6 -4
index f488589dd379..45cf0faa09f4 100644
@@ -1,6 +1,6 @@
 --- a/net/mac80211/iface.c
 +++ b/net/mac80211/iface.c
-@@ -1128,9 +1128,29 @@ static void ieee80211_uninit(struct net_
+@@ -1128,9 +1128,30 @@ static void ieee80211_uninit(struct net_
  	ieee80211_teardown_sdata(IEEE80211_DEV_TO_SUB_IF(dev));
  }
  
@@ -14,7 +14,8 @@
 +					 struct net_device *sb_dev,
 +					 select_queue_fallback_t fallback)
 +#elif LINUX_VERSION_IS_GEQ(3,14,0) || \
-+    (LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30)
++    (LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30) || \
++       RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 +static u16 ieee80211_netdev_select_queue(struct net_device *dev,
 +					 struct sk_buff *skb,
 +					 void *accel_priv,
@@ -30,7 +31,7 @@
  {
  	return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb);
  }
-@@ -1173,9 +1193,29 @@ static const struct net_device_ops ieee8
+@@ -1173,9 +1193,30 @@ static const struct net_device_ops ieee8
  	.ndo_get_stats64	= ieee80211_get_stats64,
  };
  
@@ -44,7 +45,8 @@
 +					  struct net_device *sb_dev,
 +					  select_queue_fallback_t fallback)
 +#elif LINUX_VERSION_IS_GEQ(3,14,0) || \
-+    (LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30)
++    (LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30) || \
++       RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 +static u16 ieee80211_monitor_select_queue(struct net_device *dev,
 +					  struct sk_buff *skb,
 +					  void *accel_priv,
patches/0073-netdevice-mtu-range.cocci +2 -2
index 7a4b65322803..7f902c7a09eb 100644
@@ -73,7 +73,7 @@ func(...) {
 constant r1.e1,r1.e2;
 identifier r.OPS;
 @@
-+#if LINUX_VERSION_IS_LESS(4,10,0)
++#if LINUX_VERSION_IS_LESS(4,10,0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 + static int __change_mtu(struct net_device *ndev, int new_mtu)
 + {
 + if (new_mtu < e1 || new_mtu > e2)
@@ -92,7 +92,7 @@ identifier OPS;
 @@
 
 struct net_device_ops OPS = {
-+#if LINUX_VERSION_IS_LESS(4,10,0)
++#if LINUX_VERSION_IS_LESS(4,10,0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 +      .ndo_change_mtu = __change_mtu,
 +#endif
        ...
patches/0075-ndo-stats-64.cocci +2 -2
index 8971a97c7209..f23059f3ba10 100644
@@ -5,7 +5,7 @@ fresh identifier stats64_fn_wrap = "bp_" ## stats64_fn;
 position p;
 @@
 struct net_device_ops OPS@p = {
-+#if LINUX_VERSION_IS_GEQ(4,11,0)
++#if LINUX_VERSION_IS_GEQ(4,11,0) || RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 	.ndo_get_stats64 = stats64_fn,
 +#else
 +	.ndo_get_stats64 = stats64_fn_wrap,
@@ -17,7 +17,7 @@ identifier r.stats64_fn_wrap;
 identifier r.stats64_fn;
 @@
 void stats64_fn(...) {...}
-+#if LINUX_VERSION_IS_LESS(4,11,0)
++#if LINUX_VERSION_IS_LESS(4,11,0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 +/* Just declare it here to keep sparse happy */
 +struct rtnl_link_stats64 *
 +stats64_fn_wrap(struct net_device *dev,
Signature · 4 lines
2.24.1

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

Re: [PATCH 01/15] backports: handle RHEL 7.6 kernel

Quoted 11 lines · Johannes Berg

From: Luca Coelho <[email protected]>

RHEL 7.6 uses kernel v3.10 with a lot of backports from newer kernels. This causes compilation to break in many places when the backports project is used. To solve the issue, check for RHEL release code 7.6 where appropriate. This doesn't take into consideration lower versions of the kernel (i.e. < 7.6), because it's very difficult to find the information about when each feature was backported.

type=maint
ticket=none

Please remove these internal tags.

Quoted 195 lines

Reviewed-on: https://git-ger-8.devtools.intel.com/gerrit/71953

---
 .../backport-include/linux/bp-devcoredump.h   |   3 +-
 backport/backport-include/linux/etherdevice.h |   6 +-
 backport/backport-include/linux/firmware.h    |   6 +-
 backport/backport-include/linux/jiffies.h     |   5 +
 backport/backport-include/linux/kernel.h      |   3 +-
 backport/backport-include/linux/ktime.h       |   4 +-
 backport/backport-include/linux/mm.h          |  55 ++++++
 backport/backport-include/linux/netdevice.h   |   9 +-
 backport/backport-include/linux/netlink.h     |   3 +-
 backport/backport-include/linux/page_ref.h    |   3 +-
 backport/backport-include/linux/pci.h         |   3 +-
 backport/backport-include/linux/percpu.h      |   3 +-
 backport/backport-include/linux/pm_runtime.h  |   3 +-
 backport/backport-include/linux/property.h    |   3 +-
 backport/backport-include/linux/rtnetlink.h   |   3 +-
 backport/backport-include/linux/skbuff.h      |   6 +-
 backport/backport-include/linux/time.h        |   6 +
 backport/backport-include/linux/time64.h      |   3 +-
 backport/backport-include/linux/timekeeping.h |  15 +-
 .../backport-include/linux/u64_stats_sync.h   |   3 +-
 backport/backport-include/linux/uuid.h        |   3 +-
 backport/backport-include/linux/wait.h        |   3 +-
 backport/backport-include/net/genetlink.h     |   3 +-
 backport/backport-include/net/iw_handler.h    |   3 +-
 backport/backport-include/net/net_namespace.h |   3 +-
 backport/backport-include/net/netlink.h       |   6 +-
 backport/compat/backport-3.11.c               |   2 +
 backport/compat/backport-3.17.c               |   2 +
 backport/compat/backport-3.19.c               |   2 +
 backport/compat/backport-4.0.c                | 182 +++++++++++++++++-
 backport/compat/backport-4.2.c                |   4 +-
 backport/compat/backport-4.4.c                |   3 +-
 backport/compat/backport-genetlink.c          |  22 ++-
 patches/0028-select_queue/mac80211.patch      |  10 +-
 patches/0073-netdevice-mtu-range.cocci        |   4 +-
 patches/0075-ndo-stats-64.cocci               |   4 +-
 36 files changed, 351 insertions(+), 50 deletions(-)
backport/backport-include/linux/bp-devcoredump.h +2 -1
index 1e4abf646d65..8826cc1fee4b 100644
@@ -7,7 +7,8 @@
  * 4.6, outside that we can let our BPAUTO mechanism handle it.
  */
 #if (LINUX_VERSION_IS_GEQ(3,18,0) &&	\
-     LINUX_VERSION_IS_LESS(4,7,0))
+     LINUX_VERSION_IS_LESS(4,7,0)) ||   \
+	RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 static inline
 void backport_dev_coredumpm(struct device *dev, struct module *owner,
 			    void *data, size_t datalen, gfp_t gfp,
backport/backport-include/linux/etherdevice.h +4 -2
index a00e66608eae..6bb7467c4ce1 100644
@@ -80,7 +80,8 @@ extern int eth_prepare_mac_addr_change(struct net_device *dev, void *p);
 extern void eth_commit_mac_addr_change(struct net_device *dev, void *p);
 #endif /* < 3.9 */
 
-#if LINUX_VERSION_IS_LESS(3,12,0)
+#if LINUX_VERSION_IS_LESS(3,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 /**
  * eth_hw_addr_inherit - Copy dev_addr from another net_device
  * @dst: pointer to net_device to copy dev_addr to
@@ -193,7 +194,8 @@ static inline int eth_skb_pad(struct sk_buff *skb)
 }
 #endif /* LINUX_VERSION_IS_LESS(3,19,0) */
 
-#if LINUX_VERSION_IS_LESS(4,11,0)
+#if LINUX_VERSION_IS_LESS(4,11,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 /**
  * ether_addr_to_u64 - Convert an Ethernet address into a u64 value.
  * @addr: Pointer to a six-byte array containing the Ethernet address
backport/backport-include/linux/firmware.h +4 -2
index b5bc16befb85..9b2c01b2d8a5 100644
@@ -2,10 +2,12 @@
 #define __BACKPORT_LINUX_FIRMWARE_H
 #include_next <linux/firmware.h>
 
-#if LINUX_VERSION_IS_LESS(3,14,0)
+#if LINUX_VERSION_IS_LESS(3,14,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define request_firmware_direct(fw, name, device) request_firmware(fw, name, device)
 #endif
-#if LINUX_VERSION_IS_LESS(4,18,0)
+#if LINUX_VERSION_IS_LESS(4,18,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define firmware_request_nowarn(fw, name, device) request_firmware(fw, name, device)
 #endif
 
backport/backport-include/linux/jiffies.h +5 -0
index bbadcc8cd27e..caef7db30004 100644
@@ -1,5 +1,10 @@
 #ifndef __BACKPORT_LNIUX_JIFFIES_H
 #define __BACKPORT_LNIUX_JIFFIES_H
+
+#ifndef NSEC_PER_SEC
+#define NSEC_PER_SEC	1000000000L
+#endif
+
 #include_next <linux/jiffies.h>
 
 #ifndef time_is_before_jiffies
backport/backport-include/linux/kernel.h +2 -1
index f508166340f5..bf0889737497 100644
@@ -207,7 +207,8 @@ int __must_check kstrtobool_from_user(const char __user *s, size_t count, bool *
 
 #endif
 
-#if LINUX_VERSION_IS_LESS(3,14,0)
+#if LINUX_VERSION_IS_LESS(3,14,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline u32 reciprocal_scale(u32 val, u32 ep_ro)
 {
 	return (u32)(((u64) val * ep_ro) >> 32);
backport/backport-include/linux/ktime.h +3 -1
index 942729682c42..6ce22657b7f3 100644
@@ -4,7 +4,9 @@
 #include <linux/timekeeping.h>
 #include <linux/version.h>
 
-#if  LINUX_VERSION_IS_LESS(3,17,0)
+#if  LINUX_VERSION_IS_LESS(3,17,0) && \
+     RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
+
 #define ktime_get_raw LINUX_BACKPORT(ktime_get_raw)
 extern ktime_t ktime_get_raw(void);
 
backport/backport-include/linux/mm.h +45 -0
index 8ff7d6a62330..8b97f98cf830 100644
@@ -12,6 +12,61 @@
 void kvfree(const void *addr);
 #endif /* < 3.15 */
 
+#if LINUX_VERSION_IS_LESS(3,20,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
+#define get_user_pages_locked LINUX_BACKPORT(get_user_pages_locked)
+long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
+		    int write, int force, struct page **pages, int *locked);
+#define get_user_pages_unlocked LINUX_BACKPORT(get_user_pages_unlocked)
+long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
+		    int write, int force, struct page **pages);
+#elif LINUX_VERSION_IS_LESS(4,6,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
+static inline
+long backport_get_user_pages_locked(unsigned long start, unsigned long nr_pages,
+		    int write, int force, struct page **pages, int *locked)
+{
+	return get_user_pages_locked(current, current->mm, start, nr_pages,
+		    write, force, pages, locked);
+}
+#define get_user_pages_locked LINUX_BACKPORT(get_user_pages_locked)
+
+static inline
+long backport_get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
+				      int write, int force, struct page **pages)
+{
+	return get_user_pages_unlocked(current, current->mm, start,  nr_pages,
+		    write, force, pages);
+}
+#define get_user_pages_unlocked LINUX_BACKPORT(get_user_pages_unlocked)
+#endif
+
+#if LINUX_VERSION_IS_LESS(4,6,0)
+static inline
+long backport_get_user_pages(unsigned long start, unsigned long nr_pages,
+			    int write, int force, struct page **pages,
+			    struct vm_area_struct **vmas)
+{
+	return get_user_pages(current, current->mm, start,  nr_pages,
+		    write, force, pages, vmas);
+}
+#define get_user_pages LINUX_BACKPORT(get_user_pages)
+#endif
+
+#ifndef FOLL_TRIED
+#define FOLL_TRIED	0x800	/* a retry, previous pass started an IO */
+#endif
+

backport/backport-include/linux/mm.h line 69

Quoted 10 lines
backport/backport-include/linux/mm.h +10 -0
+#if LINUX_VERSION_IS_LESS(4,1,9) && \
+     LINUX_VERSION_IS_GEQ(3,6,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
+#define page_is_pfmemalloc LINUX_BACKPORT(page_is_pfmemalloc)
+static inline bool page_is_pfmemalloc(struct page *page)
+{
+	return page->pfmemalloc;
+}
+#endif /* < 4.2 */
+

This block caused problems and is not needed any more, I removed it here:
https://git.kernel.org/pub/scm/linux/kernel/git/backports/backports.git/commit/?id=221755b9531d8b3395058a7a6f8a4e3b49783561

Please check if you really need it.

Quoted 164 lines
backport/backport-include/linux/mm.h +0 -0
 #if LINUX_VERSION_IS_LESS(4,12,0)
 #define kvmalloc LINUX_BACKPORT(kvmalloc)
 static inline void *kvmalloc(size_t size, gfp_t flags)
backport/backport-include/linux/netdevice.h +6 -3
index 76b57e4df067..dd8a103d034d 100644
@@ -21,7 +21,8 @@ struct inet6_dev;
  */
 #include <linux/hardirq.h>
 
-#if LINUX_VERSION_IS_LESS(3,14,0)
+#if LINUX_VERSION_IS_LESS(3,14,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 /*
  * Backports note: if in-kernel support is provided we could then just
  * take the kernel's implementation of __dev_kfree_skb_irq() as it requires
@@ -237,7 +238,8 @@ static inline void backport_unregister_netdevice_many(struct list_head *head)
 #define napi_alloc_frag(fragsz) netdev_alloc_frag(fragsz)
 #endif
 
-#if LINUX_VERSION_IS_LESS(3,19,0)
+#if LINUX_VERSION_IS_LESS(3,19,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 /* RSS keys are 40 or 52 bytes long */
 #define NETDEV_RSS_KEY_LEN 52
 #define netdev_rss_key_fill LINUX_BACKPORT(netdev_rss_key_fill)
@@ -331,7 +333,8 @@ static inline void netif_tx_napi_add(struct net_device *dev,
 #define NETIF_F_CSUM_MASK NETIF_F_ALL_CSUM
 #endif
 
-#if LINUX_VERSION_IS_LESS(4,7,0)
+#if LINUX_VERSION_IS_LESS(4,7,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define netif_trans_update LINUX_BACKPORT(netif_trans_update)
 static inline void netif_trans_update(struct net_device *dev)
 {
backport/backport-include/linux/netlink.h +2 -1
index 0fb8e0f39b7a..f5ff9bc18598 100644
@@ -3,7 +3,8 @@
 #include_next <linux/netlink.h>
 #include <linux/version.h>
 
-#if LINUX_VERSION_IS_LESS(4,14,0)
+#if LINUX_VERSION_IS_LESS(4,14,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 struct nla_bitfield32 {
 	__u32 value;
 	__u32 selector;
backport/backport-include/linux/page_ref.h +2 -1
index e45734ecd96e..9c62ff2f72bb 100644
@@ -1,7 +1,8 @@
 #ifndef __BP_PAGE_REF_H
 #define __BP_PAGE_REF_H
 #include <linux/version.h>
-#if LINUX_VERSION_IS_GEQ(4,6,0)
+#if LINUX_VERSION_IS_GEQ(4,6,0) || \
+	RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 #include_next <linux/page_ref.h>
 #else
 static inline void page_ref_inc(struct page *page)
backport/backport-include/linux/pci.h +2 -1
index 1cc5f28192bb..377e9f99e5a7 100644
@@ -210,7 +210,8 @@ static inline int pci_enable_msix_exact(struct pci_dev *dev,
 #if LINUX_VERSION_IS_LESS(4,9,0) &&			\
 	!LINUX_VERSION_IN_RANGE(3,12,69, 3,13,0) &&	\
 	!LINUX_VERSION_IN_RANGE(4,4,37, 4,5,0) &&	\
-	!LINUX_VERSION_IN_RANGE(4,8,13, 4,9,0)
+	!LINUX_VERSION_IN_RANGE(4,8,13, 4,9,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 
 static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev)
 {
backport/backport-include/linux/percpu.h +2 -1
index 10be03cba795..16f3656f1ad9 100644
@@ -5,7 +5,8 @@
 #define __BACKPORT_PERCPU_H
 #include_next <linux/percpu.h>
 
-#if LINUX_VERSION_IS_LESS(3,18,0)
+#if LINUX_VERSION_IS_LESS(3,18,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline void __percpu *__alloc_gfp_warn(void)
 {
 	WARN(1, "Cannot backport alloc_percpu_gfp");
backport/backport-include/linux/pm_runtime.h +2 -1
index e16cd30bf5c7..0e77292f53ea 100644
@@ -16,7 +16,8 @@ static inline bool pm_runtime_active(struct device *dev) { return true; }
 
 #endif /* LINUX_VERSION_IS_LESS(3,9,0) */
 
-#if LINUX_VERSION_IS_LESS(3,15,0)
+#if LINUX_VERSION_IS_LESS(3,15,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline int pm_runtime_force_suspend(struct device *dev)
 {
 #ifdef CONFIG_PM
backport/backport-include/linux/property.h +2 -1
index a0d7bed12af3..cef521c07863 100644
@@ -1,7 +1,8 @@
 #ifndef __BACKPORT_LINUX_PROPERTY_H_
 #define __BACKPORT_LINUX_PROPERTY_H_
 #include <linux/version.h>
-#if LINUX_VERSION_IS_GEQ(3,18,17)
+#if LINUX_VERSION_IS_GEQ(3,18,17) || \
+	RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 #include_next <linux/property.h>
 #endif
 
backport/backport-include/linux/rtnetlink.h +2 -1
index 59beffa8316a..5b9eea64b7e6 100644
@@ -19,7 +19,8 @@
 #endif
 
 #if LINUX_VERSION_IS_LESS(3,13,0) &&		\
-	!defined(CONFIG_PROVE_LOCKING)
+	!defined(CONFIG_PROVE_LOCKING) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline bool lockdep_rtnl_is_held(void)
 {
 	return true;
backport/backport-include/linux/skbuff.h +4 -2
index 42b048ad14bf..8af34146432e 100644
@@ -300,7 +300,8 @@ int skb_ensure_writable(struct sk_buff *skb, int write_len);
 
 #endif /* LINUX_VERSION_IS_LESS(3,19,0) */
 
-#if LINUX_VERSION_IS_LESS(4,2,0)
+#if LINUX_VERSION_IS_LESS(4,2,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline void skb_free_frag(void *data)
 {
 	put_page(virt_to_head_page(data));
@@ -329,7 +330,8 @@ static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key)
 #endif /* LINUX_VERSION_IS_LESS(3,3,0) */
 #endif /* LINUX_VERSION_IS_LESS(4,2,0) */
 
-#if LINUX_VERSION_IS_LESS(4,13,0)
+#if LINUX_VERSION_IS_LESS(4,13,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline void *backport_skb_put(struct sk_buff *skb, unsigned int len)
 {
 	return skb_put(skb, len);
backport/backport-include/linux/time.h +0 -0
index 3191047dcfbc..c3a902ebd268 100644

backport/backport-include/linux/time.h line 8

Quoted 8 lines
backport/backport-include/linux/time.h +6 -0
@@ -1,5 +1,11 @@
 #ifndef __BACKPORT_LINUX_TIME_H
 #define __BACKPORT_LINUX_TIME_H
+
+#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
+#include_next <linux/time64.h>
+#include <uapi/linux/time.h>
+#endif
+

Something is strange with the time header file handling.

Quoted 408 lines
backport/backport-include/linux/time.h +0 -0
 #include_next <linux/time.h>
 
 #include <linux/time64.h>
backport/backport-include/linux/time64.h +2 -1
index 49805da9dfce..62a7a1947f48 100644
@@ -6,7 +6,8 @@
 #include <linux/time.h>
 #endif
 
-#if LINUX_VERSION_IS_LESS(3,17,0)
+#if LINUX_VERSION_IS_LESS(3,17,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define timespec64_equal		timespec_equal
 #define timespec64_compare		timespec_compare
 #define set_normalized_timespec64	set_normalized_timespec
backport/backport-include/linux/timekeeping.h +10 -5
index 25ceaf3eec77..3f4a211721b2 100644
@@ -3,11 +3,13 @@
 #include <linux/version.h>
 #include <linux/types.h>
 
-#if LINUX_VERSION_IS_GEQ(3,17,0)
+#if LINUX_VERSION_IS_GEQ(3,17,0) || \
+	RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 #include_next <linux/timekeeping.h>
 #endif
 
-#if LINUX_VERSION_IS_LESS(3,17,0)
+#if LINUX_VERSION_IS_LESS(3,17,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define ktime_get_ns LINUX_BACKPORT(ktime_get_ns)
 extern ktime_t ktime_get(void);
 #define ktime_get_ns LINUX_BACKPORT(ktime_get_ns)
@@ -54,14 +56,16 @@ static inline time64_t ktime_get_real_seconds(void)
 }
 #endif
 
-#if LINUX_VERSION_IS_LESS(3,17,0)
+#if LINUX_VERSION_IS_LESS(3,17,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline void ktime_get_ts64(struct timespec64 *ts)
 {
 	ktime_get_ts(ts);
 }
 #endif
 
-#if LINUX_VERSION_IS_LESS(3,17,0)
+#if LINUX_VERSION_IS_LESS(3,17,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 /* This was introduced in 4.15, but we only need it in the
  * ktime_get_raw_ts64 backport() for < 3.17.
  */
@@ -83,7 +87,8 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
 #endif
 #endif /* < 3.17 */
 
-#if LINUX_VERSION_IS_LESS(4,18,0)
+#if LINUX_VERSION_IS_LESS(4,18,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define ktime_get_raw_ts64 LINUX_BACKPORT(ktime_get_raw_ts64)
 static inline void ktime_get_raw_ts64(struct timespec64 *ts)
 {
backport/backport-include/linux/u64_stats_sync.h +2 -1
index 251373a74139..33278d509863 100644
@@ -115,7 +115,8 @@ static inline bool u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
 #endif /* LINUX_VERSION_IS_GEQ(3,6,0) */
 
 #if LINUX_VERSION_IS_LESS(3,15,0) && \
-    !(LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30)
+    !(LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline unsigned int u64_stats_fetch_begin_irq(const struct u64_stats_sync *syncp)
 {
 #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
backport/backport-include/linux/uuid.h +2 -1
index bc6fbe17cb08..69f7d8c8b733 100644
@@ -11,7 +11,8 @@
 #define	UUID_STRING_LEN		36
 #endif
 
-#if LINUX_VERSION_IS_LESS(4,13,0)
+#if LINUX_VERSION_IS_LESS(4,13,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define guid_t uuid_le
 #define uuid_t uuid_be
 
backport/backport-include/linux/wait.h +2 -1
index 15a674cfe019..fc5b52c4d457 100644
@@ -2,7 +2,8 @@
 #define __BACKPORT_LINUX_WAIT_H
 #include_next <linux/wait.h>
 
-#if LINUX_VERSION_IS_LESS(3,17,0)
+#if LINUX_VERSION_IS_LESS(3,17,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 extern int bit_wait(void *);
 extern int bit_wait_io(void *);
 
backport/backport-include/net/genetlink.h +2 -1
index 747b6dac2df5..e6b78e02afe3 100644
@@ -27,7 +27,8 @@ static inline int genl_err_attr(struct genl_info *info, int err,
 /* this is for patches we apply */
 static inline struct netlink_ext_ack *genl_info_extack(struct genl_info *info)
 {
-#if LINUX_VERSION_IS_GEQ(4,12,0)
+#if LINUX_VERSION_IS_GEQ(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 	return info->extack;
 #else
 	return info->userhdr;
backport/backport-include/net/iw_handler.h +2 -1
index 84d63b30953e..f908446661c4 100644
@@ -2,7 +2,8 @@
 #define __BACKPORT_IW_HANDLER_H
 #include_next <net/iw_handler.h>
 
-#if LINUX_VERSION_IS_LESS(4,1,0)
+#if LINUX_VERSION_IS_LESS(4,1,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline char *
 iwe_stream_add_event_check(struct iw_request_info *info, char *stream,
 			   char *ends, struct iw_event *iwe, int event_len)
backport/backport-include/net/net_namespace.h +2 -1
index 1e84297c9476..e8438cbcd4df 100644
@@ -14,7 +14,8 @@ static inline struct net *get_net_ns_by_fd(int fd)
 }
 #endif
 
-#if LINUX_VERSION_IS_LESS(4,1,0)
+#if LINUX_VERSION_IS_LESS(4,1,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 typedef struct {
 #ifdef CONFIG_NET_NS
 	struct net *net;
backport/backport-include/net/netlink.h +4 -2
index b2045e44737a..bc24adfb4d63 100644
@@ -557,7 +557,8 @@ static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value)
 #define NLA_TYPE_MAX (__NLA_TYPE_MAX - 1)
 #endif
 
-#if LINUX_VERSION_IS_LESS(4,1,0)
+#if LINUX_VERSION_IS_LESS(4,1,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 #define nla_put_in_addr LINUX_BACKPORT(nla_put_in_addr)
 static inline int nla_put_in_addr(struct sk_buff *skb, int attrtype,
 				  __be32 addr)
@@ -706,7 +707,8 @@ static inline int nla_put_s64(struct sk_buff *skb, int attrtype, s64 value,
 }
 #endif /* < 4.7 */
 
-#if LINUX_VERSION_IS_LESS(4,10,0)
+#if LINUX_VERSION_IS_LESS(4,10,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 /**
  * nla_memdup - duplicate attribute memory (kmemdup)
  * @src: netlink attribute to duplicate from
backport/compat/backport-3.11.c +2 -0
index 7f9ff3419344..a3d4ea54e3eb 100644
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/scatterlist.h>
 
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static bool sg_miter_get_next_page(struct sg_mapping_iter *miter)
 {
 	if (!miter->__remaining) {
@@ -122,3 +123,4 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf,
 	return offset;
 }
 EXPORT_SYMBOL_GPL(sg_copy_buffer);
+#endif
backport/compat/backport-3.17.c +2 -0
index bf6027cbeb5e..adabec1b5367 100644
@@ -15,6 +15,7 @@
 #include <linux/jiffies.h>
 #include <linux/moduleparam.h>
 
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 int bit_wait(void *word)
 {
 	schedule();
@@ -28,6 +29,7 @@ int bit_wait_io(void *word)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(bit_wait_io);
+#endif
 
 /**
  * ktime_get_raw - Returns the raw monotonic time in ktime_t format
backport/compat/backport-3.19.c +2 -0
index 019644dfab42..ec44130e1dbd 100644
@@ -83,6 +83,7 @@ int woken_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key)
 EXPORT_SYMBOL(woken_wake_function);
 #endif
 
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static u8 netdev_rss_key[NETDEV_RSS_KEY_LEN];
 
 void netdev_rss_key_fill(void *buffer, size_t len)
@@ -96,6 +97,7 @@ void netdev_rss_key_fill(void *buffer, size_t len)
 #endif
 }
 EXPORT_SYMBOL_GPL(netdev_rss_key_fill);
+#endif
 
 #if defined(CONFIG_DEBUG_FS)
 struct debugfs_devm_entry {
backport/compat/backport-4.0.c +169 -0
index fbe0ddbc3bdd..d6e22d37a91e 100644
@@ -18,6 +18,185 @@
 #include <linux/ftrace_event.h>
 #include <asm/unaligned.h>
 
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
+ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
+						struct mm_struct *mm,
+						unsigned long start,
+						unsigned long nr_pages,
+						int write, int force,
+						struct page **pages,
+						struct vm_area_struct **vmas,
+						int *locked, bool notify_drop,
+						unsigned int flags)
+{
+	long ret, pages_done;
+	bool lock_dropped;
+
+	if (locked) {
+		/* if VM_FAULT_RETRY can be returned, vmas become invalid */
+		BUG_ON(vmas);
+		/* check caller initialized locked */
+		BUG_ON(*locked != 1);
+	}
+
+	if (pages)
+		flags |= FOLL_GET;
+	if (write)
+		flags |= FOLL_WRITE;
+	if (force)
+		flags |= FOLL_FORCE;
+
+	pages_done = 0;
+	lock_dropped = false;
+	for (;;) {
+		ret = __get_user_pages(tsk, mm, start, nr_pages, flags, pages,
+				       vmas, locked);
+		if (!locked)
+			/* VM_FAULT_RETRY couldn't trigger, bypass */
+			return ret;
+
+		/* VM_FAULT_RETRY cannot return errors */
+		if (!*locked) {
+			BUG_ON(ret < 0);
+			BUG_ON(ret >= nr_pages);
+		}
+
+		if (!pages)
+			/* If it's a prefault don't insist harder */
+			return ret;
+
+		if (ret > 0) {
+			nr_pages -= ret;
+			pages_done += ret;
+			if (!nr_pages)
+				break;
+		}
+		if (*locked) {
+			/* VM_FAULT_RETRY didn't trigger */
+			if (!pages_done)
+				pages_done = ret;
+			break;
+		}
+		/* VM_FAULT_RETRY triggered, so seek to the faulting offset */
+		pages += ret;
+		start += ret << PAGE_SHIFT;
+
+		/*
+		 * Repeat on the address that fired VM_FAULT_RETRY
+		 * without FAULT_FLAG_ALLOW_RETRY but with
+		 * FAULT_FLAG_TRIED.
+		 */
+		*locked = 1;
+		lock_dropped = true;
+		down_read(&mm->mmap_sem);
+		ret = __get_user_pages(tsk, mm, start, 1, flags | FOLL_TRIED,
+				       pages, NULL, NULL);
+		if (ret != 1) {
+			BUG_ON(ret > 1);
+			if (!pages_done)
+				pages_done = ret;
+			break;
+		}
+		nr_pages--;
+		pages_done++;
+		if (!nr_pages)
+			break;
+		pages++;
+		start += PAGE_SIZE;
+	}
+	if (notify_drop && lock_dropped && *locked) {
+		/*
+		 * We must let the caller know we temporarily dropped the lock
+		 * and so the critical section protected by it was lost.
+		 */
+		up_read(&mm->mmap_sem);
+		*locked = 0;
+	}
+	return pages_done;
+}
+
+/*
+ * We can leverage the VM_FAULT_RETRY functionality in the page fault
+ * paths better by using either get_user_pages_locked() or
+ * get_user_pages_unlocked().
+ *
+ * get_user_pages_locked() is suitable to replace the form:
+ *
+ *      down_read(&mm->mmap_sem);
+ *      do_something()
+ *      get_user_pages(tsk, mm, ..., pages, NULL);
+ *      up_read(&mm->mmap_sem);
+ *
+ *  to:
+ *
+ *      int locked = 1;
+ *      down_read(&mm->mmap_sem);
+ *      do_something()
+ *      get_user_pages_locked(tsk, mm, ..., pages, &locked);
+ *      if (locked)
+ *          up_read(&mm->mmap_sem);
+ */
+long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
+			   int write, int force, struct page **pages,
+			   int *locked)
+{
+	return __get_user_pages_locked(current, current->mm, start, nr_pages,
+				       write, force, pages, NULL, locked, true,
+				       FOLL_TOUCH);
+}
+EXPORT_SYMBOL_GPL(get_user_pages_locked);
+
+/*
+ * Same as get_user_pages_unlocked(...., FOLL_TOUCH) but it allows to
+ * pass additional gup_flags as last parameter (like FOLL_HWPOISON).
+ *
+ * NOTE: here FOLL_TOUCH is not set implicitly and must be set by the
+ * caller if required (just like with __get_user_pages). "FOLL_GET",
+ * "FOLL_WRITE" and "FOLL_FORCE" are set implicitly as needed
+ * according to the parameters "pages", "write", "force"
+ * respectively.
+ */
+static __always_inline long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
+					       unsigned long start, unsigned long nr_pages,
+					       int write, int force, struct page **pages,
+					       unsigned int gup_flags)
+{
+	long ret;
+	int locked = 1;
+	down_read(&mm->mmap_sem);
+	ret = __get_user_pages_locked(tsk, mm, start, nr_pages, write, force,
+				      pages, NULL, &locked, false, gup_flags);
+	if (locked)
+		up_read(&mm->mmap_sem);
+	return ret;
+}
+
+/*
+ * get_user_pages_unlocked() is suitable to replace the form:
+ *
+ *      down_read(&mm->mmap_sem);
+ *      get_user_pages(tsk, mm, ..., pages, NULL);
+ *      up_read(&mm->mmap_sem);
+ *
+ *  with:
+ *
+ *      get_user_pages_unlocked(tsk, mm, ..., pages);
+ *
+ * It is functionally equivalent to get_user_pages_fast so
+ * get_user_pages_fast should be used instead, if the two parameters
+ * "tsk" and "mm" are respectively equal to current and current->mm,
+ * or if "force" shall be set to 1 (get_user_pages_fast misses the
+ * "force" parameter).

backport/compat/backport-4.0.c line 199

Quoted 10 lines
backport/compat/backport-4.0.c +10 -0
+ */
+long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
+			     int write, int force, struct page **pages)
+{
+	return __get_user_pages_unlocked(current, current->mm, start, nr_pages,
+					 write, force, pages, FOLL_TOUCH);
+}
+EXPORT_SYMBOL_GPL(get_user_pages_unlocked);
+#endif
+

Please check if this is needed at all.

Quoted 18 lines
backport/compat/backport-4.0.c +2 -1
 /**
  * hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory
  * @buf: data blob to dump
@@ -146,7 +325,8 @@ overflow1:
 }
 EXPORT_SYMBOL_GPL(hex_dump_to_buffer);
 
-#if LINUX_VERSION_IS_LESS(3,17,0)
+#if LINUX_VERSION_IS_LESS(3,17,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static inline unsigned char *
 trace_seq_buffer_ptr(struct trace_seq *s)
 {
backport/compat/backport-4.2.c +0 -0
index b275d349f7eb..85c7d594f05f 100644

backport/compat/backport-4.2.c line 15

Quoted 6 lines
backport/compat/backport-4.2.c +2 -1
@@ -11,7 +11,8 @@
 #include <crypto/scatterwalk.h>
 #include <crypto/aead.h>
 
-static struct scatterlist *scatterwalk_ffwd(struct scatterlist dst[2],
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
+ static struct scatterlist *scatterwalk_ffwd(struct scatterlist dst[2],

Why did you add a space?

Quoted 111 lines
backport/compat/backport-4.2.c +1 -0
 					    struct scatterlist *src,
 					    unsigned int len)
 {
@@ -32,6 +33,7 @@ static struct scatterlist *scatterwalk_ffwd(struct scatterlist dst[2],
 
 	return dst;
 }
+#endif
 
 struct aead_old_request {
 	struct scatterlist srcbuf[2];
backport/compat/backport-4.4.c +2 -1
index 7966e94928e7..1782a03486fb 100644
@@ -21,7 +21,8 @@
 #include <asm/unaligned.h>
 
 #ifdef CONFIG_DEBUG_FS
-#if LINUX_VERSION_IS_LESS(4,3,0)
+#if LINUX_VERSION_IS_LESS(4,3,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static ssize_t debugfs_read_file_bool(struct file *file, char __user *user_buf,
 				      size_t count, loff_t *ppos)
 {
backport/compat/backport-genetlink.c +15 -6
index 4707858990e2..c7f350f6f33e 100644
@@ -17,6 +17,7 @@
 #include <net/netlink.h>
 #include <net/sock.h>
 
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 static const struct genl_family *find_family_real_ops(__genl_const struct genl_ops **ops)
 {
 	const struct genl_family *family;
@@ -33,7 +34,8 @@ static const struct genl_family *find_family_real_ops(__genl_const struct genl_o
 	return family;
 }
 
-#if LINUX_VERSION_IS_LESS(4,12,0)
+#if LINUX_VERSION_IS_LESS(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 enum nlmsgerr_attrs {
 	NLMSGERR_ATTR_UNUSED,
 	NLMSGERR_ATTR_MSG,
@@ -154,7 +156,8 @@ static int backport_pre_doit(__genl_const struct genl_ops *ops,
 {
 	const struct genl_family *family = find_family_real_ops(&ops);
 	int err;
-#if LINUX_VERSION_IS_LESS(4,12,0)
+#if LINUX_VERSION_IS_LESS(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 	struct netlink_ext_ack *extack = kzalloc(sizeof(*extack), GFP_KERNEL);
 
 	if (!extack)
@@ -179,7 +182,8 @@ static int backport_pre_doit(__genl_const struct genl_ops *ops,
 	if (!err && family->pre_doit)
 		err = family->pre_doit(ops, skb, info);
 
-#if LINUX_VERSION_IS_LESS(4,12,0)
+#if LINUX_VERSION_IS_LESS(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 	if (err) {
 		/* signal to do nothing */
 		extack->__bp_doit = NULL;
@@ -204,7 +208,8 @@ static void backport_post_doit(__genl_const struct genl_ops *ops,
 {
 	const struct genl_family *family = find_family_real_ops(&ops);
 
-#if LINUX_VERSION_IS_LESS(4,12,0)
+#if LINUX_VERSION_IS_LESS(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 	if (genl_info_extack(info)->__bp_doit)
 #else
 	if (1)
@@ -212,11 +217,13 @@ static void backport_post_doit(__genl_const struct genl_ops *ops,
 		if (family->post_doit)
 			family->post_doit(ops, skb, info);
 
-#if LINUX_VERSION_IS_LESS(4,12,0)
+#if LINUX_VERSION_IS_LESS(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 	kfree(__bp_genl_info_userhdr(info));
 #endif
 }
 
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 int backport_genl_register_family(struct genl_family *family)
 {
 	struct genl_ops *ops;
@@ -237,7 +244,8 @@ int backport_genl_register_family(struct genl_family *family)
 	 * memory layout isn't compatible with the old version
 	 */
 	for (i = 0; i < family->n_ops; i++) {
-#if LINUX_VERSION_IS_LESS(4,12,0)
+#if LINUX_VERSION_IS_LESS(4,12,0) && \
+	RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 		if (ops[i].doit)
 			ops[i].doit = extack_doit;
 #endif
@@ -311,6 +319,7 @@ int backport_genl_unregister_family(struct genl_family *family)
 	return __real_backport_genl_unregister_family(&family->family);
 }
 EXPORT_SYMBOL_GPL(backport_genl_unregister_family);
+#endif
 
 #define INVALID_GROUP	0xffffffff
 

backport/compat/backport-genetlink.c int backport_genlmsg_multicast_allns(const struct genl_family *family, · line 453

Quoted 4 lines
backport/compat/backport-genetlink.c +1 -0
@@ -441,3 +450,4 @@ int backport_genlmsg_multicast_allns(const struct genl_family *family,
 	return genlmsg_mcast(skb, portid, group, flags);
 }
 EXPORT_SYMBOL_GPL(backport_genlmsg_multicast_allns);
+#endif /* RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6) */

Please check again if all these ifdefs for redhat are needed in this function. It looks like there are some bigger ifdes around most of the code in here.

Quoted 86 lines
patches/0028-select_queue/mac80211.patch +6 -4
index f488589dd379..45cf0faa09f4 100644
@@ -1,6 +1,6 @@
 --- a/net/mac80211/iface.c
 +++ b/net/mac80211/iface.c
-@@ -1128,9 +1128,29 @@ static void ieee80211_uninit(struct net_
+@@ -1128,9 +1128,30 @@ static void ieee80211_uninit(struct net_
  	ieee80211_teardown_sdata(IEEE80211_DEV_TO_SUB_IF(dev));
  }
 
@@ -14,7 +14,8 @@
 +					 struct net_device *sb_dev,
 +					 select_queue_fallback_t fallback)
 +#elif LINUX_VERSION_IS_GEQ(3,14,0) || \
-+    (LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30)
++    (LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30) || \
++       RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 +static u16 ieee80211_netdev_select_queue(struct net_device *dev,
 +					 struct sk_buff *skb,
 +					 void *accel_priv,
@@ -30,7 +31,7 @@
  {
  	return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb);
  }
-@@ -1173,9 +1193,29 @@ static const struct net_device_ops ieee8
+@@ -1173,9 +1193,30 @@ static const struct net_device_ops ieee8
  	.ndo_get_stats64	= ieee80211_get_stats64,
  };
 
@@ -44,7 +45,8 @@
 +					  struct net_device *sb_dev,
 +					  select_queue_fallback_t fallback)
 +#elif LINUX_VERSION_IS_GEQ(3,14,0) || \
-+    (LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30)
++    (LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30) || \
++       RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 +static u16 ieee80211_monitor_select_queue(struct net_device *dev,
 +					  struct sk_buff *skb,
 +					  void *accel_priv,
patches/0073-netdevice-mtu-range.cocci +2 -2
index 7a4b65322803..7f902c7a09eb 100644
@@ -73,7 +73,7 @@ func(...) {
 constant r1.e1,r1.e2;
 identifier r.OPS;
 @@
-+#if LINUX_VERSION_IS_LESS(4,10,0)
++#if LINUX_VERSION_IS_LESS(4,10,0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 + static int __change_mtu(struct net_device *ndev, int new_mtu)
 + {
 + if (new_mtu < e1 || new_mtu > e2)
@@ -92,7 +92,7 @@ identifier OPS;
 @@
 
 struct net_device_ops OPS = {
-+#if LINUX_VERSION_IS_LESS(4,10,0)
++#if LINUX_VERSION_IS_LESS(4,10,0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 +      .ndo_change_mtu = __change_mtu,
 +#endif
...
patches/0075-ndo-stats-64.cocci +2 -2
index 8971a97c7209..f23059f3ba10 100644
@@ -5,7 +5,7 @@ fresh identifier stats64_fn_wrap = "bp_" ## stats64_fn;
 position p;
 @@
 struct net_device_ops OPS@p = {
-+#if LINUX_VERSION_IS_GEQ(4,11,0)
++#if LINUX_VERSION_IS_GEQ(4,11,0) || RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
 	.ndo_get_stats64 = stats64_fn,
 +#else
 +	.ndo_get_stats64 = stats64_fn_wrap,
@@ -17,7 +17,7 @@ identifier r.stats64_fn_wrap;
 identifier r.stats64_fn;
 @@
 void stats64_fn(...) {...}
-+#if LINUX_VERSION_IS_LESS(4,11,0)
++#if LINUX_VERSION_IS_LESS(4,11,0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
 +/* Just declare it here to keep sparse happy */
 +struct rtnl_link_stats64 *
 +stats64_fn_wrap(struct net_device *dev,
#3 lore raw

Re: [PATCH 01/15] backports: handle RHEL 7.6 kernel

Quoted 10 lines · Hauke Mehrtens
Quoted 9 lines · Johannes Berg

From: Luca Coelho <[email protected]>

RHEL 7.6 uses kernel v3.10 with a lot of backports from newer kernels. This causes compilation to break in many places when the backports project is used. To solve the issue, check for RHEL release code 7.6 where appropriate. This doesn't take into consideration lower versions of the kernel (i.e. < 7.6), because it's very difficult to find the information about when each feature was backported.

Quoted 2 lines
Quoted 2 lines

type=maint
ticket=none

Good catch :)

Did you reply below anything else? I didn't read past the long quote ...

johannes

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

#4 lore raw

Re: [PATCH 01/15] backports: handle RHEL 7.6 kernel

Quoted 11 lines · Johannes Berg
Quoted 10 lines · Hauke Mehrtens
Quoted 9 lines · Johannes Berg

From: Luca Coelho <[email protected]>

RHEL 7.6 uses kernel v3.10 with a lot of backports from newer kernels. This causes compilation to break in many places when the backports project is used. To solve the issue, check for RHEL release code 7.6 where appropriate. This doesn't take into consideration lower versions of the kernel (i.e. < 7.6), because it's very difficult to find the information about when each feature was backported.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

type=maint
ticket=none

Good catch :)

I saw this in multiple of these patches.

Quoted 1 line

Did you reply below anything else? I didn't read past the long quote ...

There are some other comments in this patch.

Hauke

#5 lore raw

Re: [PATCH 01/15] backports: handle RHEL 7.6 kernel

In reply to Hauke Mehrtens
Quoted 4 lines · Hauke Mehrtens
Quoted 4 lines

+++ b/backport/backport-include/linux/time.h

backport/backport-include/linux/time.h +0 -0
@@ -1,5 +1,11 @@
 #ifndef __BACKPORT_LINUX_TIME_H
 #define __BACKPORT_LINUX_TIME_H
Quoted 8 lines

backport/backport-include/linux/time.h line 8

Quoted 6 lines
backport/backport-include/linux/time.h +6 -0
+
+#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,6)
+#include_next <linux/time64.h>
+#include <uapi/linux/time.h>
+#endif
+

Something is strange with the time header file handling.

Too many changes in this area, I guess ;-)

(I'd appreciate if you trimmed your quoting a bit, it's hard to find your responses in the pages-long text)

Quoted 5 lines

backport/compat/backport-4.0.c line 199

Quoted 3 lines
backport/compat/backport-4.0.c +3 -0
+EXPORT_SYMBOL_GPL(get_user_pages_unlocked);
+#endif
+

Please check if this is needed at all.

I guess we can

Quoted 5 lines

backport/compat/backport-4.2.c line 15

Quoted 3 lines
backport/compat/backport-4.2.c +2 -1
-static struct scatterlist *scatterwalk_ffwd(struct scatterlist dst[2],
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6)
+ static struct scatterlist *scatterwalk_ffwd(struct scatterlist dst[2],

Why did you add a space?

Heh.

Quoted 9 lines

backport/compat/backport-genetlink.c int backport_genlmsg_multicast_allns(const struct genl_family *family, · line 453

Quoted 5 lines
backport/compat/backport-genetlink.c +1 -0
@@ -441,3 +450,4 @@ int backport_genlmsg_multicast_allns(const struct genl_family *family,
 	return genlmsg_mcast(skb, portid, group, flags);
 }
 EXPORT_SYMBOL_GPL(backport_genlmsg_multicast_allns);
+#endif /* RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,6) */

Please check again if all these ifdefs for redhat are needed in this function. It looks like there are some bigger ifdes around most of the code in here.

This stuff is very tricky, and they tend to backport pieces of it ...

johannes

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

#6 lore raw

PATCH 2/15 backports: update x509.asn1.[ch]

In reply to Johannes Berg

From: Luca Coelho <[email protected]>

In v5.2, x509_cert_parser.c implemented a new function, x509_note_params(). So we need the new generated asn1 files. Update these files from the ones generated with v5.2

type=maint
ticket=jira:WIFI-25529

---
 backport/compat/verification/x509.asn1.c | 105 ++++++++++++-----------
 backport/compat/verification/x509.asn1.h |   1 +
 2 files changed, 55 insertions(+), 51 deletions(-)
backport/compat/verification/x509.asn1.c +54 -51
index 316c10e3267f..e68864b6a1f5 100644
@@ -13,13 +13,14 @@ enum x509_actions {
 	ACT_x509_note_issuer = 3,
 	ACT_x509_note_not_after = 4,
 	ACT_x509_note_not_before = 5,
-	ACT_x509_note_pkey_algo = 6,
-	ACT_x509_note_serial = 7,
-	ACT_x509_note_signature = 8,
-	ACT_x509_note_subject = 9,
-	ACT_x509_note_tbs_certificate = 10,
-	ACT_x509_process_extension = 11,
-	NR__x509_actions = 12
+	ACT_x509_note_params = 6,
+	ACT_x509_note_pkey_algo = 7,
+	ACT_x509_note_serial = 8,
+	ACT_x509_note_signature = 9,
+	ACT_x509_note_subject = 10,
+	ACT_x509_note_tbs_certificate = 11,
+	ACT_x509_process_extension = 12,
+	NR__x509_actions = 13
 };
 
 static const asn1_action_t x509_action_table[NR__x509_actions] = {
@@ -29,12 +30,13 @@ static const asn1_action_t x509_action_table[NR__x509_actions] = {
 	[   3] = x509_note_issuer,
 	[   4] = x509_note_not_after,
 	[   5] = x509_note_not_before,
-	[   6] = x509_note_pkey_algo,
-	[   7] = x509_note_serial,
-	[   8] = x509_note_signature,
-	[   9] = x509_note_subject,
-	[  10] = x509_note_tbs_certificate,
-	[  11] = x509_process_extension,
+	[   6] = x509_note_params,
+	[   7] = x509_note_pkey_algo,
+	[   8] = x509_note_serial,
+	[   9] = x509_note_signature,
+	[  10] = x509_note_subject,
+	[  11] = x509_note_tbs_certificate,
+	[  12] = x509_process_extension,
 };
 
 static const unsigned char x509_machine[] = {
@@ -61,7 +63,7 @@ static const unsigned char x509_machine[] = {
 	// Name
 	[  16] =   ASN1_OP_MATCH_JUMP,
 	[  17] =   _tag(UNIV, CONS, SEQ),
-	[  18] =   _jump_target(80),		// --> Name
+	[  18] =   _jump_target(81),		// --> Name
 	[  19] =   ASN1_OP_ACT,
 	[  20] =   _action(ACT_x509_note_issuer),
 	// Validity
@@ -87,7 +89,7 @@ static const unsigned char x509_machine[] = {
 	// Name
 	[  38] =   ASN1_OP_MATCH_JUMP,
 	[  39] =   _tag(UNIV, CONS, SEQ),
-	[  40] =   _jump_target(80),		// --> Name
+	[  40] =   _jump_target(81),		// --> Name
 	[  41] =   ASN1_OP_ACT,
 	[  42] =   _action(ACT_x509_note_subject),
 	// SubjectPublicKeyInfo
@@ -109,7 +111,7 @@ static const unsigned char x509_machine[] = {
 	[  55] =   _tagn(CONT, PRIM,  2),
 	[  56] =   ASN1_OP_MATCH_JUMP_OR_SKIP,		// extensions
 	[  57] =   _tagn(CONT, CONS,  3),
-	[  58] =   _jump_target(95),
+	[  58] =   _jump_target(96),
 	[  59] =  ASN1_OP_END_SEQ,
 	[  60] =  ASN1_OP_ACT,
 	[  61] =  _action(ACT_x509_note_tbs_certificate),
@@ -132,47 +134,48 @@ static const unsigned char x509_machine[] = {
 	[  74] =  ASN1_OP_MATCH_ACT,		// algorithm
 	[  75] =  _tag(UNIV, PRIM, OID),
 	[  76] =  _action(ACT_x509_note_OID),
-	[  77] =  ASN1_OP_MATCH_ANY_OR_SKIP,		// parameters
-	[  78] = ASN1_OP_END_SEQ,
-	[  79] = ASN1_OP_RETURN,
+	[  77] =  ASN1_OP_MATCH_ANY_ACT_OR_SKIP,		// parameters
+	[  78] =  _action(ACT_x509_note_params),
+	[  79] = ASN1_OP_END_SEQ,
+	[  80] = ASN1_OP_RETURN,
 
 	// RelativeDistinguishedName
-	[  80] =  ASN1_OP_MATCH,
-	[  81] =  _tag(UNIV, CONS, SET),
+	[  81] =  ASN1_OP_MATCH,
+	[  82] =  _tag(UNIV, CONS, SET),
 	// AttributeValueAssertion
-	[  82] =   ASN1_OP_MATCH,
-	[  83] =   _tag(UNIV, CONS, SEQ),
-	[  84] =    ASN1_OP_MATCH_ACT,		// attributeType
-	[  85] =    _tag(UNIV, PRIM, OID),
-	[  86] =    _action(ACT_x509_note_OID),
-	[  87] =    ASN1_OP_MATCH_ANY_ACT,		// attributeValue
-	[  88] =    _action(ACT_x509_extract_name_segment),
-	[  89] =   ASN1_OP_END_SEQ,
-	[  90] =  ASN1_OP_END_SET_OF,
-	[  91] =  _jump_target(82),
-	[  92] = ASN1_OP_END_SEQ_OF,
-	[  93] = _jump_target(80),
-	[  94] = ASN1_OP_RETURN,
+	[  83] =   ASN1_OP_MATCH,
+	[  84] =   _tag(UNIV, CONS, SEQ),
+	[  85] =    ASN1_OP_MATCH_ACT,		// attributeType
+	[  86] =    _tag(UNIV, PRIM, OID),
+	[  87] =    _action(ACT_x509_note_OID),
+	[  88] =    ASN1_OP_MATCH_ANY_ACT,		// attributeValue
+	[  89] =    _action(ACT_x509_extract_name_segment),
+	[  90] =   ASN1_OP_END_SEQ,
+	[  91] =  ASN1_OP_END_SET_OF,
+	[  92] =  _jump_target(83),
+	[  93] = ASN1_OP_END_SEQ_OF,
+	[  94] = _jump_target(81),
+	[  95] = ASN1_OP_RETURN,
 
 	// Extensions
-	[  95] =  ASN1_OP_MATCH,
-	[  96] =  _tag(UNIV, CONS, SEQ),
+	[  96] =  ASN1_OP_MATCH,
+	[  97] =  _tag(UNIV, CONS, SEQ),
 	// Extension
-	[  97] =   ASN1_OP_MATCH,
-	[  98] =   _tag(UNIV, CONS, SEQ),
-	[  99] =    ASN1_OP_MATCH_ACT,		// extnid
-	[ 100] =    _tag(UNIV, PRIM, OID),
-	[ 101] =    _action(ACT_x509_note_OID),
-	[ 102] =    ASN1_OP_MATCH_OR_SKIP,		// critical
-	[ 103] =    _tag(UNIV, PRIM, BOOL),
-	[ 104] =    ASN1_OP_MATCH_ACT,		// extnValue
-	[ 105] =    _tag(UNIV, PRIM, OTS),
-	[ 106] =    _action(ACT_x509_process_extension),
-	[ 107] =   ASN1_OP_END_SEQ,
-	[ 108] =  ASN1_OP_END_SEQ_OF,
-	[ 109] =  _jump_target(97),
-	[ 110] = ASN1_OP_END_SEQ,
-	[ 111] = ASN1_OP_RETURN,
+	[  98] =   ASN1_OP_MATCH,
+	[  99] =   _tag(UNIV, CONS, SEQ),
+	[ 100] =    ASN1_OP_MATCH_ACT,		// extnid
+	[ 101] =    _tag(UNIV, PRIM, OID),
+	[ 102] =    _action(ACT_x509_note_OID),
+	[ 103] =    ASN1_OP_MATCH_OR_SKIP,		// critical
+	[ 104] =    _tag(UNIV, PRIM, BOOL),
+	[ 105] =    ASN1_OP_MATCH_ACT,		// extnValue
+	[ 106] =    _tag(UNIV, PRIM, OTS),
+	[ 107] =    _action(ACT_x509_process_extension),
+	[ 108] =   ASN1_OP_END_SEQ,
+	[ 109] =  ASN1_OP_END_SEQ_OF,
+	[ 110] =  _jump_target(98),
+	[ 111] = ASN1_OP_END_SEQ,
+	[ 112] = ASN1_OP_RETURN,
 };
 
 const struct asn1_decoder x509_decoder = {
backport/compat/verification/x509.asn1.h +1 -0
index 4f32a25d6660..77ec6085ae75 100644
@@ -13,6 +13,7 @@ extern int x509_note_OID(void *, size_t, unsigned char, const void *, size_t);
 extern int x509_note_issuer(void *, size_t, unsigned char, const void *, size_t);
 extern int x509_note_not_after(void *, size_t, unsigned char, const void *, size_t);
 extern int x509_note_not_before(void *, size_t, unsigned char, const void *, size_t);
+extern int x509_note_params(void *, size_t, unsigned char, const void *, size_t);
 extern int x509_note_pkey_algo(void *, size_t, unsigned char, const void *, size_t);
 extern int x509_note_serial(void *, size_t, unsigned char, const void *, size_t);
 extern int x509_note_signature(void *, size_t, unsigned char, const void *, size_t);
Signature · 4 lines
2.24.1

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

Re: [PATCH 02/15] backports: update x509.asn1.[ch]

Quoted 5 lines · Johannes Berg

From: Luca Coelho <[email protected]>

In v5.2, x509_cert_parser.c implemented a new function, x509_note_params(). So we need the new generated asn1 files. Update these files from the ones generated with v5.2

Should we generate these files automatically?
Sine this commit flex and bison are anyway needed for building:
https://git.kernel.org/pub/scm/linux/kernel/git/backports/backports.git/commit/?id=4ec72687181df4b786152747c008a688c9b9b9de

Why did you use kernel 5.2 and nothing more recent?

Quoted 180 lines

type=maint
ticket=jira:WIFI-25529

---
 backport/compat/verification/x509.asn1.c | 105 ++++++++++++-----------
 backport/compat/verification/x509.asn1.h |   1 +
 2 files changed, 55 insertions(+), 51 deletions(-)
backport/compat/verification/x509.asn1.c +54 -51
index 316c10e3267f..e68864b6a1f5 100644
@@ -13,13 +13,14 @@ enum x509_actions {
 	ACT_x509_note_issuer = 3,
 	ACT_x509_note_not_after = 4,
 	ACT_x509_note_not_before = 5,
-	ACT_x509_note_pkey_algo = 6,
-	ACT_x509_note_serial = 7,
-	ACT_x509_note_signature = 8,
-	ACT_x509_note_subject = 9,
-	ACT_x509_note_tbs_certificate = 10,
-	ACT_x509_process_extension = 11,
-	NR__x509_actions = 12
+	ACT_x509_note_params = 6,
+	ACT_x509_note_pkey_algo = 7,
+	ACT_x509_note_serial = 8,
+	ACT_x509_note_signature = 9,
+	ACT_x509_note_subject = 10,
+	ACT_x509_note_tbs_certificate = 11,
+	ACT_x509_process_extension = 12,
+	NR__x509_actions = 13
 };
 
 static const asn1_action_t x509_action_table[NR__x509_actions] = {
@@ -29,12 +30,13 @@ static const asn1_action_t x509_action_table[NR__x509_actions] = {
 	[   3] = x509_note_issuer,
 	[   4] = x509_note_not_after,
 	[   5] = x509_note_not_before,
-	[   6] = x509_note_pkey_algo,
-	[   7] = x509_note_serial,
-	[   8] = x509_note_signature,
-	[   9] = x509_note_subject,
-	[  10] = x509_note_tbs_certificate,
-	[  11] = x509_process_extension,
+	[   6] = x509_note_params,
+	[   7] = x509_note_pkey_algo,
+	[   8] = x509_note_serial,
+	[   9] = x509_note_signature,
+	[  10] = x509_note_subject,
+	[  11] = x509_note_tbs_certificate,
+	[  12] = x509_process_extension,
 };
 
 static const unsigned char x509_machine[] = {
@@ -61,7 +63,7 @@ static const unsigned char x509_machine[] = {
 	// Name
 	[  16] =   ASN1_OP_MATCH_JUMP,
 	[  17] =   _tag(UNIV, CONS, SEQ),
-	[  18] =   _jump_target(80),		// --> Name
+	[  18] =   _jump_target(81),		// --> Name
 	[  19] =   ASN1_OP_ACT,
 	[  20] =   _action(ACT_x509_note_issuer),
 	// Validity
@@ -87,7 +89,7 @@ static const unsigned char x509_machine[] = {
 	// Name
 	[  38] =   ASN1_OP_MATCH_JUMP,
 	[  39] =   _tag(UNIV, CONS, SEQ),
-	[  40] =   _jump_target(80),		// --> Name
+	[  40] =   _jump_target(81),		// --> Name
 	[  41] =   ASN1_OP_ACT,
 	[  42] =   _action(ACT_x509_note_subject),
 	// SubjectPublicKeyInfo
@@ -109,7 +111,7 @@ static const unsigned char x509_machine[] = {
 	[  55] =   _tagn(CONT, PRIM,  2),
 	[  56] =   ASN1_OP_MATCH_JUMP_OR_SKIP,		// extensions
 	[  57] =   _tagn(CONT, CONS,  3),
-	[  58] =   _jump_target(95),
+	[  58] =   _jump_target(96),
 	[  59] =  ASN1_OP_END_SEQ,
 	[  60] =  ASN1_OP_ACT,
 	[  61] =  _action(ACT_x509_note_tbs_certificate),
@@ -132,47 +134,48 @@ static const unsigned char x509_machine[] = {
 	[  74] =  ASN1_OP_MATCH_ACT,		// algorithm
 	[  75] =  _tag(UNIV, PRIM, OID),
 	[  76] =  _action(ACT_x509_note_OID),
-	[  77] =  ASN1_OP_MATCH_ANY_OR_SKIP,		// parameters
-	[  78] = ASN1_OP_END_SEQ,
-	[  79] = ASN1_OP_RETURN,
+	[  77] =  ASN1_OP_MATCH_ANY_ACT_OR_SKIP,		// parameters
+	[  78] =  _action(ACT_x509_note_params),
+	[  79] = ASN1_OP_END_SEQ,
+	[  80] = ASN1_OP_RETURN,
 
 	// RelativeDistinguishedName
-	[  80] =  ASN1_OP_MATCH,
-	[  81] =  _tag(UNIV, CONS, SET),
+	[  81] =  ASN1_OP_MATCH,
+	[  82] =  _tag(UNIV, CONS, SET),
 	// AttributeValueAssertion
-	[  82] =   ASN1_OP_MATCH,
-	[  83] =   _tag(UNIV, CONS, SEQ),
-	[  84] =    ASN1_OP_MATCH_ACT,		// attributeType
-	[  85] =    _tag(UNIV, PRIM, OID),
-	[  86] =    _action(ACT_x509_note_OID),
-	[  87] =    ASN1_OP_MATCH_ANY_ACT,		// attributeValue
-	[  88] =    _action(ACT_x509_extract_name_segment),
-	[  89] =   ASN1_OP_END_SEQ,
-	[  90] =  ASN1_OP_END_SET_OF,
-	[  91] =  _jump_target(82),
-	[  92] = ASN1_OP_END_SEQ_OF,
-	[  93] = _jump_target(80),
-	[  94] = ASN1_OP_RETURN,
+	[  83] =   ASN1_OP_MATCH,
+	[  84] =   _tag(UNIV, CONS, SEQ),
+	[  85] =    ASN1_OP_MATCH_ACT,		// attributeType
+	[  86] =    _tag(UNIV, PRIM, OID),
+	[  87] =    _action(ACT_x509_note_OID),
+	[  88] =    ASN1_OP_MATCH_ANY_ACT,		// attributeValue
+	[  89] =    _action(ACT_x509_extract_name_segment),
+	[  90] =   ASN1_OP_END_SEQ,
+	[  91] =  ASN1_OP_END_SET_OF,
+	[  92] =  _jump_target(83),
+	[  93] = ASN1_OP_END_SEQ_OF,
+	[  94] = _jump_target(81),
+	[  95] = ASN1_OP_RETURN,
 
 	// Extensions
-	[  95] =  ASN1_OP_MATCH,
-	[  96] =  _tag(UNIV, CONS, SEQ),
+	[  96] =  ASN1_OP_MATCH,
+	[  97] =  _tag(UNIV, CONS, SEQ),
 	// Extension
-	[  97] =   ASN1_OP_MATCH,
-	[  98] =   _tag(UNIV, CONS, SEQ),
-	[  99] =    ASN1_OP_MATCH_ACT,		// extnid
-	[ 100] =    _tag(UNIV, PRIM, OID),
-	[ 101] =    _action(ACT_x509_note_OID),
-	[ 102] =    ASN1_OP_MATCH_OR_SKIP,		// critical
-	[ 103] =    _tag(UNIV, PRIM, BOOL),
-	[ 104] =    ASN1_OP_MATCH_ACT,		// extnValue
-	[ 105] =    _tag(UNIV, PRIM, OTS),
-	[ 106] =    _action(ACT_x509_process_extension),
-	[ 107] =   ASN1_OP_END_SEQ,
-	[ 108] =  ASN1_OP_END_SEQ_OF,
-	[ 109] =  _jump_target(97),
-	[ 110] = ASN1_OP_END_SEQ,
-	[ 111] = ASN1_OP_RETURN,
+	[  98] =   ASN1_OP_MATCH,
+	[  99] =   _tag(UNIV, CONS, SEQ),
+	[ 100] =    ASN1_OP_MATCH_ACT,		// extnid
+	[ 101] =    _tag(UNIV, PRIM, OID),
+	[ 102] =    _action(ACT_x509_note_OID),
+	[ 103] =    ASN1_OP_MATCH_OR_SKIP,		// critical
+	[ 104] =    _tag(UNIV, PRIM, BOOL),
+	[ 105] =    ASN1_OP_MATCH_ACT,		// extnValue
+	[ 106] =    _tag(UNIV, PRIM, OTS),
+	[ 107] =    _action(ACT_x509_process_extension),
+	[ 108] =   ASN1_OP_END_SEQ,
+	[ 109] =  ASN1_OP_END_SEQ_OF,
+	[ 110] =  _jump_target(98),
+	[ 111] = ASN1_OP_END_SEQ,
+	[ 112] = ASN1_OP_RETURN,
 };
 
 const struct asn1_decoder x509_decoder = {
backport/compat/verification/x509.asn1.h +1 -0
index 4f32a25d6660..77ec6085ae75 100644
@@ -13,6 +13,7 @@ extern int x509_note_OID(void *, size_t, unsigned char, const void *, size_t);
 extern int x509_note_issuer(void *, size_t, unsigned char, const void *, size_t);
 extern int x509_note_not_after(void *, size_t, unsigned char, const void *, size_t);
 extern int x509_note_not_before(void *, size_t, unsigned char, const void *, size_t);
+extern int x509_note_params(void *, size_t, unsigned char, const void *, size_t);
 extern int x509_note_pkey_algo(void *, size_t, unsigned char, const void *, size_t);
 extern int x509_note_serial(void *, size_t, unsigned char, const void *, size_t);
 extern int x509_note_signature(void *, size_t, unsigned char, const void *, size_t);
#8 lore raw

Re: [PATCH 02/15] backports: update x509.asn1.[ch]

Quoted 2 lines

Should we generate these files automatically?

I think it needs this asn1parser infrastructure from the kernel

Quoted 2 lines

Sine this commit flex and bison are anyway needed for building:
https://git.kernel.org/pub/scm/linux/kernel/git/backports/backports.git/commit/?id=4ec72687181df4b786152747c008a688c9b9b9de

Not "just" flex/bison (which, btw, is giving me a lot of trouble on Fedora 31 because 'yacc' is not bison...

Quoted 1 line

Why did you use kernel 5.2 and nothing more recent?

Old patch from Luca lingering in our tree.

johannes

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

#9 lore raw

PATCH 3/15 backports: suppress attribute((cold)) warnings with gcc 9

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

Since my last system upgrade I started building with gcc 9, and that complains that a function is cold when the one we create locally here isn't - mark it as cold always, I don't think it would complain the other way around.

---
 backport/backport-include/linux/module.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
backport/backport-include/linux/module.h +2 -2
index 1a2c82f45b75..675d8d770954 100644
@@ -33,7 +33,7 @@ extern void backport_dependency_symbol(void);
 		backport_dependency_symbol();				\
 		return initfn();					\
 	}								\
-	int init_module(void) __attribute__((alias("__init_backport")));\
+	int init_module(void) __attribute__((cold,alias("__init_backport")));\
 	BACKPORT_MOD_VERSIONS
 
 /*
@@ -58,7 +58,7 @@ extern void backport_dependency_symbol(void);
 		exitfn();						\
 		rcu_barrier();						\
 	}								\
-	void cleanup_module(void) __attribute__((alias("__exit_compat")));
+	void cleanup_module(void) __attribute__((cold,alias("__exit_compat")));
 #endif
 
 #if LINUX_VERSION_IS_LESS(3,3,0)
Signature · 4 lines
2.24.1

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

PATCH 4/15 backports: add some more atomic functions

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

Some of the new fetch atomics are now required, add them by using the _return ones and changing the value accordingly.

---
 backport/backport-include/linux/atomic.h | 32 ++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
backport/backport-include/linux/atomic.h +32 -0
index 9ceb586e864a..6669831ca8a9 100644
@@ -60,4 +60,36 @@ static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
 #endif
 #endif
 
+#ifndef __atomic_pre_full_fence
+#define __atomic_pre_full_fence         smp_mb__before_atomic
+#endif
+
+#ifndef __atomic_post_full_fence
+#define __atomic_post_full_fence        smp_mb__after_atomic
+#endif
+
+#if LINUX_VERSION_IS_LESS(4,8,0)
+static inline int
+atomic_fetch_add(int i, atomic_t *v)
+{
+	return atomic_add_return(i, v) - i;
+}
+
+static inline int
+atomic_fetch_sub(int i, atomic_t *v)
+{
+	return atomic_sub_return(i, v) + i;
+}
+#endif
+
+#ifndef atomic_fetch_add_relaxed
+#define atomic_fetch_add_relaxed atomic_fetch_add
+#endif
+
+#ifndef atomic_fetch_sub_relaxed
+#define atomic_fetch_sub_acquire atomic_fetch_sub
+#define atomic_fetch_sub_release atomic_fetch_sub
+#define atomic_fetch_sub_relaxed atomic_fetch_sub
+#endif
+
 #endif /* __BP_ATOMIC_H */
Signature · 4 lines
2.24.1

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

PATCH 5/15 backports: Do not access rx_count and rx_list attributes

In reply to Johannes Berg

From: Hauke Mehrtens <[email protected]>

The rx_count and rx_list attributes were only added in kernel 5.4 in commit 323ebb61e32b ("net: use listified RX for handling GRO_NORMAL skbs")

---
 patches/0092-listified-rx/iwlwifi.patch | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 patches/0092-listified-rx/iwlwifi.patch
patches/0092-listified-rx/iwlwifi.patch new file +19 -0
new file mode 100644
index 000000000000..925010fd5a5c
@@ -0,0 +1,19 @@
+The rx_count and rx_list attributes were only added in kernel 5.4 in
+commit 323ebb61e32b ("net: use listified RX for handling GRO_NORMAL skbs")
+
+--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
++++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+@@ -1531,11 +1531,13 @@ out:
+ 	if (napi->poll) {
+ 		napi_gro_flush(napi, false);
+ 
++#if LINUX_VERSION_IS_GEQ(5,4,0)
+ 		if (napi->rx_count) {
+ 			netif_receive_skb_list(&napi->rx_list);
+ 			INIT_LIST_HEAD(&napi->rx_list);
+ 			napi->rx_count = 0;
+ 		}
++#endif
+ 	}
+ 
+ 	iwl_pcie_rxq_restock(trans, rxq);
Signature · 4 lines
2.24.1

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

PATCH 6/15 backports: if_vlan: add VLAN_N_VID

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

---
 backport/backport-include/linux/if_vlan.h | 4 ++++
 1 file changed, 4 insertions(+)
backport/backport-include/linux/if_vlan.h +4 -0
index 18f63e80d214..571a8b7e0521 100644
@@ -36,4 +36,8 @@
 #define skb_vlan_tag_get_id(__skb)	((__skb)->vlan_tci & VLAN_VID_MASK)
 #endif
 
+#ifndef VLAN_N_VID
+#define VLAN_N_VID 4096
+#endif
+
 #endif /* __BACKPORT_LINUX_IF_VLAN_H_ */
Signature · 4 lines
2.24.1

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

PATCH 7/15 patches: make nl80211.c include if_vlan.h

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

On upstream it gets it through some include maze, until that's fixed, just patch it in.

---
 patches/0093-nl80211-vlan.patch | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 patches/0093-nl80211-vlan.patch
patches/0093-nl80211-vlan.patch new file +12 -0
new file mode 100644
index 000000000000..c1f8dac13125
@@ -0,0 +1,12 @@
+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
+index ae8e3d9575d3..15c0e3c5c979 100644
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -20,6 +20,7 @@
+ #include <linux/netlink.h>
+ #include <linux/nospec.h>
+ #include <linux/etherdevice.h>
++#include <linux/if_vlan.h>
+ #include <net/net_namespace.h>
+ #include <net/genetlink.h>
+ #include <net/cfg80211.h>
Signature · 4 lines
2.24.1

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

Re: [PATCH 07/15] patches: make nl80211.c include if_vlan.h

Quoted 4 lines · Johannes Berg

From: Johannes Berg <[email protected]>

On upstream it gets it through some include maze, until that's fixed, just patch it in.

Will you take care to improve this upstream for the next kernel version?

Quoted 26 lines
---
 patches/0093-nl80211-vlan.patch | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 patches/0093-nl80211-vlan.patch
patches/0093-nl80211-vlan.patch new file +12 -0
new file mode 100644
index 000000000000..c1f8dac13125
@@ -0,0 +1,12 @@
+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
+index ae8e3d9575d3..15c0e3c5c979 100644
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -20,6 +20,7 @@
+ #include <linux/netlink.h>
+ #include <linux/nospec.h>
+ #include <linux/etherdevice.h>
++#include <linux/if_vlan.h>
+ #include <net/net_namespace.h>
+ #include <net/genetlink.h>
+ #include <net/cfg80211.h>
#15 lore raw

PATCH 8/15 gentree: add timing info to git debug commit message

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

This is useful to see where we spend most time.

---
 gentree.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
gentree.py +6 -1
index 3273eedec928..8fdf34c60f7e 100755
@@ -4,7 +4,7 @@
 #
 
 import argparse, sys, os, errno, shutil, re, subprocess
-import tarfile, gzip
+import tarfile, gzip, time
 
 # find self
 source_dir = os.path.abspath(os.path.dirname(__file__))
@@ -305,12 +305,17 @@ def git_debug_init(args):
     git.commit_all("Copied backport", tree=args.bpid.project_dir)
 
 
+prevtime = None
 def git_debug_snapshot(args, name):
     """
     Take a git snapshot for the debugging.
     """
     if not args.gitdebug:
         return
+    global prevtime
+    if prevtime is not None:
+        name += "\n\n(took %.2f seconds)\n" % (time.time() - prevtime)
+    prevtime = time.time()
     git.commit_all(name, tree=args.bpid.project_dir)
 
 def get_rel_spec_stable(rel):
Signature · 4 lines
2.24.1

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

PATCH 9/15 backports: debugfs: add unsigned long helpers

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

debugfs_create_ulong and debugfs_create_xul.

---
 backport/backport-include/linux/debugfs.h | 26 +++++++++++++++++++++++
 1 file changed, 26 insertions(+)
backport/backport-include/linux/debugfs.h +26 -0
index fb50c4f5750e..973c545cf0e0 100644
@@ -60,4 +60,30 @@ debugfs_real_fops(const struct file *filp)
 	debugfs_create_file(name, mode, parent, data, fops)
 #endif
 
+#if LINUX_VERSION_IS_LESS(4,4,0)
+static inline struct dentry *
+debugfs_create_ulong(const char *name, umode_t mode,
+		     struct dentry *parent, unsigned long *value)
+{
+	if (sizeof(unsigned long) == sizeof(u64))
+		return debugfs_create_u64(name, mode, parent, (u64 *)value);
+	if (sizeof(unsigned long) == sizeof(u32))
+		return debugfs_create_u32(name, mode, parent, (u32 *)value);
+	WARN_ON(1);
+	return ERR_PTR(-EINVAL);
+}
+#endif
+
+#if LINUX_VERSION_IS_LESS(5,5,0)
+static inline void debugfs_create_xul(const char *name, umode_t mode,
+				      struct dentry *parent,
+				      unsigned long *value)
+{
+	if (sizeof(*value) == sizeof(u32))
+		debugfs_create_x32(name, mode, parent, (u32 *)value);
+	else
+		debugfs_create_x64(name, mode, parent, (u64 *)value);
+}
+#endif
+
 #endif /* __BACKPORT_DEBUGFS_H_ */
Signature · 4 lines
2.24.1

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

PATCH 10/15 backports: patch lib/refcount.c to make sparse happy

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

We're testing sparse, so don't want warnings here.

---
 patches/lib-refcount.patch | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
patches/lib-refcount.patch +18 -0
index cca07cfb7df2..0f63ec6aa6d9 100644
@@ -10,3 +10,21 @@ index 5d0582a..8d108f9 100644
  
  /**
   * refcount_add_not_zero_checked - add a value to a refcount unless it is 0
+@@ -153,6 +153,8 @@ bool refcount_dec_and_lock(refcount_t *r, spinlock_t *lock)
+ 		return false;
+ 	}
+ 
++	__release(lock);
++
+ 	return true;
+ }
+ EXPORT_SYMBOL(refcount_dec_and_lock);
+@@ -182,6 +184,8 @@ bool refcount_dec_and_lock_irqsave(refcount_t *r, spinlock_t *lock,
+ 		return false;
+ 	}
+ 
++	__release(lock);
++
+ 	return true;
+ }
+ EXPORT_SYMBOL(refcount_dec_and_lock_irqsave);
Signature · 4 lines
2.24.1

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

PATCH 11/15 gentree: add a --list-files option

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

This can be used to understand what will go into a backport, but currently excludes some uninteresting files.

---
 gentree.py | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)
gentree.py +28 -8
index 8fdf34c60f7e..bf2965f2a8c6 100755
@@ -649,6 +649,8 @@ def _main():
                              'and we use git ls-tree to get the files.')
     parser.add_argument('--clean', const=True, default=False, action="store_const",
                         help='Clean output directory instead of erroring if it isn\'t empty')
+    parser.add_argument('--list-files', const=True, default=False, action="store_const",
+                        help='Only list files to copy')
     parser.add_argument('--integrate', const=True, default=False, action="store_const",
                         help='Integrate a future backported kernel solution into ' +
                              'an older kernel tree source directory.')
@@ -715,7 +717,7 @@ def _main():
         sys.stdout.write('\n')
         sys.stdout.flush()
 
-    return process(args.kerneldir, args.copy_list,
+    retv = process(args.kerneldir, args.copy_list,
                    git_revision=args.git_revision,
                    bpid=bpid,
                    clean=args.clean,
@@ -726,7 +728,12 @@ def _main():
                    kup_test=args.kup_test,
                    test_cocci=args.test_cocci,
                    profile_cocci=args.profile_cocci,
-                   logwrite=logwrite)
+                   logwrite=logwrite,
+                   list_files=args.list_files)
+    if args.list_files:
+        print('\n'.join(retv))
+    else:
+        return retv
 
 def process(kerneldir, copy_list_file, git_revision=None,
             bpid=None,
@@ -736,14 +743,15 @@ def process(kerneldir, copy_list_file, git_revision=None,
             test_cocci=None,
             profile_cocci=None,
             logwrite=lambda x:None,
-            git_tracked_version=False):
+            git_tracked_version=False,
+            list_files=False):
     class Args(object):
         def __init__(self, kerneldir, copy_list_file,
                      git_revision, bpid, clean, refresh, base_name,
                      gitdebug, verbose, extra_driver, kup,
                      kup_test,
                      test_cocci,
-                     profile_cocci):
+                     profile_cocci, list_files):
             self.kerneldir = kerneldir
             self.copy_list = copy_list_file
             self.git_revision = git_revision
@@ -760,6 +768,7 @@ def process(kerneldir, copy_list_file, git_revision=None,
             self.profile_cocci = profile_cocci
             if self.test_cocci or self.profile_cocci:
                 self.gitdebug = True
+            self.list_files = list_files
     def git_paranoia(tree=None, logwrite=lambda x:None):
         data = git.paranoia(tree)
         if (data['r'] != 0):
@@ -772,7 +781,7 @@ def process(kerneldir, copy_list_file, git_revision=None,
     args = Args(kerneldir, copy_list_file,
                 git_revision, bpid, clean, refresh, base_name,
                 gitdebug, verbose, extra_driver, kup, kup_test,
-                test_cocci, profile_cocci)
+                test_cocci, profile_cocci, list_files)
     rel_prep = None
 
     if bpid.integrate:
@@ -810,9 +819,6 @@ def process(kerneldir, copy_list_file, git_revision=None,
     copy_list = read_copy_list(args.copy_list)
     deplist = read_dependencies(os.path.join(source_dir, 'dependencies'))
 
-    # validate output directory
-    check_output_dir(bpid.target_dir, args.clean)
-
     # do the copy
     backport_integrate_files = [
             ('Makefile.kernel', 'Makefile'),
@@ -842,6 +848,20 @@ def process(kerneldir, copy_list_file, git_revision=None,
     else:
         backport_files += backport_integrate_files
 
+    if args.list_files:
+        ret = []
+        for f in copy_list:
+            # FIXME: make these exclusions configurable
+            if f[0] in ['COPYING', 'MAINTAINERS']:
+                continue
+            if f[0].startswith('scripts/'):
+                continue
+            ret.append(f[0])
+        return ret
+
+    # validate output directory
+    check_output_dir(bpid.target_dir, args.clean)
+
     if not args.git_revision:
         logwrite('Copy original source files ...')
     else:
Signature · 4 lines
2.24.1

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

PATCH 12/15 git-tracker: use python2 explicitly

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

---
 devel/git-tracker.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
devel/git-tracker.py +1 -1
index ef5eba51e2c2..1cb26ec82eb0 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 """
  backports git tracker
 =======================
Signature · 4 lines
2.24.1

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

PATCH 13/15 git-tracker: use write-tree/commit-tree/update-ref

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

This gives us more flexibility, so we can create pretend merge commits later.

---
 devel/git-tracker.py |  4 +++-
 lib/bpgit.py         | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)
devel/git-tracker.py +3 -1
index 1cb26ec82eb0..7e55fa5ccb8e 100755
@@ -104,6 +104,7 @@ def handle_commit(args, msg, branch, treename, kernelobjdir, tmpdir, wgitdir, ba
         else:
             git.reset(opts=['-q'], tree=wdir)
 
+        parents = [git.rev_parse('HEAD', tree=wdir)]
         if not failure or commit_failure:
             if append_shortlog:
                 files = []
@@ -136,7 +137,8 @@ def handle_commit(args, msg, branch, treename, kernelobjdir, tmpdir, wgitdir, ba
                 if not have_changeid:
                     msg += 'Change-Id: I%s\n' % hashlib.sha1(msg).hexdigest()
 
-            git.commit(msg, tree=wdir, env=env, opts=['-q', '--allow-empty'])
+            treeid = git.write_tree(tree=wdir)
+            git.commit_tree(treeid, msg, parents, tree=wdir, env=env)
             git.push(opts=['-f', '-q', 'origin', branch], tree=wdir)
         os.rename(os.path.join(wdir, '.git'), wgitdir)
     finally:
lib/bpgit.py +34 -0
index ff5f4a0c95b3..60d4abaa7a0d 100644
@@ -255,6 +255,40 @@ def add(fn, tree=None):
     process.wait()
     _check(process)
 
+def write_tree(tree=None):
+    process = subprocess.Popen(['git', 'write-tree'], stdout=subprocess.PIPE,
+                               close_fds=True, universal_newlines=True, cwd=tree)
+    stdout = process.communicate()[0]
+    process.wait()
+    _check(process)
+    sha = stdout.strip()
+    if not _sha_re.match(sha):
+        raise SHAError()
+    return sha
+
+def commit_tree(treeid, msg, parents, env=None, tree=None):
+    if env is None:
+        env = {}
+    opts = []
+    for p in parents:
+        opts.extend(['-p', p])
+    stdin = tempfile.NamedTemporaryFile(mode='wr')
+    stdin.write(msg)
+    stdin.seek(0)
+    process = subprocess.Popen(['git', 'commit-tree', '-F-', treeid] + opts,
+                               stdin=stdin.file, universal_newlines=True,
+                               stdout=subprocess.PIPE, env=env, cwd=tree)
+    stdout = process.communicate()[0]
+    process.wait()
+    _check(process)
+    sha = stdout.strip()
+    if not _sha_re.match(sha):
+        raise SHAError()
+    process = subprocess.Popen(['git', 'update-ref', 'HEAD', sha], cwd=tree)
+    process.wait()
+    _check(process)
+    return sha
+
 def commit(msg, tree=None, env = {}, opts=[]):
     stdin = tempfile.NamedTemporaryFile(mode='wr')
     stdin.write(msg)
Signature · 4 lines
2.24.1

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

PATCH 14/15 git-tracker: refactor function that adds change-id

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

---
 devel/git-tracker.py | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
devel/git-tracker.py +11 -7
index 7e55fa5ccb8e..14e2f14b9a63 100755
@@ -54,6 +54,16 @@ def update_cache_objects(gittree, objdir, input):
         git.set_origin(gittree, objdir)
         git.remote_update(objdir, env=env)
 
+def add_changeid_to_message(msg):
+    have_changeid = False
+    for line in msg.split('\n'):
+        if line.lower().startswith('change-id: I'):
+            have_changeid = True
+            break
+    if not have_changeid:
+        msg += 'Change-Id: I%s\n' % hashlib.sha1(msg).hexdigest()
+    return msg
+
 def handle_commit(args, msg, branch, treename, kernelobjdir, tmpdir, wgitdir, backport_rev, kernel_rev,
                   prev_kernel_rev=None, defconfig=None, env={}, commit_failure=True,
                   append_shortlog=None, add_changeid=False):
@@ -129,13 +139,7 @@ def handle_commit(args, msg, branch, treename, kernelobjdir, tmpdir, wgitdir, ba
           }
 
             if add_changeid:
-                have_changeid = False
-                for line in msg.split('\n'):
-                    if line.lower().startswith('change-id: I'):
-                        have_changeid = True
-                        break
-                if not have_changeid:
-                    msg += 'Change-Id: I%s\n' % hashlib.sha1(msg).hexdigest()
+                msg = add_changeid_to_message(msg)
 
             treeid = git.write_tree(tree=wdir)
             git.commit_tree(treeid, msg, parents, tree=wdir, env=env)
Signature · 4 lines
2.24.1

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

PATCH 15/15 gentree: use 'git cat-file' to speed up obtaining objects

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

We can use the git cat-file --batch protocol to get objects, which significantly speeds things up since we don't have to start a new git process every time.

---
 gentree.py   | 23 ++++++++++++-----------
 lib/bpgit.py | 25 +++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 11 deletions(-)
gentree.py +12 -11
index bf2965f2a8c6..2a9f60d7384b 100755
@@ -213,17 +213,18 @@ def copy_git_files(srcpath, copy_list, rev, outdir):
     "Copy" files from a git repository. This really means listing them with
     ls-tree and then using git show to obtain all the blobs.
     """
-    for srcitem, tgtitem in copy_list:
-        for m, t, h, f in git.ls_tree(rev=rev, files=(srcitem,), tree=srcpath):
-            assert t == 'blob'
-            f = os.path.join(outdir, f.replace(srcitem, tgtitem))
-            d = os.path.dirname(f)
-            if not os.path.exists(d):
-                os.makedirs(d)
-            outf = open(f, 'w')
-            git.get_blob(h, outf, tree=srcpath)
-            outf.close()
-            os.chmod(f, int(m, 8))
+    with git.CatFile(tree=srcpath) as cf:
+        for srcitem, tgtitem in copy_list:
+            for m, t, h, f in git.ls_tree(rev=rev, files=(srcitem,), tree=srcpath):
+                assert t == 'blob'
+                f = os.path.join(outdir, f.replace(srcitem, tgtitem))
+                d = os.path.dirname(f)
+                if not os.path.exists(d):
+                    os.makedirs(d)
+                outf = open(f, 'w')
+                cf.get_blob(h, outf)
+                outf.close()
+                os.chmod(f, int(m, 8))
 
 def automatic_backport_mangle_c_file(name):
     return name.replace('/', '-')
lib/bpgit.py +25 -0
index 60d4abaa7a0d..7b57f6b2690a 100644
@@ -357,3 +357,28 @@ def diff(tree=None, extra_args=None):
     _check(process)
 
     return stdout
+
+class CatFile(object):
+    def __init__(self, tree=None):
+        self.tree = tree
+        self.p = None
+
+    def __enter__(self):
+        self.p = subprocess.Popen(['git', 'cat-file', '--batch'], cwd=self.tree,
+                                  stdout=subprocess.PIPE, stdin=subprocess.PIPE)
+        return self
+
+    def get_blob(self, sha, outf):
+        self.p.stdin.write(sha + '\n')
+        hdr = self.p.stdout.readline().split()
+        assert len(hdr) == 3
+        assert hdr[1] == 'blob'
+        size = int(hdr[2])
+        outf.write(self.p.stdout.read(size))
+        assert self.p.stdout.readline() == '\n'
+
+    def __exit__(self, type, value, traceback):
+        self.p.stdin.close()
+        self.p.wait()
+        _check(self.p)
+        self.p = None
Signature · 4 lines
2.24.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#23 lore raw
In reply to Johannes Berg
Quoted 8 lines · Johannes Berg

This is what we have now to make our driver (only) work on 5.5, and because I got tired of waiting for the devel/git-tracker.py I threw in a speed improvement for the gentree --git option, using git's cat-file --batch API. We should use that for much more, and perhaps implicitly in the git library, but getting the files was one of the slower things, now it's barely noticable.

johannes

I left out the RedHat patch and applied the rest. I removed the type and ticket tag from some coimmit messages.

Hauke

#24 lore raw
Quoted 8 lines · Hauke Mehrtens
Quoted 7 lines · Johannes Berg

This is what we have now to make our driver (only) work on 5.5, and because I got tired of waiting for the devel/git-tracker.py I threw in a speed improvement for the gentree --git option, using git's cat-file --batch API. We should use that for much more, and perhaps implicitly in the git library, but getting the files was one of the slower things, now it's barely noticable.

Quoted 4 lines
Quoted 1 line

johannes

I left out the RedHat patch and applied the rest. I removed the type and ticket tag from some coimmit messages.

Thanks!

johannes

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