Jiri Kosina 60893d
SUSE Linux Enterprise Patch Policy
Jiri Kosina 60893d
----------------------------------
Jiri Kosina 60893d
Jiri Kosina 60893d
Summary
Jiri Kosina 60893d
-------
Jiri Kosina 60893d
Jiri Kosina 60893d
The SUSE Linux Enterprise (SLE) patch policy mirrors the mainline Linux
Jiri Kosina 60893d
community's policy for accepting changes.  Each commit must contain a
Jiri Kosina 60893d
small and "obvious" change that can be reviewed individually and, once
Jiri Kosina 60893d
applied, be able to be used as a bisection point.  The kernel should be
Jiri Kosina 60893d
able to build (and boot) between each applied patch.  Since the SLE
Jiri Kosina 60893d
kernel is based on an official upstream kernel release and is followed by
Jiri Kosina 60893d
a hardening process, we expect that nearly all of the patches applied to the
Jiri Kosina 60893d
base release will be from subsequent official upstream releases indended to
Jiri Kosina 60893d
address specific issues or to allow for hardware/feature enablement.
Jiri Kosina 60893d
Jiri Kosina 60893d
Jiri Kosina 60893d
Background
Jiri Kosina 60893d
----------
Jiri Kosina 60893d
Jiri Kosina 60893d
Before covering the policy itself, we'll discuss a bit of background on
Jiri Kosina 60893d
how the source code tree is organized.  If you've used the SLE kernel source
Jiri Kosina 60893d
(kernel-source.git[1]) tree before, you've probably noticed that, unlike
Jiri Kosina 60893d
the mainline Linux kernel, we don't use a source-level git repository as
Jiri Kosina 60893d
our "base."  Instead, we use an official kernel.org Linux tar archive as
Jiri Kosina 60893d
the base and add a series of patches on top of it.  This carries with it
Jiri Kosina 60893d
several benefits.  The biggest is that we add metadata "tags" to our
Jiri Kosina 60893d
patches that allow us to easily associate patches with particular feature
Jiri Kosina 60893d
requests, bug reports, and/or the pedigree of the patch.  Due to the nature
Jiri Kosina 60893d
of some of our feature requests, we also must occasionally carry patches
Jiri Kosina 60893d
that, for one reason or another, haven't been accepted into the mainline
Jiri Kosina 60893d
kernel repository yet.  With a full (published[2]) git repository, it would
Jiri Kosina 60893d
be difficult to associate the initial commit for a particular feature with
Jiri Kosina 60893d
any subsequent changes to it.  Another benefit is more superficial: with the
Jiri Kosina 60893d
use of separate patches, we (and our users) are able to tell, at a glance,
Jiri Kosina 60893d
which patches are in any given kernel release simply by looking at
Jiri Kosina 60893d
the source package.  Patches are grouped into subsystems (including
Jiri Kosina 60893d
architecture, "core" vm/scheduler, VFS, individual file systems, driver
Jiri Kosina 60893d
core, networking core, block layer, and leaf drivers) so finding patches
Jiri Kosina 60893d
that affect a particular part of the kernel can be easily found.  Patches
Jiri Kosina 60893d
are placed in directories such as patches.fixes, patches.suse, etc.  When
Jiri Kosina 60893d
submitting patches for inclusion, it's not necessary to choose a directory.
Jiri Kosina 60893d
We'll put them in the appropriate place.
Jiri Kosina 60893d
Jiri Kosina 60893d
Historically, this approach has worked well but has limited options for
Jiri Kosina 60893d
typical debugging techniques such as bisection.  The application of the
Jiri Kosina 60893d
patch series results in our fully operational SLE kernel but stopping
Jiri Kosina 60893d
the patch series midway can result in an unbuildable source tree.  
Jiri Kosina 60893d
Beginning with the SLE11 SP2 development cycle, we've published a fully
Jiri Kosina 60893d
expanded git repository (kernel.git[2]) that exactly represents the code
Jiri Kosina 60893d
as if it were originally used as a standard source code tree repository.
Jiri Kosina 60893d
This allows us to work with the individual patches *and* have the ability
Jiri Kosina 60893d
to bisect the tree as the changes are applied.  It also makes it easier for
Jiri Kosina 60893d
partners unfamiliar with how our source tree works to make the transition.
Jiri Kosina 60893d
Jiri Kosina 60893d
Jiri Kosina 60893d
Format
Jiri Kosina 60893d
------
Jiri Kosina 60893d
The SLE patch format follows very closely what you would see on any
Jiri Kosina 60893d
mailing list associated with Linux kernel development.  A SLE patch is
Jiri Kosina 60893d
formatted like an RFC822 mbox-style mail message, with a few extensions.
Jiri Kosina 60893d
If the patch is coming from the mainline Linux repository or a subsystem
Jiri Kosina 60893d
maintainer repository, SUSE has tools published here[3] that can make
Jiri Kosina 60893d
adding these tags nearly painless.
Jiri Kosina 60893d
Jiri Kosina 60893d
Each patch should contain the "From" and "Subject" headers found in any
Jiri Kosina 60893d
email message.  The From should contain the name and email address of the
Jiri Kosina 60893d
patch author.  The Subject should contain a short description of the
Jiri Kosina 60893d
patch, prefixed with the subsystem affected.
Jiri Kosina 60893d
Jiri Kosina 60893d
e.g.
Jiri Kosina 60893d
From: Jeff Mahoney <jeffm@suse.com>
Jiri Kosina 60893d
Subject: init: print hello world at boot time
Jiri Kosina 60893d
Jiri Kosina 60893d
Beyond that, we require several more headers, the full description of
Jiri Kosina 60893d
the patch, the certification tags used in the mainline kernel, and the patch
Jiri Kosina 60893d
contents.
Jiri Kosina 60893d
Jiri Kosina 60893d
The headers we require are as follows:
Jiri Kosina 60893d
Jiri Kosina 60893d
Git-commit: [a-f0-9]{40}
Jiri Kosina 60893d
- Contains the SHA-1 git commit ID of the patch in either the mainline
Jiri Kosina 60893d
  kernel repository[4] or an official maintainer repository.
Jiri Kosina 60893d
Jiri Kosina 60893d
Git-repo: URL-to-git-repo (starting with git://)
Jiri Kosina 60893d
- The URL to the git repository containing the commit.  This tag can be
Jiri Kosina 60893d
  omitted if the commit is from the mainline kernel repository.
Jiri Kosina 60893d
Jiri Kosina 60893d
Patch-mainline: vMajor.Minor.Patch{-optional-rc}
Jiri Kosina 60893d
- The official kernel release that contains this patch.  In the case of a
Jiri Kosina 60893d
  patch accepted into a maintainer branch, "Queued in subsystem
Jiri Kosina 60893d
  maintainer repo" can be used.  If the patch has been submitted to a
Jiri Kosina 60893d
  subsystem mailing list for review and is nearly certain to be accepted,
Jiri Kosina 60893d
  "Submitted <date> <list@site.org>" can be used.  Otherwise, if the
Jiri Kosina 60893d
  patch will never be in the upstream kernel, e.g. in the case of
Jiri Kosina 60893d
  vendor-specific
Jiri Kosina 60893d
  version numbers, etc, then "No" followed by the reason why it will
Jiri Kosina 60893d
  not be accepted (or submitted).  Please note that the reason must be
Jiri Kosina 60893d
  compelling for it to be allowed into our kernel repository.
Jiri Kosina 60893d
Jiri Kosina 60893d
References: list of references
Jiri Kosina 60893d
- There must be a reason for each patch to be included into the kernel
Jiri Kosina 60893d
  repository.  It can be a fix in response to a bug report or a patch
Jiri Kosina 60893d
  submitted as part of the feature development cycle for a release.  We
Jiri Kosina 60893d
  use a shorthand to indicate why a particular patch will be included
Jiri Kosina 60893d
  and it's possible to use more than one.
Jiri Kosina 60893d
Jiri Kosina 60893d
  For Feature requests, the feature will have to have gone through our
Jiri Kosina 60893d
  feature tracking tool, FATE.  Each feature request will have an ID
Jiri Kosina 60893d
  associated with it and it can be added to the References tag using
Jiri Kosina 60893d
  FATE#number, e.g. FATE#12345.
Jiri Kosina 60893d
Jiri Kosina 60893d
  For fixes for bug reports (or patches for feature requests submitted
Jiri Kosina 60893d
  via Bugzilla, the shorthand is bnc#number.  bnc is shorthand for
Jiri Kosina 60893d
  bugzilla.novell.com.  There are others such as bko, for
Jiri Kosina 60893d
  bugzilla.kernel.org.
Jiri Kosina 60893d
Jiri Kosina 60893d
Next is the full description of the patch, which should explain why the
Jiri Kosina 60893d
patch is needed and an overview of what it does. 
Jiri Kosina 60893d
Jiri Kosina 60893d
The last "header" portion of the patch contains the certification tags, which
Jiri Kosina 60893d
consist of "Signed-off-by" and "Acked-by." We, and the upstream Linux
Jiri Kosina 60893d
community depend on patch submitters to "own" their submission and certify
Jiri Kosina 60893d
they have the right to submit code to the kernel repository.  For patches
Jiri Kosina 60893d
coming from the mainline Linux kernel repository, the certification tags
Jiri Kosina 60893d
are already in place and we only need the submitter's tag added (if not
Jiri Kosina 60893d
already part of the original patch).  Likewise, the SUSE engineer who
Jiri Kosina 60893d
includes the submission in our kernel tree, will add their own "Acked-by"
Jiri Kosina 60893d
tag.
Jiri Kosina 60893d
Jiri Kosina 60893d
There may be an optional diffstat -p1 output added before the patch content.
Jiri Kosina 60893d
Jiri Kosina 60893d
The patch content itself should be in "-ab" format where the patch header
Jiri Kosina 60893d
itself only contains the filename without any timestamps.
Jiri Kosina 60893d
Jiri Kosina 60893d
Here's an example of a complete patch:
Jiri Kosina 60893d
Jiri Kosina 60893d
-------->8--------
Jiri Kosina 60893d
From: Upstream Committer <coder@somesite.com>
Jiri Kosina 60893d
Subject: init: print hello world on boot
Jiri Kosina 60893d
Patch-mainline: v3.8-rc1
Jiri Kosina 60893d
Git-commit: deadbeefc0ffeeb1a4b1a4b1a4b1a4b1a4b1a4b1a4
Jiri Kosina 60893d
References: FATE#12134 bnc#23123
Jiri Kosina 60893d
Jiri Kosina 60893d
The kernel started off like every other project.  Let's add the hello
Jiri Kosina 60893d
world message in honor of its roots.
Jiri Kosina 60893d
Jiri Kosina 60893d
Signed-off-by: Upstream Committer <coder@somesite.com>
Jiri Kosina 60893d
Tested-by: Bill User <bill.user@example.com>
Jiri Kosina 60893d
Acked-by: Jeff Mahoney <jeffm@suse.com>
Jiri Kosina 60893d
---
Jiri Kosina 60893d
 init/main.c |    1 +
Jiri Kosina 60893d
 1 file changed, 1 insertion(+)
Jiri Kosina 60893d
Jiri Kosina 60893d
--- a/init/main.c
Jiri Kosina 60893d
+++ b/init/main.c
Jiri Kosina 60893d
@@ -807,6 +807,7 @@ static noinline int init_post(void)
Jiri Kosina 60893d
        system_state = SYSTEM_RUNNING;
Jiri Kosina 60893d
        numa_default_policy();
Jiri Kosina 60893d
Jiri Kosina 60893d
+       printk("Hello world!\n");
Jiri Kosina 60893d
Jiri Kosina 60893d
        current->signal->flags |= SIGNAL_UNKILLABLE;
Jiri Kosina 60893d
Jiri Kosina 60893d
--------8<--------
Jiri Kosina 60893d
Jiri Kosina 60893d
Jiri Kosina 60893d
Patch Inclusion Rules
Jiri Kosina 60893d
---------------------
Jiri Kosina 60893d
Jiri Kosina 60893d
As mentioned in the summary, we expect that most patches to the SLE kernel
Jiri Kosina 60893d
will come from subsequent official upstream kernel releases or from subsystem
Jiri Kosina 60893d
maintainer repositories (which imply that the patch will ultimately be
Jiri Kosina 60893d
a part of an official upstream Linux release).  The SLE kernel contains
Jiri Kosina 60893d
hardware enablement driver enhancement/backports for a wide range of devices
Jiri Kosina 60893d
offered by many vendors.  In many cases, the drivers are self-contained
Jiri Kosina 60893d
but many others have shared dependencies on common infrastructure.
Jiri Kosina 60893d
Jiri Kosina 60893d
The shared dependencies on common infrastructure combined with the need
Jiri Kosina 60893d
to be able to bisect the resulting kernel means that we must require
Jiri Kosina 60893d
all partners to submit patch series consisting of individual patches that
Jiri Kosina 60893d
match upstream commits.  In the case where a commit affects multiple drivers,
Jiri Kosina 60893d
it is acceptable to only contain the portions that effect a particular
Jiri Kosina 60893d
driver as long as it is annotated by appending "(partial)" to the Git-commit
Jiri Kosina 60893d
line and documenting what is included or dropped.  An example using the
Jiri Kosina 60893d
patch tools is included below.
Jiri Kosina 60893d
Jiri Kosina 60893d
Jiri Kosina 60893d
Tools
Jiri Kosina 60893d
-----
Jiri Kosina 60893d
We understand that there are a bunch of rules to follow and that implementing
Jiri Kosina 60893d
them all can be tedious.  We have a set of tools, published here[3], to make
Jiri Kosina 60893d
working with the patches a lot easier.
Jiri Kosina 60893d
Jiri Kosina 60893d
There are two tools: fixpatch and exportpatch.  Fixpatch will add missing
Jiri Kosina 60893d
headers and formatting to existing patches, assuming there's at least a
Jiri Kosina 60893d
Git-commit tag present.  Exportpatch, given a list of commit IDs on the
Jiri Kosina 60893d
commandline, will search for each commit in the configured repositories
Jiri Kosina 60893d
and export the patches.
Jiri Kosina 60893d
Jiri Kosina 60893d
There are several command line options that are useful.
Jiri Kosina 60893d
Jiri Kosina 60893d
-w|--write -- will write out each commit into a separate file.  The filenames
Jiri Kosina 60893d
              are based on the subject of the header and the filenames will
Jiri Kosina 60893d
	      be output on stdout for use directly in a series file.
Jiri Kosina 60893d
Jiri Kosina 60893d
-d DIR|--dir=DIR -- will write out each commit into a designated directory.
Jiri Kosina 60893d
                    The default is to write into the current directory.
Jiri Kosina 60893d
-f|--force -- By default exportpatch will not export commits that are local
Jiri Kosina 60893d
	      to the repository on disk.  It will also refuse to overwrite
Jiri Kosina 60893d
	      existing patch files.  This option overrides these checks.
Jiri Kosina 60893d
-F REF|--reference=REFERENCE -- Adds References automatically and can be
Jiri Kosina 60893d
			        specified multiple times.
Jiri Kosina 60893d
-x EXTRACT | --extract EXTRACT -- It it sometimes desirable to split out
Jiri Kosina 60893d
				  chunks of patches that affect only a
Jiri Kosina 60893d
				  particular section of the code.  This option
Jiri Kosina 60893d
				  accepts pathnames to extract.  Anything
Jiri Kosina 60893d
				  not specified will be skipped.  Paths ending
Jiri Kosina 60893d
				  with / designate everything under that
Jiri Kosina 60893d
				  hierarchy.  This also adds a (partial)
Jiri Kosina 60893d
				  notation to the Git-commit tag and adds
Jiri Kosina 60893d
				  a Patch-filtered: tag indicating which
Jiri Kosina 60893d
				  paths were used to extract.
Jiri Kosina 60893d
Jiri Kosina 60893d
There are also two other features that are used automatically.  The first is
Jiri Kosina 60893d
that 3-way merge diffs are handled automatically such that a new, exact
Jiri Kosina 60893d
two-way diff is generated.  Note that both the -x option and the automatic
Jiri Kosina 60893d
handling of merge commits can generate empty patches -- empty patches are
Jiri Kosina 60893d
skipped entirely and no files are generated.
Jiri Kosina 60893d
Jiri Kosina 60893d
A quick example for generating the patches necessary for a backport of the
Jiri Kosina 60893d
ixgbe driver against the 3.0 kernel.  Please note that it (obviously) skips
Jiri Kosina 60893d
any infrastructure changes required for the patches to build.  The Acked-by
Jiri Kosina 60893d
tags will automatically be added unless you were involved in the original
Jiri Kosina 60893d
upstream commit process.
Jiri Kosina 60893d
Jiri Kosina 60893d
exportpatch -w -d ixgbe -x drivers/net/ixgbe/ \
Jiri Kosina 60893d
            -x drivers/net/ethernet/intel/ixgbe/ \
Jiri Kosina 60893d
	    -F "FATE#12345" -F "bnc#12354" \
Jiri Kosina 60893d
	    $(git log v3.0.. --pretty=oneline -- drivers/net/ixgbe \
Jiri Kosina 60893d
	      drivers/net/ethernet/intel/ixgbe |cut -b 1-40) > ixgbe/series
Jiri Kosina 60893d
Jiri Kosina 60893d
The first patch in that series looks like this:
Jiri Kosina 60893d
--------8<--------
Jiri Kosina 60893d
From 6403eab143205a45a5493166ff8bf7e3646f4a77 Mon Sep 17 00:00:00 2001
Jiri Kosina 60893d
From: Joe Perches <joe@perches.com>
Jiri Kosina 60893d
Date: Fri, 3 Jun 2011 11:51:20 +0000
Jiri Kosina 60893d
Subject: drivers/net: Remove unnecessary semicolons
Jiri Kosina 60893d
Git-commit: 6403eab143205a45a5493166ff8bf7e3646f4a77 (partial)
Jiri Kosina 60893d
Patch-mainline: v3.1-rc1
Jiri Kosina 60893d
References: FATE#12345 bnc#12354
Jiri Kosina 60893d
Patch-filtered: drivers/net/ixgbe/ drivers/net/ethernet/intel/ixgbe/
Jiri Kosina 60893d
Jiri Kosina 60893d
Semicolons are not necessary after switch/while/for/if braces
Jiri Kosina 60893d
so remove them.
Jiri Kosina 60893d
Jiri Kosina 60893d
Signed-off-by: Joe Perches <joe@perches.com>
Jiri Kosina 60893d
Signed-off-by: David S. Miller <davem@davemloft.net>
Jiri Kosina 60893d
Acked-by: Jeff Mahoney <jeffm@suse.com>
Jiri Kosina 60893d
---
Jiri Kosina 60893d
Jiri Kosina 60893d
 drivers/net/ixgbe/ixgbe_82599.c  |    4 ++--
Jiri Kosina 60893d
 drivers/net/ixgbe/ixgbe_common.c |    4 ++--
Jiri Kosina 60893d
 2 files changed, 4 insertions(+), 4 deletions(-)
Jiri Kosina 60893d
Jiri Kosina 60893d
--- a/drivers/net/ixgbe/ixgbe_82599.c
Jiri Kosina 60893d
+++ b/drivers/net/ixgbe/ixgbe_82599.c
Jiri Kosina 60893d
@@ -1157,7 +1157,7 @@ s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 pballoc)
Jiri Kosina 60893d
 	default:
Jiri Kosina 60893d
 		/* bad value */
Jiri Kosina 60893d
 		return IXGBE_ERR_CONFIG;
Jiri Kosina 60893d
-	};
Jiri Kosina 60893d
+	}
Jiri Kosina 60893d
 
Jiri Kosina 60893d
 	/* Move the flexible bytes to use the ethertype - shift 6 words */
Jiri Kosina 60893d
 	fdirctrl |= (0x6 << IXGBE_FDIRCTRL_FLEX_SHIFT);
Jiri Kosina 60893d
@@ -1245,7 +1245,7 @@ s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 pballoc)
Jiri Kosina 60893d
 	default:
Jiri Kosina 60893d
 		/* bad value */
Jiri Kosina 60893d
 		return IXGBE_ERR_CONFIG;
Jiri Kosina 60893d
-	};
Jiri Kosina 60893d
+	}
Jiri Kosina 60893d
 
Jiri Kosina 60893d
 	/* Turn perfect match filtering on */
Jiri Kosina 60893d
 	fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH;
Jiri Kosina 60893d
Jiri Kosina 60893d
--- a/drivers/net/ixgbe/ixgbe_common.c
Jiri Kosina 60893d
+++ b/drivers/net/ixgbe/ixgbe_common.c
Jiri Kosina 60893d
@@ -1292,7 +1292,7 @@ static s32 ixgbe_ready_eeprom(struct ixgbe_hw *hw)
Jiri Kosina 60893d
 
Jiri Kosina 60893d
 		udelay(5);
Jiri Kosina 60893d
 		ixgbe_standby_eeprom(hw);
Jiri Kosina 60893d
-	};
Jiri Kosina 60893d
+	}
Jiri Kosina 60893d
 
Jiri Kosina 60893d
 	/*
Jiri Kosina 60893d
 	 * On some parts, SPI write time could vary from 0-20mSec on 3.3V
Jiri Kosina 60893d
@@ -1374,7 +1374,7 @@ static void ixgbe_shift_out_eeprom_bits(struct ixgbe_hw *hw, u16 data,
Jiri Kosina 60893d
 		 * EEPROM
Jiri Kosina 60893d
 		 */
Jiri Kosina 60893d
 		mask = mask >> 1;
Jiri Kosina 60893d
-	};
Jiri Kosina 60893d
+	}
Jiri Kosina 60893d
 
Jiri Kosina 60893d
 	/* We leave the "DI" bit set to "0" when we leave this routine. */
Jiri Kosina 60893d
 	eec &= ~IXGBE_EEC_DI;
Jiri Kosina 60893d
Jiri Kosina 60893d
-------->8--------
Jiri Kosina 60893d
Jiri Kosina 60893d
Links:
Libor Pechacek ac5806
[1]: http://kernel.suse.com/cgit/kernel-source/log/?h=SLE12
Libor Pechacek ac5806
[2]: http://kernel.suse.com/cgit/kernel/log/?h=SLE12
Jiri Kosina 60893d
[3]: http://download.opensuse.org/repositories/Kernel:/tools/
Libor Pechacek ac5806
[4]: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git