linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13
  2014-09-23 21:55 [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13 Ashutosh Dixit
@ 2014-09-23 21:46 ` Randy Dunlap
  2014-09-23 22:59   ` ashutosh dixit
  2014-09-23 21:59 ` Peter Foley
  1 sibling, 1 reply; 12+ messages in thread
From: Randy Dunlap @ 2014-09-23 21:46 UTC (permalink / raw)
  To: Ashutosh Dixit, linux-kernel, linux-doc, Andrew Morton, Peter Foley
  Cc: Sudeep Dutt, Nikhil Rao, Greg Kroah-Hartman

On 09/23/14 14:55, Ashutosh Dixit wrote:
> mpssd depends on headers available in kernels >= 3.13. Therefore
> disable the build for kernels < 3.13. For kernels < 3.13, to avoid the
> appearance of a build break simply print an error message and exit.

Why is this needed?  This file won't be built in any automated build
in v3.13 or any kernel until v3.17 at the earliest?


> Reported-by: Andrew Morton <akpm@linux-foundation.org>
> Cc: Randy Dunlap <rdunlap@infradead.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Peter Foley <pefoley2@pefoley.com>
> Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
> Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> ---
>  Documentation/mic/mpssd/mpssd.c | 15 +++++++++++++++
>  Documentation/mic/mpssd/sysfs.c |  5 +++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/Documentation/mic/mpssd/mpssd.c b/Documentation/mic/mpssd/mpssd.c
> index 3c5c379..2cc48cc 100644
> --- a/Documentation/mic/mpssd/mpssd.c
> +++ b/Documentation/mic/mpssd/mpssd.c
> @@ -18,6 +18,10 @@
>   * Intel MIC User Space Tools.
>   */
>  
> +#include <linux/version.h>
> +
> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
> +
>  #define _GNU_SOURCE
>  
>  #include <stdlib.h>
> @@ -1726,3 +1730,14 @@ main(int argc, char *argv[])
>  
>  	exit(0);
>  }
> +#else /* kernel version < 3.13 */
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +
> +int main(void)
> +{
> +	fprintf(stderr, "mpssd is only usable against kernels >= 3.13\n");
> +	exit(1);
> +}
> +#endif
> diff --git a/Documentation/mic/mpssd/sysfs.c b/Documentation/mic/mpssd/sysfs.c
> index 8dd3269..1e3ff75 100644
> --- a/Documentation/mic/mpssd/sysfs.c
> +++ b/Documentation/mic/mpssd/sysfs.c
> @@ -18,6 +18,10 @@
>   * Intel MIC User Space Tools.
>   */
>  
> +#include <linux/version.h>
> +
> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
> +
>  #include "mpssd.h"
>  
>  #define PAGE_SIZE 4096
> @@ -100,3 +104,4 @@ done:
>  		free(oldvalue);
>  	return ret;
>  }
> +#endif
> 


-- 
~Randy

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13
@ 2014-09-23 21:55 Ashutosh Dixit
  2014-09-23 21:46 ` Randy Dunlap
  2014-09-23 21:59 ` Peter Foley
  0 siblings, 2 replies; 12+ messages in thread
From: Ashutosh Dixit @ 2014-09-23 21:55 UTC (permalink / raw)
  To: linux-kernel, linux-doc, Andrew Morton, Randy Dunlap, Peter Foley
  Cc: Ashutosh Dixit, Sudeep Dutt, Nikhil Rao, Greg Kroah-Hartman

mpssd depends on headers available in kernels >= 3.13. Therefore
disable the build for kernels < 3.13. For kernels < 3.13, to avoid the
appearance of a build break simply print an error message and exit.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Peter Foley <pefoley2@pefoley.com>
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 Documentation/mic/mpssd/mpssd.c | 15 +++++++++++++++
 Documentation/mic/mpssd/sysfs.c |  5 +++++
 2 files changed, 20 insertions(+)

diff --git a/Documentation/mic/mpssd/mpssd.c b/Documentation/mic/mpssd/mpssd.c
index 3c5c379..2cc48cc 100644
--- a/Documentation/mic/mpssd/mpssd.c
+++ b/Documentation/mic/mpssd/mpssd.c
@@ -18,6 +18,10 @@
  * Intel MIC User Space Tools.
  */
 
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
+
 #define _GNU_SOURCE
 
 #include <stdlib.h>
@@ -1726,3 +1730,14 @@ main(int argc, char *argv[])
 
 	exit(0);
 }
+#else /* kernel version < 3.13 */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(void)
+{
+	fprintf(stderr, "mpssd is only usable against kernels >= 3.13\n");
+	exit(1);
+}
+#endif
diff --git a/Documentation/mic/mpssd/sysfs.c b/Documentation/mic/mpssd/sysfs.c
index 8dd3269..1e3ff75 100644
--- a/Documentation/mic/mpssd/sysfs.c
+++ b/Documentation/mic/mpssd/sysfs.c
@@ -18,6 +18,10 @@
  * Intel MIC User Space Tools.
  */
 
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
+
 #include "mpssd.h"
 
 #define PAGE_SIZE 4096
@@ -100,3 +104,4 @@ done:
 		free(oldvalue);
 	return ret;
 }
+#endif
-- 
2.0.0.rc3.2.g998f840


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13
  2014-09-23 21:55 [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13 Ashutosh Dixit
  2014-09-23 21:46 ` Randy Dunlap
@ 2014-09-23 21:59 ` Peter Foley
  1 sibling, 0 replies; 12+ messages in thread
From: Peter Foley @ 2014-09-23 21:59 UTC (permalink / raw)
  To: Ashutosh Dixit
  Cc: LKML, linux-doc, Andrew Morton, Randy Dunlap, Sudeep Dutt,
	Nikhil Rao, Greg Kroah-Hartman

On Tue, Sep 23, 2014 at 5:55 PM, Ashutosh Dixit
<ashutosh.dixit@intel.com> wrote:
> mpssd depends on headers available in kernels >= 3.13. Therefore
> disable the build for kernels < 3.13. For kernels < 3.13, to avoid the
> appearance of a build break simply print an error message and exit.
>
Everything in Documentation should be built against the headers in the
kernel source tree due to the dep on CONFIG_HEADERS_CHECK.
The patch that added this code was in the 3.12 tree
(https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Makefile?id=8d49751),
did it not work when it was first merged?
What was the exact command you used to compile this code?
Did you make sure check_headers was run first?

Thanks,

Peter

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13
  2014-09-23 21:46 ` Randy Dunlap
@ 2014-09-23 22:59   ` ashutosh dixit
  2014-09-23 23:23     ` Peter Foley
  0 siblings, 1 reply; 12+ messages in thread
From: ashutosh dixit @ 2014-09-23 22:59 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-kernel, linux-doc, Andrew Morton, Peter Foley, Dutt,
	Sudeep, Rao, Nikhil, Greg Kroah-Hartman

On Tue, Sep 23 2014 at 02:46:10 PM, Randy Dunlap <rdunlap@infradead.org> wrote:
> On 09/23/14 14:55, Ashutosh Dixit wrote:
>> mpssd depends on headers available in kernels >= 3.13. Therefore
>> disable the build for kernels < 3.13. For kernels < 3.13, to avoid the
>> appearance of a build break simply print an error message and exit.
>
> Why is this needed?  This file won't be built in any automated build
> in v3.13 or any kernel until v3.17 at the earliest?
>
Correct, if things in Documentation will be compiled against the headers
in the kernel source tree then this patch is not required. However,
Andrew had reported the following compile error:

> In file included from Documentation/mic/mpssd/sysfs.c:21:
> Documentation/mic/mpssd/mpssd.h:55:30: error: linux/virtio_ids.h: No such file or directory

which made it appear to us that Documentation was being compiled against
headers installed on the system, not headers in the kernel source
tree. The patch was submitted to address this latter case, but if that
does not occur it is not required.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13
  2014-09-23 22:59   ` ashutosh dixit
@ 2014-09-23 23:23     ` Peter Foley
  2014-09-23 23:38       ` Andrew Morton
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Foley @ 2014-09-23 23:23 UTC (permalink / raw)
  To: ashutosh dixit
  Cc: Randy Dunlap, linux-kernel, linux-doc, Andrew Morton, Dutt,
	Sudeep, Rao, Nikhil, Greg Kroah-Hartman

On Tue, Sep 23, 2014 at 6:59 PM, ashutosh dixit
<ashutosh.dixit@intel.com> wrote:
> Correct, if things in Documentation will be compiled against the headers
> in the kernel source tree then this patch is not required. However,
> Andrew had reported the following compile error:
>
>> In file included from Documentation/mic/mpssd/sysfs.c:21:
>> Documentation/mic/mpssd/mpssd.h:55:30: error: linux/virtio_ids.h: No such file or directory
>
> which made it appear to us that Documentation was being compiled against
> headers installed on the system, not headers in the kernel source
> tree. The patch was submitted to address this latter case, but if that
> does not occur it is not required.
>
Alright, if you want to handle the case where somebody is trying to
build against old and incompatible headers,
just have a #error "Your kernel headers are too old, at least 3.13 is
required" at the top of mpssd.c instead of having it fail at runtime.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13
  2014-09-23 23:23     ` Peter Foley
@ 2014-09-23 23:38       ` Andrew Morton
  2014-09-23 23:47         ` Peter Foley
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Morton @ 2014-09-23 23:38 UTC (permalink / raw)
  To: Peter Foley
  Cc: ashutosh dixit, Randy Dunlap, linux-kernel, linux-doc, Dutt,
	Sudeep, Rao, Nikhil, Greg Kroah-Hartman

On Tue, 23 Sep 2014 19:23:39 -0400 Peter Foley <pefoley2@pefoley.com> wrote:

> On Tue, Sep 23, 2014 at 6:59 PM, ashutosh dixit
> <ashutosh.dixit@intel.com> wrote:
> > Correct, if things in Documentation will be compiled against the headers
> > in the kernel source tree then this patch is not required. However,
> > Andrew had reported the following compile error:
> >
> >> In file included from Documentation/mic/mpssd/sysfs.c:21:
> >> Documentation/mic/mpssd/mpssd.h:55:30: error: linux/virtio_ids.h: No such file or directory
> >
> > which made it appear to us that Documentation was being compiled against
> > headers installed on the system, not headers in the kernel source
> > tree. The patch was submitted to address this latter case, but if that
> > does not occur it is not required.
> >
> Alright, if you want to handle the case where somebody is trying to
> build against old and incompatible headers,
> just have a #error "Your kernel headers are too old, at least 3.13 is
> required" at the top of mpssd.c instead of having it fail at runtime.
> 

This build error is caused by compiling mpssd prior to `make
headers_install'.

There's really no reason to check the kernel version.  If someone
transplants mpssd out of its distributed kernel and into some older
kernel then a miscompile is their problem - their backport is
incomplete.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13
  2014-09-23 23:38       ` Andrew Morton
@ 2014-09-23 23:47         ` Peter Foley
  2014-09-24  0:51           ` Andrew Morton
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Foley @ 2014-09-23 23:47 UTC (permalink / raw)
  To: Andrew Morton
  Cc: ashutosh dixit, Randy Dunlap, linux-kernel, linux-doc, Dutt,
	Sudeep, Rao, Nikhil, Greg Kroah-Hartman

On Tue, Sep 23, 2014 at 7:38 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> This build error is caused by compiling mpssd prior to `make
> headers_install'.
>
> There's really no reason to check the kernel version.  If someone
> transplants mpssd out of its distributed kernel and into some older
> kernel then a miscompile is their problem - their backport is
> incomplete.

I've only noticed this error when running make Documentation/,
in which case gcc silently uses the headers from the system,
since the headers_install ones don't exist yet.

Maybe having the build error out in this case instead of having mysterious
compile errors would be a better solution?

Thanks

Peter

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13
  2014-09-23 23:47         ` Peter Foley
@ 2014-09-24  0:51           ` Andrew Morton
  2014-09-24  0:58             ` Peter Foley
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Morton @ 2014-09-24  0:51 UTC (permalink / raw)
  To: Peter Foley
  Cc: ashutosh dixit, Randy Dunlap, linux-kernel, linux-doc, Dutt,
	Sudeep, Rao, Nikhil, Greg Kroah-Hartman

On Tue, 23 Sep 2014 19:47:11 -0400 Peter Foley <pefoley2@pefoley.com> wrote:

> On Tue, Sep 23, 2014 at 7:38 PM, Andrew Morton
> <akpm@linux-foundation.org> wrote:
> > This build error is caused by compiling mpssd prior to `make
> > headers_install'.
> >
> > There's really no reason to check the kernel version.  If someone
> > transplants mpssd out of its distributed kernel and into some older
> > kernel then a miscompile is their problem - their backport is
> > incomplete.
> 
> I've only noticed this error when running make Documentation/,
> in which case gcc silently uses the headers from the system,
> since the headers_install ones don't exist yet.
> 
> Maybe having the build error out in this case instead of having mysterious
> compile errors would be a better solution?
> 

Can't we just fix the Makefiles?  Cook up a rule which makes
headers_install (if needed) before building Documentation/?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13
  2014-09-24  0:51           ` Andrew Morton
@ 2014-09-24  0:58             ` Peter Foley
  2014-09-24  4:51               ` ashutosh dixit
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Foley @ 2014-09-24  0:58 UTC (permalink / raw)
  To: Andrew Morton
  Cc: ashutosh dixit, Randy Dunlap, linux-kernel, linux-doc, Dutt,
	Sudeep, Rao, Nikhil, Greg Kroah-Hartman

On Tue, Sep 23, 2014 at 8:51 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> Can't we just fix the Makefiles?  Cook up a rule which makes
> headers_install (if needed) before building Documentation/?

Currently, the ordering is enforced by
http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/Makefile#n946
I'll take a look at making Documentation/ depend on headers_install.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13
  2014-09-24  0:58             ` Peter Foley
@ 2014-09-24  4:51               ` ashutosh dixit
  2014-09-24  4:59                 ` Andrew Morton
  0 siblings, 1 reply; 12+ messages in thread
From: ashutosh dixit @ 2014-09-24  4:51 UTC (permalink / raw)
  To: Peter Foley
  Cc: Andrew Morton, Randy Dunlap, linux-kernel, linux-doc, Dutt,
	Sudeep, Rao, Nikhil, Greg Kroah-Hartman

On Tue, Sep 23 2014 at 05:58:19 PM, Peter Foley <pefoley2@pefoley.com> wrote:
> On Tue, Sep 23, 2014 at 8:51 PM, Andrew Morton
> <akpm@linux-foundation.org> wrote:
>> Can't we just fix the Makefiles?  Cook up a rule which makes
>> headers_install (if needed) before building Documentation/?
>
> Currently, the ordering is enforced by
> http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/Makefile#n946
> I'll take a look at making Documentation/ depend on headers_install.
>
I would think it is preferable to keep the 'make headers_install' and
'make Documentation/' steps separate, as they currently are, so that
only the people who need to upgrade system headers do that, rather than
forcing people to upgrade system headers each time something in
Documentation/ is recompiled and moreover doing that compile/install as
root.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13
  2014-09-24  4:51               ` ashutosh dixit
@ 2014-09-24  4:59                 ` Andrew Morton
  2014-09-24  5:20                   ` ashutosh dixit
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Morton @ 2014-09-24  4:59 UTC (permalink / raw)
  To: ashutosh dixit
  Cc: Peter Foley, Randy Dunlap, linux-kernel, linux-doc, Dutt, Sudeep,
	Rao, Nikhil, Greg Kroah-Hartman

On Tue, 23 Sep 2014 21:51:09 -0700 ashutosh dixit <ashutosh.dixit@intel.com> wrote:

> On Tue, Sep 23 2014 at 05:58:19 PM, Peter Foley <pefoley2@pefoley.com> wrote:
> > On Tue, Sep 23, 2014 at 8:51 PM, Andrew Morton
> > <akpm@linux-foundation.org> wrote:
> >> Can't we just fix the Makefiles?  Cook up a rule which makes
> >> headers_install (if needed) before building Documentation/?
> >
> > Currently, the ordering is enforced by
> > http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/Makefile#n946
> > I'll take a look at making Documentation/ depend on headers_install.
> >
> I would think it is preferable to keep the 'make headers_install' and
> 'make Documentation/' steps separate, as they currently are, so that
> only the people who need to upgrade system headers do that, rather than
> forcing people to upgrade system headers each time something in
> Documentation/ is recompiled and moreover doing that compile/install as
> root.

headers_install installs into ./usr/include and ./include.  It's local
to the kernel build tree.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13
  2014-09-24  4:59                 ` Andrew Morton
@ 2014-09-24  5:20                   ` ashutosh dixit
  0 siblings, 0 replies; 12+ messages in thread
From: ashutosh dixit @ 2014-09-24  5:20 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Peter Foley, Randy Dunlap, linux-kernel, linux-doc, Dutt, Sudeep,
	Rao, Nikhil, Greg Kroah-Hartman

On Tue, Sep 23 2014 at 09:59:32 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Tue, 23 Sep 2014 21:51:09 -0700 ashutosh dixit <ashutosh.dixit@intel.com> wrote:
>
>> On Tue, Sep 23 2014 at 05:58:19 PM, Peter Foley <pefoley2@pefoley.com> wrote:
>> > On Tue, Sep 23, 2014 at 8:51 PM, Andrew Morton
>> > <akpm@linux-foundation.org> wrote:
>> >> Can't we just fix the Makefiles?  Cook up a rule which makes
>> >> headers_install (if needed) before building Documentation/?
>> >
>> > Currently, the ordering is enforced by
>> > http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/Makefile#n946
>> > I'll take a look at making Documentation/ depend on headers_install.
>> >
>> I would think it is preferable to keep the 'make headers_install' and
>> 'make Documentation/' steps separate, as they currently are, so that
>> only the people who need to upgrade system headers do that, rather than
>> forcing people to upgrade system headers each time something in
>> Documentation/ is recompiled and moreover doing that compile/install as
>> root.
>
> headers_install installs into ./usr/include and ./include.  It's local
> to the kernel build tree.

Sorry about that. Yes, the build indeed succeeds if run after
headers_install, so making Documentation/ depend on headers_install is
indeed a possibility.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-09-24  5:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-23 21:55 [PATCH linux-next] Documentation: mic: mpssd: Disable mpssd builds for kernels < 3.13 Ashutosh Dixit
2014-09-23 21:46 ` Randy Dunlap
2014-09-23 22:59   ` ashutosh dixit
2014-09-23 23:23     ` Peter Foley
2014-09-23 23:38       ` Andrew Morton
2014-09-23 23:47         ` Peter Foley
2014-09-24  0:51           ` Andrew Morton
2014-09-24  0:58             ` Peter Foley
2014-09-24  4:51               ` ashutosh dixit
2014-09-24  4:59                 ` Andrew Morton
2014-09-24  5:20                   ` ashutosh dixit
2014-09-23 21:59 ` Peter Foley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).