Skip to contentSkip to conversation

backports: sync up to next-20140415

PATCH In review Luis R. Rodriguez 1 participant 10 messages Apr 17, 2014 Library code

lore
Share & tools
lore
#0 lore raw

cover backports: sync up to next-20140415

This catches us up to next-20140415. Two new SmPL rules are added, and the bpcoccinelle library was generalzied as a standard tool to allow other uses. You can now use pycocci for your own development on git trees and it will do what you expect with sensible defaults.

Luis R. Rodriguez (8):
backports: revert unification of cocci files
backports: transform group attribute backport to SmPL form
backports: use --use-coccigrep for Coccinelle
backports: Use Coccinelle --relax-include-path
backports: add a 120 second timeout rule to Coccinelle
backports: pycocci - make the Coccinelle wrapper a standalone tool
backports: formalize struct sock sk_data_ready() backport with SmPL
backports: refresh patches for next-20140415

 devel/pycocci                                      | 180 +++++++++++++++++++++
 gentree.py                                         |  73 ++++-----
 lib/bpcoccinelle.py                                |  92 -----------
 .../0001-group-attr/0001-group_attr_class.cocci    |  78 +++++++++
 .../0001-group-attr/0002-group_attr_bus.cocci      |  77 +++++++++
 .../generic/0001-group-attr/INFO                   |  40 +++++
 .../generic/0001-sysfs-api/INFO                    |  36 -----
 .../generic/0001-sysfs-api/drivers_bcma.patch      |  35 ----
 .../drivers_media_v4l2-core_v4l2-dev.patch         |  35 ----
 .../generic/0001-sysfs-api/drivers_ssb.patch       |  35 ----
 .../0001-sysfs-api/net_ieee802154_wpan-class.patch |  35 ----
 .../0001-sysfs-api/net_wireless_sysfs.patch        |  35 ----
 .../network/0031-sk_data_ready.cocci               | 117 ++++++++++++++
 .../0001-igb_net_device_ops.patch                  |   6 +-
 .../0002-igb_pci_sriov_configure.patch             |   8 +-
 .../0001-ethernet-igb/0008-igb_no_fcs.patch        |   2 +-
 .../0001-ethernet-igb/0009-igb_vlan_rx_vid.patch   |   6 +-
 .../0012-igb_ndo_set_vf_spoofchk.patch             |   6 +-
 18 files changed, 540 insertions(+), 356 deletions(-)
 create mode 100755 devel/pycocci
 delete mode 100644 lib/bpcoccinelle.py
 create mode 100644 patches/collateral-evolutions/generic/0001-group-attr/0001-group_attr_class.cocci
 create mode 100644 patches/collateral-evolutions/generic/0001-group-attr/0002-group_attr_bus.cocci
 create mode 100644 patches/collateral-evolutions/generic/0001-group-attr/INFO
 delete mode 100644 patches/collateral-evolutions/generic/0001-sysfs-api/INFO
 delete mode 100644 patches/collateral-evolutions/generic/0001-sysfs-api/drivers_bcma.patch
 delete mode 100644 patches/collateral-evolutions/generic/0001-sysfs-api/drivers_media_v4l2-core_v4l2-dev.patch
 delete mode 100644 patches/collateral-evolutions/generic/0001-sysfs-api/drivers_ssb.patch
 delete mode 100644 patches/collateral-evolutions/generic/0001-sysfs-api/net_ieee802154_wpan-class.patch
 delete mode 100644 patches/collateral-evolutions/generic/0001-sysfs-api/net_wireless_sysfs.patch
 create mode 100644 patches/collateral-evolutions/network/0031-sk_data_ready.cocci
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/8 backports: revert unification of cocci files

This optimization was introduced by Johannes to help with performance before we had parallelism. With parallelism we get better results by splitting rules up. Also some feedback from Julia on this:

===
I don't think this is a good idea. You would have to be careful about naming. And You may lose on some performance benefits of the prefiltering. Suppose you have an easy semantic patch that references function A and a hard semantic patch that references function B. The hard semantic patch specifically contains one rule that is very complicated but that does not use B. That very complicated rule will now be applied to the 5000 files that use A as well as to the 3 files that use B. So you get a big performance slowdown.
===

The performance before this change:

mcgrof@drvbp1 ~/backports (git::master)$ time ./gentree.py --clean --refresh \
/home/mcgrof/linux-next /home/mcgrof/build/next-20140409 Copy original source files ...
Apply patches ...
Modify Kconfig tree ...
Rewrite Makefiles and Kconfig files ...
Done!

real    1m30.186s
user    9m25.180s
sys     0m24.428s

After:

mcgrof@drvbp1 ~/backports (git::master)$ time ./gentree.py --clean /home/mcgrof/linux-next /home/mcgrof/build/next-20140411 Copy original source files ...
Apply patches ...
Modify Kconfig tree ...
Rewrite Makefiles and Kconfig files ...
Done!

real    1m3.071s
user    3m39.388s
sys     0m21.812s

commit 3c71184d3a2843c9a1d5a289c71bfbbc126d71fd

Author: Johannes Berg <[email protected]>
Date:   Wed Jan 1 20:37:13 2014 +0100

gentree: combine spatches (unless using --gitdebug)

Since spatch is rather slow, but can handle multiple spatches concatenated in a single file, just do that and run it only once rather than for each spatch. That shaves off some of the runtime (startup etc. and finding affected files.)

On my system, I go from

real 9m42.616s
user 8m48.352s
sys 0m22.884s

to

real 9m1.948s
user 8m40.108s
sys 0m12.088s

Cc Peter Senna <[email protected]>
Cc Julia Lawall <[email protected]>
Cc Gilles Muller <[email protected]>
---
 gentree.py | 64 +++++++++++++++++++++++++-------------------------------------
 1 file changed, 26 insertions(+), 38 deletions(-)
gentree.py +26 -38
index a90a425..7789e52 100755
@@ -709,45 +709,33 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None,
         git_debug_snapshot(args, "apply backport patch %s" % print_name)
 
     sempatches.sort()
-    with tempdir() as t:
-        if not args.gitdebug:
-            # combine all spatches
-            fn = os.path.join(t, 'combined.cocci')
-            f = open(fn, 'w')
-            for cocci_file in sempatches:
-                for l in open(cocci_file, 'r'):
-                    f.write(l)
-                f.write('\n')
-            f.close()
-            sempatches = [fn]
-            prefix_len = 0
-        else:
-            prefix_len = len(os.path.join(source_dir, 'patches')) + 1
-        for cocci_file in sempatches:
-            extra_spatch_args = []
-            if args.profile_cocci:
-                extra_spatch_args.append('--profile')
-            print_name = cocci_file[prefix_len:]
-            if args.verbose:
-                logwrite("Applying SmPL patch %s" % print_name)
-
-            output = coccinelle.threaded_spatch(cocci_file, args.outdir,
-                                                logwrite, print_name,
-                                                test_cocci,
-                                                extra_args=extra_spatch_args)
-            output = output.split('\n')
-            if output[-1] == '':
-                output = output[:-1]
-            if args.verbose:
-                for line in output:
-                    logwrite('> %s' % line)
+    prefix_len = len(os.path.join(source_dir, 'patches')) + 1
+
+    for cocci_file in sempatches:
+        extra_spatch_args = []
+        if args.profile_cocci:
+            extra_spatch_args.append('--profile')
+        print_name = cocci_file[prefix_len:]
+        if args.verbose:
+            logwrite("Applying SmPL patch %s" % print_name)
+
+        output = coccinelle.threaded_spatch(cocci_file, args.outdir,
+                                            logwrite, print_name,
+                                            test_cocci,
+                                            extra_args=extra_spatch_args)
+        output = output.split('\n')
+        if output[-1] == '':
+            output = output[:-1]
+        if args.verbose:
+            for line in output:
+                logwrite('> %s' % line)
 
-            # remove cocci_backup files
-            for root, dirs, files in os.walk(args.outdir):
-                for f in files:
-                    if f.endswith('.cocci_backup'):
-                        os.unlink(os.path.join(root, f))
-            git_debug_snapshot(args, "apply backport SmPL patch %s" % print_name)
+        # remove cocci_backup files
+        for root, dirs, files in os.walk(args.outdir):
+            for f in files:
+                if f.endswith('.cocci_backup'):
+                    os.unlink(os.path.join(root, f))
+        git_debug_snapshot(args, "apply backport SmPL patch %s" % print_name)
 
     if test_cocci:
         logwrite('Done!')
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/8 backports: transform group attribute backport to SmPL form

In reply to Luis R. Rodriguez

The struct attribute_group collateral evolution by Greg and Oliver was introduced as of v3.11:

mcgrof@ergon ~/linux (git::master)$ git describe --contains f2f37f58b v3.11-rc2~18^2~9
mcgrof@ergon ~/linux (git::master)$ git describe --contains 3493f69f4 v3.11-rc2~18^2~2

We backport them with our own respective set of helpers. Each new data structure that gets an attribute group needs a respective SmPL set of rules for the transformation, specially if they were introduced in different kernel versions, which in this case we have two which were. By using SmPL we can automatically backport the collateral evolutions moving forward for *any* driver that makes use of these group attributes on both data structure we are addressing in these SmPL patches. This is a great example of the level of atomicity that we want to ideally strive to reach for backporting, as it lets us automatically backport a collateral evolution through grammer for *any* device driver we backport, and lets us be lazier.

We provided backports of introduction of the group attribute onto two data structures:

* struct class: added via commit d05a6f96c
* struct bus_type: added via commit fa6fdb33b

mcgrof@ergon ~/linux (git::master)$ git describe --contains d05a6f96c v3.11-rc2~18^2~3

mcgrof@ergon ~/linux (git::master)$ git describe --contains fa6fdb33b v3.12-rc1~184^2~89

This patch generalizes the backport the introduction of the group attribute to each data structure into separate SmPL patch files. One change the SmPL patches pick up on was #ifdef'ing over the init_foogroup_attrs() calls which would only have been introduced when ATTRIBUTE_GROUPS_BACKPORT() was used, which *is* #idefd's.

The changes that added the new APIs are below, the respective commits for each data structure change are documented on each SmPL patch.

commit f2f37f58b1b933b06d6d84e80a31a1b500fb0db2

Author: Greg Kroah-Hartman <[email protected]>
Date:   Sun Jul 14 16:05:52 2013 -0700

sysfs.h: add ATTRIBUTE_GROUPS() macro

To make it easier for driver subsystems to work with attribute groups, create the ATTRIBUTE_GROUPS macro to remove some of the repetitive typing for the most common use for attribute groups.

commit 3493f69f4c4e8703961919a9a56c2d2e6a25b46f

Author: Oliver Schinagl <[email protected]>
Date:   Sun Jul 14 16:05:59 2013 -0700

sysfs: add more helper macro's for (bin_)attribute(_groups)

With the recent changes to sysfs there's various helper macro's. However there's no RW, RO BIN_ helper macro's. This patch adds them.

mcgrof@drvbp1 ~/backports (git::master)$ time \
	./gentree.py --clean /home/mcgrof/linux-next /home/mcgrof/build/next-20140411

Copy original source files ...
Apply patches ...
Modify Kconfig tree ...
Rewrite Makefiles and Kconfig files ...
Done!

real    1m14.635s
user    5m17.308s
sys     0m39.216s

== ckmake-report.log ==

1   3.0.101             [  OK  ]
2   3.1.10              [  OK  ]
3   3.2.54              [  OK  ]
4   3.3.8               [  OK  ]
5   3.4.79              [  OK  ]
6   3.5.7               [  OK  ]
7   3.6.11              [  OK  ]
8   3.7.10              [  OK  ]
9   3.8.13              [  OK  ]
10  3.9.11              [  OK  ]
11  3.10.29             [  OK  ]
12  3.11.10             [  OK  ]
13  3.12.10             [  OK  ]
14  3.13.2              [  OK  ]
15  3.14-rc1            [  OK  ]
real    28m18.533s
user    785m28.844s
sys     86m25.548s
Cc Peter Senna <[email protected]>
Cc Julia Lawall <[email protected]>
Cc Gilles Muller <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Oliver Schinagl <[email protected]>
---
 .../0001-group-attr/0001-group_attr_class.cocci    | 78 ++++++++++++++++++++++
 .../0001-group-attr/0002-group_attr_bus.cocci      | 77 +++++++++++++++++++++
 .../generic/0001-group-attr/INFO                   | 40 +++++++++++
 .../generic/0001-sysfs-api/INFO                    | 36 ----------
 .../generic/0001-sysfs-api/drivers_bcma.patch      | 35 ----------
 .../drivers_media_v4l2-core_v4l2-dev.patch         | 35 ----------
 .../generic/0001-sysfs-api/drivers_ssb.patch       | 35 ----------
 .../0001-sysfs-api/net_ieee802154_wpan-class.patch | 35 ----------
 .../0001-sysfs-api/net_wireless_sysfs.patch        | 35 ----------
 9 files changed, 195 insertions(+), 211 deletions(-)
 create mode 100644 patches/collateral-evolutions/generic/0001-group-attr/0001-group_attr_class.cocci
 create mode 100644 patches/collateral-evolutions/generic/0001-group-attr/0002-group_attr_bus.cocci
 create mode 100644 patches/collateral-evolutions/generic/0001-group-attr/INFO
 delete mode 100644 patches/collateral-evolutions/generic/0001-sysfs-api/INFO
 delete mode 100644 patches/collateral-evolutions/generic/0001-sysfs-api/drivers_bcma.patch
 delete mode 100644 patches/collateral-evolutions/generic/0001-sysfs-api/drivers_media_v4l2-core_v4l2-dev.patch
 delete mode 100644 patches/collateral-evolutions/generic/0001-sysfs-api/drivers_ssb.patch
 delete mode 100644 patches/collateral-evolutions/generic/0001-sysfs-api/net_ieee802154_wpan-class.patch
 delete mode 100644 patches/collateral-evolutions/generic/0001-sysfs-api/net_wireless_sysfs.patch
patches/collateral-evolutions/generic/0001-group-attr/0001-group_attr_class.cocci new file +78 -0
new file mode 100644
index 0000000..fa700f8
@@ -0,0 +1,78 @@
+/*
+The new attribute sysfs group was added onto struct class via
+commit d05a6f96c
+
+mcgrof@ergon ~/linux (git::master)$ git describe --contains d05a6f96c
+v3.11-rc2~18^2~3
+
+This backpoort makes use of the helpers to backport this more efficiently.
+Refer to the INFO file for documentation there on that.
+
+commit d05a6f96c76062b5f25858ac02cf677602076f7e
+Author: Greg Kroah-Hartman <[email protected]>
+Date:   Sun Jul 14 16:05:58 2013 -0700
+
+    driver core: add default groups to struct class
+
+    We should be using groups, not attribute lists, for classes to allow
+    subdirectories, and soon, binary files.  Groups are just more flexible
+    overall, so add them.
+
+    The dev_attrs list will go away after all in-kernel users are converted
+    to use dev_groups.
+
+    Reviewed-by: Guenter Roeck <[email protected]>
+    Tested-by: Guenter Roeck <[email protected]>
+    Signed-off-by: Greg Kroah-Hartman <[email protected]>
+*/
+
+@ attribute_group @
+identifier group;
+declarer name ATTRIBUTE_GROUPS;
+@@
+
+ATTRIBUTE_GROUPS(group);
+
+@ class_group depends on attribute_group @
+identifier group_class;
+expression groups;
+fresh identifier group_dev_attr = attribute_group.group ## "_dev_attrs";
+@@
+
+struct class group_class = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+	.dev_groups = groups,
++#else
++	.dev_attrs = group_dev_attr,
++#endif
+};
+
+@ attribute_group_mod depends on attribute_group && class_group @
+declarer name ATTRIBUTE_GROUPS_BACKPORT;
+identifier group;
+@@
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+ATTRIBUTE_GROUPS(group);
++#else
++#define BP_ATTR_GRP_STRUCT device_attribute
++ATTRIBUTE_GROUPS_BACKPORT(group);
++#endif
+
+@ class_registering depends on class_group && attribute_group_mod @
+identifier class_register, ret;
+identifier class_group.group_class;
+fresh identifier group_class_init = "init_" ## attribute_group_mod.group ## "_attrs";
+@@
+
+(
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
++	group_class_init();
++#endif
+	return class_register(&group_class);
+|
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
++	group_class_init();
++#endif
+	ret = class_register(&group_class);
+)
patches/collateral-evolutions/generic/0001-group-attr/0002-group_attr_bus.cocci new file +77 -0

77 lines not on this page · raw message

patches/collateral-evolutions/generic/0001-group-attr/INFO new file +40 -0
new file mode 100644
index 0000000..87590d5
@@ -0,0 +1,40 @@
+The new attribute sysfs group was added via these commits:
+
+mcgrof@ergon ~/linux (git::master)$ git describe --contains f2f37f58b
+v3.11-rc2~18^2~9
+mcgrof@ergon ~/linux (git::master)$ git describe --contains 3493f69f4
+v3.11-rc2~18^2~2
+
+We backport them with our own respective set of helpers. Each new data
+structure that gets an attribute group needs a respective SmPL set of
+rules for the transformation. We might be able to share the rules for
+lookup / indexing between rules some how. These lookup reveal would
+be used for inherent structural searches, pivots, if you will.
+
+The changes that added the new APIs:
+
+commit f2f37f58b1b933b06d6d84e80a31a1b500fb0db2
+Author: Greg Kroah-Hartman <[email protected]>
+Date:   Sun Jul 14 16:05:52 2013 -0700
+
+    sysfs.h: add ATTRIBUTE_GROUPS() macro
+
+    To make it easier for driver subsystems to work with attribute groups,
+    create the ATTRIBUTE_GROUPS macro to remove some of the repetitive
+    typing for the most common use for attribute groups.
+
+    Reviewed-by: Guenter Roeck <[email protected]>
+    Tested-by: Guenter Roeck <[email protected]>
+    Signed-off-by: Greg Kroah-Hartman <[email protected]>
+
+commit 3493f69f4c4e8703961919a9a56c2d2e6a25b46f
+Author: Oliver Schinagl <[email protected]>
+Date:   Sun Jul 14 16:05:59 2013 -0700
+
+    sysfs: add more helper macro's for (bin_)attribute(_groups)
+
+    With the recent changes to sysfs there's various helper macro's.
+    However there's no RW, RO BIN_ helper macro's. This patch adds them.
+
+    Signed-off-by: Oliver Schinagl <[email protected]>
+    Signed-off-by: Greg Kroah-Hartman <[email protected]>
patches/collateral-evolutions/generic/0001-sysfs-api/INFO deleted +0 -36
deleted file mode 100644
index 8539db8..0000000
@@ -1,36 +0,0 @@
-The new attribute sysfs group was added via these commits:
-
-mcgrof@ergon ~/linux (git::master)$ git describe --contains f2f37f58b
-v3.11-rc2~18^2~9
-mcgrof@ergon ~/linux (git::master)$ git describe --contains 3493f69f4
-v3.11-rc2~18^2~2
-
-We backport them with our own respective set of helpers but right now
-this is using old legacy patches, it should be possible to convert all
-this juju legacy backport to SmPL form.
-
-commit f2f37f58b1b933b06d6d84e80a31a1b500fb0db2
-Author: Greg Kroah-Hartman <[email protected]>
-Date:   Sun Jul 14 16:05:52 2013 -0700
-
-    sysfs.h: add ATTRIBUTE_GROUPS() macro
-    
-    To make it easier for driver subsystems to work with attribute groups,
-    create the ATTRIBUTE_GROUPS macro to remove some of the repetitive
-    typing for the most common use for attribute groups.
-    
-    Reviewed-by: Guenter Roeck <[email protected]>
-    Tested-by: Guenter Roeck <[email protected]>
-    Signed-off-by: Greg Kroah-Hartman <[email protected]>
-
-commit 3493f69f4c4e8703961919a9a56c2d2e6a25b46f
-Author: Oliver Schinagl <[email protected]>
-Date:   Sun Jul 14 16:05:59 2013 -0700
-
-    sysfs: add more helper macro's for (bin_)attribute(_groups)
-    
-    With the recent changes to sysfs there's various helper macro's.
-    However there's no RW, RO BIN_ helper macro's. This patch adds them.
-    
-    Signed-off-by: Oliver Schinagl <[email protected]>
-    Signed-off-by: Greg Kroah-Hartman <[email protected]>
patches/collateral-evolutions/generic/0001-sysfs-api/drivers_bcma.patch deleted +0 -35
deleted file mode 100644
index cc3da6f..0000000
@@ -1,35 +0,0 @@
---- a/drivers/bcma/main.c
-+++ b/drivers/bcma/main.c
-@@ -60,7 +60,12 @@ static struct attribute *bcma_device_att
- 	&dev_attr_class.attr,
- 	NULL,
- };
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
- ATTRIBUTE_GROUPS(bcma_device);
-+#else
-+#define BP_ATTR_GRP_STRUCT device_attribute
-+ATTRIBUTE_GROUPS_BACKPORT(bcma_device);
-+#endif
- 
- static struct bus_type bcma_bus_type = {
- 	.name		= "bcma",
-@@ -68,7 +73,11 @@ static struct bus_type bcma_bus_type = {
- 	.probe		= bcma_device_probe,
- 	.remove		= bcma_device_remove,
- 	.uevent		= bcma_device_uevent,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
- 	.dev_groups	= bcma_device_groups,
-+#else
-+	.dev_attrs	= bcma_device_dev_attrs,
-+#endif
- };
- 
- static u16 bcma_cc_core_id(struct bcma_bus *bus)
-@@ -482,6 +491,7 @@ static int __init bcma_modinit(void)
- {
- 	int err;
- 
-+	init_bcma_device_attrs();
- 	err = bus_register(&bcma_bus_type);
- 	if (err)
- 		return err;
patches/collateral-evolutions/generic/0001-sysfs-api/drivers_media_v4l2-core_v4l2-dev.patch deleted +0 -35
deleted file mode 100644
index 258144f..0000000
@@ -1,35 +0,0 @@
---- a/drivers/media/v4l2-core/v4l2-dev.c
-+++ b/drivers/media/v4l2-core/v4l2-dev.c
-@@ -86,7 +86,12 @@ static struct attribute *video_device_at
- 	&dev_attr_index.attr,
- 	NULL,
- };
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
- ATTRIBUTE_GROUPS(video_device);
-+#else
-+#define BP_ATTR_GRP_STRUCT device_attribute
-+ATTRIBUTE_GROUPS_BACKPORT(video_device);
-+#endif
- 
- /*
-  *	Active devices
-@@ -221,7 +226,11 @@ static void v4l2_device_release(struct d
- 
- static struct class video_class = {
- 	.name = VIDEO_NAME,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
- 	.dev_groups = video_device_groups,
-+#else
-+	.dev_attrs = video_device_dev_attrs,
-+#endif
- };
- 
- struct video_device *video_devdata(struct file *file)
-@@ -1014,6 +1023,7 @@ static int __init videodev_init(void)
- 		return ret;
- 	}
- 
-+	init_video_device_attrs();
- 	ret = class_register(&video_class);
- 	if (ret < 0) {
- 		unregister_chrdev_region(dev, VIDEO_NUM_DEVICES);
patches/collateral-evolutions/generic/0001-sysfs-api/drivers_ssb.patch deleted +0 -35
deleted file mode 100644
index 5fa2e98..0000000
@@ -1,35 +0,0 @@
---- a/drivers/ssb/main.c
-+++ b/drivers/ssb/main.c
-@@ -399,7 +399,12 @@ static struct attribute *ssb_device_attr
- 	&dev_attr_irq.attr,
- 	NULL,
- };
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
- ATTRIBUTE_GROUPS(ssb_device);
-+#else
-+#define BP_ATTR_GRP_STRUCT device_attribute
-+ATTRIBUTE_GROUPS_BACKPORT(ssb_device);
-+#endif
- 
- static struct bus_type ssb_bustype = {
- 	.name		= "ssb",
-@@ -410,7 +415,11 @@ static struct bus_type ssb_bustype = {
- 	.suspend	= ssb_device_suspend,
- 	.resume		= ssb_device_resume,
- 	.uevent		= ssb_device_uevent,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
- 	.dev_groups	= ssb_device_groups,
-+#else
-+	.dev_attrs	= ssb_device_dev_attrs,
-+#endif
- };
- 
- static void ssb_buses_lock(void)
-@@ -1459,6 +1468,7 @@ static int __init ssb_modinit(void)
- {
- 	int err;
- 
-+	init_ssb_device_attrs();
- 	/* See the comment at the ssb_is_early_boot definition */
- 	ssb_is_early_boot = 0;
- 	err = bus_register(&ssb_bustype);
patches/collateral-evolutions/generic/0001-sysfs-api/net_ieee802154_wpan-class.patch deleted +0 -35
deleted file mode 100644
index a6338c6..0000000
@@ -1,35 +0,0 @@
---- a/net/ieee802154/wpan-class.c
-+++ b/net/ieee802154/wpan-class.c
-@@ -75,7 +75,12 @@ static struct attribute *pmib_attrs[] =
- 	&dev_attr_cca_mode.attr,
- 	NULL,
- };
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
- ATTRIBUTE_GROUPS(pmib);
-+#else
-+#define BP_ATTR_GRP_STRUCT device_attribute
-+ATTRIBUTE_GROUPS_BACKPORT(pmib);
-+#endif
- 
- static void wpan_phy_release(struct device *d)
- {
-@@ -86,7 +91,11 @@ static void wpan_phy_release(struct devi
- static struct class wpan_phy_class = {
- 	.name = "ieee802154",
- 	.dev_release = wpan_phy_release,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
- 	.dev_groups = pmib_groups,
-+#else
-+	.dev_attrs = pmib_dev_attrs,
-+#endif
- };
- 
- static DEFINE_MUTEX(wpan_phy_mutex);
-@@ -197,6 +206,7 @@ EXPORT_SYMBOL(wpan_phy_free);
- static int __init wpan_phy_class_init(void)
- {
- 	int rc;
-+	init_pmib_attrs();
- 	rc = class_register(&wpan_phy_class);
- 	if (rc)
- 		goto err;
patches/collateral-evolutions/generic/0001-sysfs-api/net_wireless_sysfs.patch deleted +0 -35
deleted file mode 100644
index 9c532c2..0000000
@@ -1,35 +0,0 @@
---- a/net/wireless/sysfs.c
-+++ b/net/wireless/sysfs.c
-@@ -71,7 +71,12 @@ static struct attribute *ieee80211_attrs
- 	&dev_attr_name.attr,
- 	NULL,
- };
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
- ATTRIBUTE_GROUPS(ieee80211);
-+#else
-+#define BP_ATTR_GRP_STRUCT device_attribute
-+ATTRIBUTE_GROUPS_BACKPORT(ieee80211);
-+#endif
- 
- static void wiphy_dev_release(struct device *dev)
- {
-@@ -149,7 +154,11 @@ struct class ieee80211_class = {
- 	.name = "ieee80211",
- 	.owner = THIS_MODULE,
- 	.dev_release = wiphy_dev_release,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
- 	.dev_groups = ieee80211_groups,
-+#else
-+	.dev_attrs = ieee80211_dev_attrs,
-+#endif
- 	.dev_uevent = wiphy_uevent,
- #ifdef CONFIG_PM
- 	.suspend = wiphy_suspend,
-@@ -161,6 +170,7 @@ struct class ieee80211_class = {
- 
- int wiphy_sysfs_init(void)
- {
-+	init_ieee80211_attrs();
- 	return class_register(&ieee80211_class);
- }
- 
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/8 backports: use --use-coccigrep for Coccinelle

In reply to Luis R. Rodriguez

This uses --use-coccigrep on our Cocccinelle library and removes the CPU adjustments depending on whether we are testing or not. The flag --use-coccigrep will tell Coccinelle to only kick off a worker on a file until it has determined that a rule being evaluated applies to a file. This does however mean that all files on its bucket list will be evaluated first, but this yields better CPU usage without having us to ramp up on the number of threads depending on the situation. Without this patch we were kicking off more threads to account for the fact that a Coccinelle thread will stop working on a file if it had little or nothing to do on a file.

Possible work improvement: see how we can do away with tmp files for Coccinelle output and just use memory to for the ouput, or perhaps even disregard the stdout and only care for it if --debug-cocci is provided.

mcgrof@drvbp1 ~/backports (git::master)$ time ./gentree.py --clean /home/mcgrof/linux-next /home/mcgrof/build/next-20140411 Copy original source files ...
Apply patches ...
Modify Kconfig tree ...
Rewrite Makefiles and Kconfig files ...
Done!

real    1m14.880s
user    10m47.824s
sys     0m36.796s
Cc Peter Senna <[email protected]>
Cc Julia Lawall <[email protected]>
Cc Gilles Muller <[email protected]>
---
 gentree.py          | 1 -
 lib/bpcoccinelle.py | 9 +++------
 2 files changed, 3 insertions(+), 7 deletions(-)
gentree.py +0 -1
index 7789e52..b890d28 100755
@@ -721,7 +721,6 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None,
 
         output = coccinelle.threaded_spatch(cocci_file, args.outdir,
                                             logwrite, print_name,
-                                            test_cocci,
                                             extra_args=extra_spatch_args)
         output = output.split('\n')
         if output[-1] == '':
lib/bpcoccinelle.py +3 -6
index a71f425..bd276c7 100644
@@ -33,6 +33,7 @@ def spatch(cocci_file, outdir,
            max_threads, thread_id, temp_dir, ret_q, extra_args=[]):
     cmd = ['spatch', '--sp-file', cocci_file, '--in-place',
             '--recursive-includes',
+            '--use-coccigrep',
             '--backup-suffix', '.cocci_backup', '--dir', '.']
 
     if (max_threads > 1):
@@ -53,12 +54,8 @@ def spatch(cocci_file, outdir,
     outfile.close()
     ret_q.put((sprocess.returncode, fn))
 
-def threaded_spatch(cocci_file, outdir, logwrite, print_name,
-                    test_cocci, extra_args=[]):
-    num_cpus = cpu_count()
-    threads = num_cpus * 3
-    if test_cocci:
-        threads = num_cpus * 10
+def threaded_spatch(cocci_file, outdir, logwrite, print_name, extra_args=[]):
+    threads = cpu_count()
     jobs = list()
     output = ''
     ret_q = Queue()
Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/8 backports: Use Coccinelle --relax-include-path

In reply to Luis R. Rodriguez

This will provide wider coverage on include paths for our Coccinelle rule interpretation, at a very lower cost incurred, about 1 second, for code generation. Coccinelle makes an effort to infer types but with a wider coverage of header files it can do a better job at that. You want to use both --recursive-includes (which we already enable) and --relax-include-path to get the most possible type information.

You will want at least Coccinelle 1.0.0-rc20 which had an increase of performance of over 30% when using both --recursive-includes and --relax-include path.

mcgrof@drvbp1 ~/backports (git::master)$ time ./gentree.py --clean /home/mcgrof/linux-next /home/mcgrof/build/next-20140411 Copy original source files ...
Apply patches ...
Modify Kconfig tree ...
Rewrite Makefiles and Kconfig files ...
Done!

real    1m15.370s
user    10m47.232s
sys     0m36.980s
Cc Peter Senna <[email protected]>
Cc Julia Lawall <[email protected]>
Cc Gilles Muller <[email protected]>
---
 lib/bpcoccinelle.py | 1 +
 1 file changed, 1 insertion(+)
lib/bpcoccinelle.py +1 -0
index bd276c7..75a0b37 100644
@@ -33,6 +33,7 @@ def spatch(cocci_file, outdir,
            max_threads, thread_id, temp_dir, ret_q, extra_args=[]):
     cmd = ['spatch', '--sp-file', cocci_file, '--in-place',
             '--recursive-includes',
+            '--relax-include-path',
             '--use-coccigrep',
             '--backup-suffix', '.cocci_backup', '--dir', '.']
 
Signature · 1 line
1.9.1
#5 lore raw

PATCH 5/8 backports: add a 120 second timeout rule to Coccinelle

In reply to Luis R. Rodriguez

Our current overall run time is less than 120 seconds so lets add a trigger to fail if we have a rule taking longer. Adding this has no extra incurred overhead cost.

mcgrof@drvbp1 ~/backports (git::master)$ time ./gentree.py --clean /home/mcgrof/linux-next /home/mcgrof/build/next-20140411 Copy original source files ...
Apply patches ...
Modify Kconfig tree ...
Rewrite Makefiles and Kconfig files ...
Done!

real    1m15.463s
user    10m49.100s
sys     0m37.100s
Cc Peter Senna <[email protected]>
Cc Julia Lawall <[email protected]>
Cc Gilles Muller <[email protected]>
---
 lib/bpcoccinelle.py | 1 +
 1 file changed, 1 insertion(+)
lib/bpcoccinelle.py +1 -0
index 75a0b37..2e0153e 100644
@@ -35,6 +35,7 @@ def spatch(cocci_file, outdir,
             '--recursive-includes',
             '--relax-include-path',
             '--use-coccigrep',
+            '--timeout', '120',
             '--backup-suffix', '.cocci_backup', '--dir', '.']
 
     if (max_threads > 1):
Signature · 1 line
1.9.1
#6 lore raw

PATCH 6/8 backports: pycocci - make the Coccinelle wrapper a standalone tool

In reply to Luis R. Rodriguez

This lets us share it for general use as a generic tool, we'll upkeep it here for now and if Coccinelle picks it up we can drop it and just require folks to install it.

This lets us use the same solution for standard testing / regular development and also for backports without any discrepencies.

Cc Peter Senna <[email protected]>
Cc Julia Lawall <[email protected]>
Cc Gilles Muller <[email protected]>
---
 devel/pycocci       | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 gentree.py          |  20 ++++--
 lib/bpcoccinelle.py |  91 --------------------------
 3 files changed, 194 insertions(+), 97 deletions(-)
 create mode 100755 devel/pycocci
 delete mode 100644 lib/bpcoccinelle.py
devel/pycocci new file +180 -0
new file mode 100755
index 0000000..fde8190
@@ -0,0 +1,180 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Luis R. Rodriguez  <[email protected]>
+# Copyright (c) 2013 Johannes Berg <[email protected]>
+#
+# This file is released under the GPLv2.
+#
+# Python wrapper for Coccinelle for multithreaded support,
+# designed to be used for working on a git tree, and with sensible
+# defaults, specifically for kernel developers.
+
+from multiprocessing import Process, cpu_count, Queue
+import argparse, subprocess, os, sys
+import tempfile, shutil
+
+# simple tempdir wrapper object for 'with' statement
+#
+# Usage:
+# with tempdir.tempdir() as tmpdir:
+#     os.chdir(tmpdir)
+#     do something
+#
+class tempdir(object):
+    def __init__(self, suffix='', prefix='', dir=None, nodelete=False):
+        self.suffix = ''
+        self.prefix = ''
+        self.dir = dir
+        self.nodelete = nodelete
+
+    def __enter__(self):
+        self._name = tempfile.mkdtemp(suffix=self.suffix,
+                                      prefix=self.prefix,
+                                      dir=self.dir)
+        return self._name
+
+    def __exit__(self, type, value, traceback):
+        if self.nodelete:
+            print('not deleting directory %s!' % self._name)
+        else:
+            shutil.rmtree(self._name)
+
+class CoccinelleError(Exception):
+    pass
+class ExecutionError(CoccinelleError):
+    def __init__(self, cmd, errcode):
+        self.error_code = errcode
+        print('Failed command:')
+        print(' '.join(cmd))
+
+class ExecutionErrorThread(CoccinelleError):
+    def __init__(self, errcode, fn, cocci_file, threads, t, logwrite, print_name):
+        self.error_code = errcode
+        logwrite("Failed to apply changes from %s" % print_name)
+
+        logwrite("Specific log output from change that failed using %s" % print_name)
+        tf = open(fn, 'r')
+        for line in tf.read():
+            logwrite('> %s' % line)
+        tf.close()
+
+        logwrite("Full log using %s" % print_name)
+        for num in range(threads):
+            fn = os.path.join(t, '.tmp_spatch_worker.' + str(num))
+            if (not os.path.isfile(fn)):
+                continue
+            tf = open(fn, 'r')
+            for line in tf.read():
+                logwrite('> %s' % line)
+            tf.close()
+            os.unlink(fn)
+
+def spatch(cocci_file, outdir,
+           max_threads, thread_id, temp_dir, ret_q, extra_args=[]):
+    cmd = ['spatch',
+            '--sp-file', cocci_file,
+            '--in-place',
+            '--recursive-includes',
+            '--relax-include-path',
+            '--use-coccigrep',
+            '--timeout', '120',
+            '--dir', outdir ]
+
+    if (max_threads > 1):
+        cmd.extend(['-max', str(max_threads), '-index', str(thread_id)])
+
+    cmd.extend(extra_args)
+
+    fn = os.path.join(temp_dir, '.tmp_spatch_worker.' + str(thread_id))
+    outfile = open(fn, 'w')
+
+    sprocess = subprocess.Popen(cmd,
+                               stdout=outfile, stderr=subprocess.STDOUT,
+                               close_fds=True, universal_newlines=True)
+    sprocess.wait()
+    if sprocess.returncode != 0:
+        raise ExecutionError(cmd, sprocess.returncode)
+    outfile.close()
+    ret_q.put((sprocess.returncode, fn))
+
+def threaded_spatch(cocci_file, outdir, logwrite, num_jobs,
+                    print_name, extra_args=[]):
+    num_cpus = cpu_count()
+    if num_jobs:
+        threads = int(num_jobs)
+    else:
+        threads = num_cpus
+    jobs = list()
+    output = ""
+    ret_q = Queue()
+    with tempdir() as t:
+        for num in range(threads):
+            p = Process(target=spatch, args=(cocci_file, outdir,
+                                             threads, num, t, ret_q,
+                                             extra_args))
+            jobs.append(p)
+        for p in jobs:
+            p.start()
+
+        for num in range(threads):
+            ret, fn = ret_q.get()
+            if ret != 0:
+                raise ExecutionErrorThread(ret, fn, cocci_file, threads, t,
+                                           logwrite, print_name)
+        for job in jobs:
+            p.join()
+
+        for num in range(threads):
+            fn = os.path.join(t, '.tmp_spatch_worker.' + str(num))
+            tf = open(fn, 'r')
+            output = output + tf.read()
+            tf.close()
+            os.unlink(fn)
+        return output
+
+def logwrite(msg):
+    sys.stdout.write(msg)
+    sys.stdout.flush()
+
+def _main():
+    parser = argparse.ArgumentParser(description='Multithreaded Python wrapper for Coccinelle ' +
+                                     'with sensible defaults, targetted specifically ' +
+                                     'for git development environments')
+    parser.add_argument('cocci_file', metavar='<Coccinelle SmPL rules file>', type=str,
+                        help='This is the Coccinelle file you want to use')
+    parser.add_argument('target_dir', metavar='<target directory>', type=str,
+                        help='Target source directory to modify')
+    parser.add_argument('-p', '--profile-cocci', const=True, default=False, action="store_const",
+                        help='Enable profile, this will pass --profile  to Coccinelle.')
+    parser.add_argument('-j', '--jobs', metavar='<jobs>', type=str, default=None,
+                        help='Only use the cocci file passed for Coccinelle, don\'t do anything else, ' +
+                        'also creates a git repo on the target directory for easy inspection ' +
+                        'of changes done by Coccinelle.')
+    parser.add_argument('-v', '--verbose', const=True, default=False, action="store_const",
+                        help='Enable output from Coccinelle')
+    args = parser.parse_args()
+
+    if not os.path.isfile(args.cocci_file):
+        return -2
+
+    extra_spatch_args = []
+    if args.profile_cocci:
+        extra_spatch_args.append('--profile')
+    jobs = 0
+    if args.jobs > 0:
+        jobs = args.jobs
+
+    output = threaded_spatch(args.cocci_file,
+                             args.target_dir,
+                             logwrite,
+                             jobs,
+                             os.path.basename(args.cocci_file),
+                             extra_args=extra_spatch_args)
+    if args.verbose:
+        logwrite(output)
+    return 0
+
+if __name__ == '__main__':
+    ret = _main()
+    if ret:
+        sys.exit(ret)
gentree.py +14 -6
index b890d28..44acb9a 100755
@@ -14,7 +14,6 @@ from lib import kconfig, patch, make
 from lib import bpgit as git
 from lib import bpgpg as gpg
 from lib import bpkup as kup
-from lib import bpcoccinelle as coccinelle
 from lib.tempdir import tempdir
 
 def read_copy_list(copyfile):
@@ -712,16 +711,25 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None,
     prefix_len = len(os.path.join(source_dir, 'patches')) + 1
 
     for cocci_file in sempatches:
+        # Until Coccinelle picks this up
+        pycocci = os.path.join(source_dir, 'devel/pycocci')
+        cmd = [pycocci, cocci_file]
         extra_spatch_args = []
         if args.profile_cocci:
-            extra_spatch_args.append('--profile')
+            cmd.append('--profile-cocci')
+        cmd.append(args.outdir)
         print_name = cocci_file[prefix_len:]
         if args.verbose:
             logwrite("Applying SmPL patch %s" % print_name)
-
-        output = coccinelle.threaded_spatch(cocci_file, args.outdir,
-                                            logwrite, print_name,
-                                            extra_args=extra_spatch_args)
+        sprocess = subprocess.Popen(cmd,
+                                    stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+                                    close_fds=True, universal_newlines=True,
+                                    cwd=args.outdir)
+        output = sprocess.communicate()[0]
+        sprocess.wait()
+        if sprocess.returncode != 0:
+            logwrite("Failed to process SmPL patch %s" % print_name)
+            return 3
         output = output.split('\n')
         if output[-1] == '':
             output = output[:-1]
lib/bpcoccinelle.py deleted +0 -91

91 lines not on this page · raw message

Signature · 1 line
1.9.1
#7 lore raw

PATCH 7/8 backports: formalize struct sock sk_data_ready() backport with SmPL

In reply to Luis R. Rodriguez

Commit 676d2369 by David removed the skb->len arguments passed onto the struct sock sk_data_ready() callback. This was done as its racy, a few drivers were passing 0 to it, and it was not really used. By removing it the raciness is addresed but to backport this we are going to have to deal with the races as-is on older kernels. This was merged as of v3.15:

mcgrof@ergon ~/linux-next (git::master)$ git describe --contains 676d2369 v3.15-rc1~8^2~10

Since this is not a define or static inline we can't easily replace this with the backports module or header files, instead we use SmPL grammar to generalize the backport for all use cases. Note that in order to backport this we won't know what older kernel drivers were using before this change, it could have been 0 or skb->len for the length parameter, since we have to infer something we choose skb->len *iff* skb_queue_tail() was used right before it, otherwise we infer to throw 0.

Adding this SmPL patch to our series only incurs an additional ~9 seconds on run time code generation.

mcgrof@drvbp1 ~/backports (git::master)$ time ./gentree.py --clean /home/mcgrof/linux-next /home/mcgrof/build/next-20140415-clean Copy original source files ...
Apply patches ...
Modify Kconfig tree ...
Rewrite Makefiles and Kconfig files ...
Done!

real    1m25.128s
user    12m49.380s
sys     0m44.892s
1   3.0.101             [  OK  ]
2   3.1.10              [  OK  ]
3   3.2.54              [  OK  ]
4   3.3.8               [  OK  ]
5   3.4.79              [  OK  ]
6   3.5.7               [  OK  ]
7   3.6.11              [  OK  ]
8   3.7.10              [  OK  ]
9   3.8.13              [  OK  ]
10  3.9.11              [  OK  ]
11  3.10.29             [  OK  ]
12  3.11.10             [  OK  ]
13  3.12.10             [  OK  ]
14  3.13.2              [  OK  ]
15  3.14-rc1            [  OK  ]
real    18m42.577s
user    498m48.572s
sys     64m0.560s

commit 676d23690fb62b5d51ba5d659935e9f7d9da9f8e

Author: David S. Miller <[email protected]>
Date:   Fri Apr 11 16:15:36 2014 -0400

net: Fix use after free by removing length arg from sk_data_ready callbacks.

Several spots in the kernel perform a sequence like:

skb_queue_tail(&sk->s_receive_queue, skb); sk->sk_data_ready(sk, skb->len);

But at the moment we place the SKB onto the socket receive queue it can be consumed and freed up. So this skb->len access is potentially to freed up memory.

Furthermore, the skb->len can be modified by the consumer so it is possible that the value isn't accurate.

And finally, no actual implementation of this callback actually uses the length argument. And since nobody actually cared about it's value, lots of call sites pass arbitrary values in such as '0' and even '1'.

So just remove the length argument from the callback, that way there is no confusion whatsoever and all of these use-after-free cases get fixed as a side effect.

Based upon a patch by Eric Dumazet and his suggestion to audit this issue tree-wide.

Cc David S. Miller <[email protected]>
Cc Peter Senna <[email protected]>
Cc Julia Lawall <[email protected]>
Cc Gilles Muller <[email protected]>
---
 .../network/0031-sk_data_ready.cocci               | 117 +++++++++++++++++++++
 1 file changed, 117 insertions(+)
 create mode 100644 patches/collateral-evolutions/network/0031-sk_data_ready.cocci
patches/collateral-evolutions/network/0031-sk_data_ready.cocci new file +117 -0
new file mode 100644
index 0000000..3dc218c
@@ -0,0 +1,117 @@
+/*
+Commit 676d2369 by David removed the skb->len arguments passed onto
+the struct sock sk_data_ready() callback. This was done as its racy,
+a few drivers were passing 0 to it, and it was not really used.
+By removing it the raciness is addresed but to backport this we are
+going to have to deal with the races as-is on older kernels. This was
+merged as of v3.15:
+
+mcgrof@ergon ~/linux-next (git::master)$ git describe --contains 676d2369
+v3.15-rc1~8^2~10
+
+Since this is not a define or static inline we can't easily replace this with
+the backports module or header files, instead we use SmPL grammar to generalize
+the backport for all use cases. Note that in order to backport this we won't
+know what older kernel drivers were using before this change, it could have
+been 0 or skb->len for the length parameter, since we have to infer something
+we choose skb->len *iff* skb_queue_tail() was used right before it, otherwise
+we infer to throw 0.
+
+commit 676d23690fb62b5d51ba5d659935e9f7d9da9f8e
+Author: David S. Miller <[email protected]>
+Date:   Fri Apr 11 16:15:36 2014 -0400
+
+    net: Fix use after free by removing length arg from sk_data_ready callbacks.
+    
+    Several spots in the kernel perform a sequence like:
+    
+        skb_queue_tail(&sk->s_receive_queue, skb);
+        sk->sk_data_ready(sk, skb->len);
+    
+    But at the moment we place the SKB onto the socket receive queue it
+    can be consumed and freed up.  So this skb->len access is potentially
+    to freed up memory.
+    
+    Furthermore, the skb->len can be modified by the consumer so it is
+    possible that the value isn't accurate.
+    
+    And finally, no actual implementation of this callback actually uses
+    the length argument.  And since nobody actually cared about it's
+    value, lots of call sites pass arbitrary values in such as '0' and
+    even '1'.
+    
+    So just remove the length argument from the callback, that way there
+    is no confusion whatsoever and all of these use-after-free cases get
+    fixed as a side effect.
+    
+    Based upon a patch by Eric Dumazet and his suggestion to audit this
+    issue tree-wide.
+    
+    Signed-off-by: David S. Miller <[email protected]>
+*/
+
+@ sk_data_ready_assigned @
+expression E;
+identifier drv_data_ready;
+@@
+
+	E->sk_data_ready = drv_data_ready;
+
+@ sk_data_ready_declared depends on sk_data_ready_assigned @
+identifier sk;
+identifier sk_data_ready_assigned.drv_data_ready;
+fresh identifier backport_drv_data_ready = "backport_" ## drv_data_ready;
+@@
+
+drv_data_ready(struct sock *sk)
+{
+	...
+}
+
++static void backport_drv_data_ready(struct sock *sk, int unused)
++{
++	drv_data_ready(sk);
++}
+
+@ sk_data_ready_assigned_mod_e depends on sk_data_ready_assigned @
+expression E;
+identifier sk_data_ready_assigned.drv_data_ready;
+fresh identifier backport_drv_data_ready = "backport_" ## drv_data_ready;
+@@
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
+	E->sk_data_ready = drv_data_ready;
++#else
++	E->sk_data_ready = backport_drv_data_ready;
++#endif
+
+@ sk_data_ready_found @
+expression E;
+struct sock *sk;
+@@
+
+	E->sk_data_ready(sk);
+
+@ sk_data_ready_skips_skb_queue_tail_E depends on sk_data_ready_found @
+expression E;
+@@
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
+	E->sk_data_ready(E);
++#else
++	E->sk_data_ready(E, 0);
++#endif
+
+@ sk_data_ready_uses_skb_queue_tail depends on sk_data_ready_found && !sk_data_ready_skips_skb_queue_tail_E @
+struct sock *sk;
+struct sk_buff *skb;
+identifier sk_data_ready;
+@@
+
+	skb_queue_tail(&sk->sk_receive_queue, skb);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
+	sk->sk_data_ready(sk);
++#else
++	sk->sk_data_ready(sk, skb->len);
++#endif
+
Signature · 1 line
1.9.1
#8 lore raw

PATCH 8/8 backports: refresh patches for next-20140415

In reply to Luis R. Rodriguez

This update required one collateral evolution to be addressed, the rest was just a patch refresh.

mcgrof@drvbp1 ~/backports (git::master)$ time ./gentree.py --clean --refresh /home/mcgrof/linux-next /home/mcgrof/build/next-20140415 Copy original source files ...
Apply patches ...
Modify Kconfig tree ...
Rewrite Makefiles and Kconfig files ...
Done!

real    1m16.527s
user    10m47.068s
sys     0m37.412s
1   3.0.101             [  OK  ]
2   3.1.10              [  OK  ]
3   3.2.54              [  OK  ]
4   3.3.8               [  OK  ]
5   3.4.79              [  OK  ]
6   3.5.7               [  OK  ]
7   3.6.11              [  OK  ]
8   3.7.10              [  OK  ]
9   3.8.13              [  OK  ]
10  3.9.11              [  OK  ]
11  3.10.29             [  OK  ]
12  3.11.10             [  OK  ]
13  3.12.10             [  OK  ]
14  3.13.2              [  OK  ]
15  3.14-rc1            [  OK  ]
real    18m42.577s
user    498m48.572s
sys     64m0.560s
---
 .../0001-ethernet-igb/0001-igb_net_device_ops.patch               | 6 +++---
 .../0001-ethernet-igb/0002-igb_pci_sriov_configure.patch          | 8 ++++----
 .../0001-ethernet-igb/0008-igb_no_fcs.patch                       | 2 +-
 .../0001-ethernet-igb/0009-igb_vlan_rx_vid.patch                  | 6 +++---
 .../0001-ethernet-igb/0012-igb_ndo_set_vf_spoofchk.patch          | 6 +++---
 5 files changed, 14 insertions(+), 14 deletions(-)
patches/the-way-not-to-do-backports/0001-ethernet-igb/0001-igb_net_device_ops.patch +3 -3
index 6b80ad0..97ad8aa 100644
@@ -16,7 +16,7 @@ index 14ad4c7..f2a5abf 100644
  static void igb_restore_vlan(struct igb_adapter *);
  static void igb_rar_set_qsel(struct igb_adapter *, u8 *, u32 , u8);
  static void igb_ping_all_vfs(struct igb_adapter *);
-@@ -7248,8 +7253,12 @@ static void igb_vlan_mode(struct net_dev
+@@ -7249,8 +7254,12 @@ static void igb_vlan_mode(struct net_dev
  	igb_rlpml_set(adapter);
  }
  
@@ -29,7 +29,7 @@ index 14ad4c7..f2a5abf 100644
  {
  	struct igb_adapter *adapter = netdev_priv(netdev);
  	struct e1000_hw *hw = &adapter->hw;
-@@ -7266,8 +7275,12 @@ static int igb_vlan_rx_add_vid(struct ne
+@@ -7267,8 +7276,12 @@ static int igb_vlan_rx_add_vid(struct ne
  	return 0;
  }
  
@@ -42,7 +42,7 @@ index 14ad4c7..f2a5abf 100644
  {
  	struct igb_adapter *adapter = netdev_priv(netdev);
  	struct e1000_hw *hw = &adapter->hw;
-@@ -7293,7 +7306,11 @@ static void igb_restore_vlan(struct igb_
+@@ -7294,7 +7307,11 @@ static void igb_restore_vlan(struct igb_
  	igb_vlan_mode(adapter->netdev, adapter->netdev->features);
  
  	for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
patches/the-way-not-to-do-backports/0001-ethernet-igb/0002-igb_pci_sriov_configure.patch +4 -4
index 9b4ba5d..49c29ee 100644
@@ -22,7 +22,7 @@ index f2a5abf..dd878b6 100644
  	.err_handler = &igb_err_handler
  };
  
-@@ -7599,6 +7603,7 @@ static int igb_sriov_reinit(struct pci_d
+@@ -7600,6 +7604,7 @@ static int igb_sriov_reinit(struct pci_d
  	return 0;
  }
  
@@ -30,7 +30,7 @@ index f2a5abf..dd878b6 100644
  static int igb_pci_disable_sriov(struct pci_dev *dev)
  {
  	int err = igb_disable_sriov(dev);
-@@ -7608,6 +7613,7 @@ static int igb_pci_disable_sriov(struct
+@@ -7609,6 +7614,7 @@ static int igb_pci_disable_sriov(struct
  
  	return err;
  }
@@ -38,7 +38,7 @@ index f2a5abf..dd878b6 100644
  
  static int igb_pci_enable_sriov(struct pci_dev *dev, int num_vfs)
  {
-@@ -7625,6 +7631,8 @@ out:
+@@ -7626,6 +7632,8 @@ out:
  }
  
  #endif
@@ -47,7 +47,7 @@ index f2a5abf..dd878b6 100644
  static int igb_pci_sriov_configure(struct pci_dev *dev, int num_vfs)
  {
  #ifdef CONFIG_PCI_IOV
-@@ -7635,6 +7643,7 @@ static int igb_pci_sriov_configure(struc
+@@ -7636,6 +7644,7 @@ static int igb_pci_sriov_configure(struc
  #endif
  	return 0;
  }
patches/the-way-not-to-do-backports/0001-ethernet-igb/0008-igb_no_fcs.patch +1 -1
index f6d692a..8b5bb4a 100644
@@ -2,7 +2,7 @@ diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/in
 index fd6a103..a919cfa 100644
 --- a/drivers/net/ethernet/intel/igb/igb_main.c
 +++ b/drivers/net/ethernet/intel/igb/igb_main.c
-@@ -4766,9 +4766,10 @@ static u32 igb_tx_cmd_type(struct sk_buf
+@@ -4765,9 +4765,10 @@ static u32 igb_tx_cmd_type(struct sk_buf
  	cmd_type |= IGB_SET_FLAG(tx_flags, IGB_TX_FLAGS_TSTAMP,
  				 (E1000_ADVTXD_MAC_TSTAMP));
  
patches/the-way-not-to-do-backports/0001-ethernet-igb/0009-igb_vlan_rx_vid.patch +3 -3
index 83e8ccb..a2021ae 100644
@@ -18,7 +18,7 @@ index 37e6062..6bf0a88 100644
  static void igb_restore_vlan(struct igb_adapter *);
  static void igb_rar_set_qsel(struct igb_adapter *, u8 *, u32 , u8);
  static void igb_ping_all_vfs(struct igb_adapter *);
-@@ -7265,8 +7268,10 @@ static void igb_vlan_mode(struct net_dev
+@@ -7266,8 +7269,10 @@ static void igb_vlan_mode(struct net_dev
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
  static int igb_vlan_rx_add_vid(struct net_device *netdev,
  			       __be16 proto, u16 vid)
@@ -30,7 +30,7 @@ index 37e6062..6bf0a88 100644
  #endif
  {
  	struct igb_adapter *adapter = netdev_priv(netdev);
-@@ -7281,15 +7286,19 @@ static int igb_vlan_rx_add_vid(struct ne
+@@ -7282,15 +7287,19 @@ static int igb_vlan_rx_add_vid(struct ne
  
  	set_bit(vid, adapter->active_vlans);
  
@@ -52,7 +52,7 @@ index 37e6062..6bf0a88 100644
  {
  	struct igb_adapter *adapter = netdev_priv(netdev);
  	struct e1000_hw *hw = &adapter->hw;
-@@ -7305,7 +7314,9 @@ static int igb_vlan_rx_kill_vid(struct n
+@@ -7306,7 +7315,9 @@ static int igb_vlan_rx_kill_vid(struct n
  
  	clear_bit(vid, adapter->active_vlans);
  
patches/the-way-not-to-do-backports/0001-ethernet-igb/0012-igb_ndo_set_vf_spoofchk.patch +3 -3
index ad19752..a2c5ddb 100644
@@ -23,7 +23,7 @@ index 35ac7d8..e609f71 100644
  	.ndo_get_vf_config	= igb_ndo_get_vf_config,
  #ifdef CONFIG_NET_POLL_CONTROLLER
  	.ndo_poll_controller	= igb_netpoll,
-@@ -7934,6 +7938,7 @@ static int igb_ndo_set_vf_bw(struct net_
+@@ -7935,6 +7939,7 @@ static int igb_ndo_set_vf_bw(struct net_
  	return 0;
  }
  
@@ -31,7 +31,7 @@ index 35ac7d8..e609f71 100644
  static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
  				   bool setting)
  {
-@@ -7960,6 +7965,7 @@ static int igb_ndo_set_vf_spoofchk(struc
+@@ -7961,6 +7966,7 @@ static int igb_ndo_set_vf_spoofchk(struc
  	adapter->vf_data[vf].spoofchk_enabled = setting;
  	return E1000_SUCCESS;
  }
@@ -39,7 +39,7 @@ index 35ac7d8..e609f71 100644
  
  static int igb_ndo_get_vf_config(struct net_device *netdev,
  				 int vf, struct ifla_vf_info *ivi)
-@@ -7972,7 +7978,9 @@ static int igb_ndo_get_vf_config(struct
+@@ -7973,7 +7979,9 @@ static int igb_ndo_get_vf_config(struct
  	ivi->tx_rate = adapter->vf_data[vf].tx_rate;
  	ivi->vlan = adapter->vf_data[vf].pf_vlan;
  	ivi->qos = adapter->vf_data[vf].pf_qos;
Signature · 1 line
1.9.1