Skip to contentSkip to conversation

kni: Use utsrelease.h to determine Ubuntu kernel version

PATCH Superseded Simon Kagstrom 6 participants 11 messages May 27, 2015 – Jul 10, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kni: Use utsrelease.h to determine Ubuntu kernel version

/proc/version_signature is the version for the host machine, but in e.g., chroots, this does not need to match that DPDK is built for. Use utsrelease.h from the kernel sources instead and fake the upload version.

---
 lib/librte_eal/linuxapp/kni/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/librte_eal/linuxapp/kni/Makefile +3 -3
index fb673d9..ac99d3f 100644
@@ -44,10 +44,10 @@ MODULE_CFLAGS += -I$(RTE_OUTPUT)/include -I$(SRCDIR)/ethtool/ixgbe -I$(SRCDIR)/e
 MODULE_CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h
 MODULE_CFLAGS += -Wall -Werror
 
-ifeq ($(shell test -f /proc/version_signature && lsb_release -si 2>/dev/null),Ubuntu)
+ifeq ($(shell lsb_release -si 2>/dev/null),Ubuntu)
 MODULE_CFLAGS += -DUBUNTU_RELEASE_CODE=$(shell lsb_release -sr | tr -d .)
-UBUNTU_KERNEL_CODE := $(shell cut -d' ' -f2 /proc/version_signature | \
-                        cut -d'~' -f1 | cut -d- -f1,2 | tr .- $(comma))
+UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE $(RTE_KERNELDIR)/include/generated/utsrelease.h \
+	 | cut -d '"' -f2 | cut -d- -f1,2 | tr .- $(comma)`,1)
 MODULE_CFLAGS += -D"UBUNTU_KERNEL_CODE=UBUNTU_KERNEL_VERSION($(UBUNTU_KERNEL_CODE))"
 endif
 
Signature · 1 line
1.9.1
#1 lore raw

Hi guys

Could you help to review the code changes where you modified before?

Regards,
Helin

Quoted 42 lines

-----Original Message-----
From: Simon Kagstrom [mailto:[email protected]]
Sent: Wednesday, May 27, 2015 7:45 PM
To: [email protected]; Zhang, Helin
Subject: [PATCH] kni: Use utsrelease.h to determine Ubuntu kernel version

/proc/version_signature is the version for the host machine, but in e.g., chroots, this does not need to match that DPDK is built for. Use utsrelease.h from the kernel sources instead and fake the upload version.

---
 lib/librte_eal/linuxapp/kni/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/librte_eal/linuxapp/kni/Makefile +0 -1
index fb673d9..ac99d3f 100644
@@ -44,10 +44,10 @@ MODULE_CFLAGS += -I$(RTE_OUTPUT)/include
-I$(SRCDIR)/ethtool/ixgbe -I$(SRCDIR)/e  MODULE_CFLAGS += -include

$(RTE_OUTPUT)/include/rte_config.h
MODULE_CFLAGS += -Wall -Werror

-ifeq ($(shell test -f /proc/version_signature && lsb_release -si 2>/dev/null),Ubuntu)

lib/librte_eal/linuxapp/kni/Makefile +2 -2
+ifeq ($(shell lsb_release -si 2>/dev/null),Ubuntu)
 MODULE_CFLAGS += -DUBUNTU_RELEASE_CODE=$(shell lsb_release -sr | tr -d .)
-UBUNTU_KERNEL_CODE := $(shell cut -d' ' -f2 /proc/version_signature | \
-                        cut -d'~' -f1 | cut -d- -f1,2 | tr .- $(comma))
+UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE

$(RTE_KERNELDIR)/include/generated/utsrelease.h \

lib/librte_eal/linuxapp/kni/Makefile +1 -1
+	 | cut -d '"' -f2 | cut -d- -f1,2 | tr .- $(comma)`,1)
 MODULE_CFLAGS +=
-D"UBUNTU_KERNEL_CODE=UBUNTU_KERNEL_VERSION($(UBUNTU_KERNEL_C

ODE))"
endif

--
1.9.1

#2 lore raw
Quoted 6 lines
Quoted 5 lines

-ifeq ($(shell test -f /proc/version_signature && lsb_release -si 2>/dev/null),Ubuntu)
+ifeq ($(shell lsb_release -si 2>/dev/null),Ubuntu)
MODULE_CFLAGS += -DUBUNTU_RELEASE_CODE=$(shell lsb_release -sr | tr -

d .)

Quoted 14 lines

Review

Quoted 7 lines
lib/librte_eal/linuxapp/kni/Makefile +1 -2
-UBUNTU_KERNEL_CODE := $(shell cut -d' ' -f2 /proc/version_signature | \
-                        cut -d'~' -f1 | cut -d- -f1,2 | tr .- $(comma))
+UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE

$(RTE_KERNELDIR)/include/generated/utsrelease.h \

(quoted diff) +1 -1
+	 | cut -d '"' -f2 | cut -d- -f1,2 | tr .- $(comma)`,1)
 MODULE_CFLAGS +=
-

D"UBUNTU_KERNEL_CODE=UBUNTU_KERNEL_VERSION($(UBUNTU_KERNEL_ C

Quoted 5 lines

ODE))"
endif

--
1.9.1

Hi,

It is fine for me if it do the job and does not break build on other OS (also other Ubuntu versions especially 12.04 if we still support it).
Please only check if UTS_RELEASE is available on all Ubuntu versions DPDK support.

Pawel

#3 lore raw
Quoted 11 lines · PawelX
Quoted 6 lines

lib/librte_eal/linuxapp/kni/Makefile MODULE_CFLAGS += -I$(RTE_OUTPUT)/include -I$(SRCDIR)/ethtool/ixgbe -I$(SRCDIR)/e · line 50

Quoted 6 lines
lib/librte_eal/linuxapp/kni/Makefile +1 -2
-UBUNTU_KERNEL_CODE := $(shell cut -d' ' -f2 /proc/version_signature | \
-                        cut -d'~' -f1 | cut -d- -f1,2 | tr .- $(comma))
+UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE

$(RTE_KERNELDIR)/include/generated/utsrelease.h \

lib/librte_eal/linuxapp/kni/Makefile +1 -0
+	 | cut -d '"' -f2 | cut -d- -f1,2 | tr .- $(comma)`,1)

It is fine for me if it do the job and does not break build on other OS (also other Ubuntu versions especially 12.04 if we still support it).
Please only check if UTS_RELEASE is available on all Ubuntu versions DPDK support.

Quoted 1 line

From some digging, it appears it entered the kernel tree in 2006 and

moved to include/generated/ in 2009 so I guess that should be fine for DPDK builds?

// Simon

#4 lore raw
Quoted 20 lines

-----Original Message-----
From: Simon Kågström [mailto:[email protected]]
Sent: Thursday, May 28, 2015 12:37 PM
To: Wodkowski, PawelX; Zhang, Helin; Alexander Guy; Julien Cretin; Buriez, Patrice
Cc: [email protected]
Subject: Re: [PATCH] kni: Use utsrelease.h to determine Ubuntu kernel version

Quoted 10 lines · PawelX
Quoted 6 lines

lib/librte_eal/linuxapp/kni/Makefile MODULE_CFLAGS += -I$(RTE_OUTPUT)/include -I$(SRCDIR)/ethtool/ixgbe -I$(SRCDIR)/e · line 50

Quoted 6 lines
lib/librte_eal/linuxapp/kni/Makefile +1 -2
-UBUNTU_KERNEL_CODE := $(shell cut -d' ' -f2 /proc/version_signature | \
-                        cut -d'~' -f1 | cut -d- -f1,2 | tr .- $(comma))
+UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE

$(RTE_KERNELDIR)/include/generated/utsrelease.h \

lib/librte_eal/linuxapp/kni/Makefile +1 -0
+	 | cut -d '"' -f2 | cut -d- -f1,2 | tr .- $(comma)`,1)

It is fine for me if it do the job and does not break build on other OS (also other Ubuntu versions especially 12.04 if we still support it).
Please only check if UTS_RELEASE is available on all Ubuntu versions DPDK

Quoted 7 lines

support.

From some digging, it appears it entered the kernel tree in 2006 and moved to include/generated/ in 2009 so I guess that should be fine for DPDK builds?

// Simon

I also think that it is OK but I also think should check by building you (o ask someone to do it for you) on those systems not by theory :)

Signature · 1 line
Pawel
#5 lore raw

Hi all,
Please forgive top reply and bottom disclaimer.
Not sure anyway that this email will reach the mailing list, since I did not subscribe to it.

I am worried about the removal of: cut -d'~' -f1
It was introduced by Pawel in commit 35170c52d0ae33dc30e69bcf681e5a17168bf11e
http://dpdk.org/browse/dpdk/commit/lib/librte_eal/linuxapp/kni/Makefile?id=35170c52d0ae33dc30e69bcf681e5a17168bf11e
in order to fix the parsing of: 3.11.0-15.25~precise1-generic
Not sure what utsrelease.h would contain in this specific case, but removal of ~precise1-generic is broken with this recent patch.

Regards,
Patrice

-----Original Message-----
From: Wodkowski, PawelX
Sent: Thursday, May 28, 2015 12:48 PM
To: Simon Kågström; Zhang, Helin; Alexander Guy; Julien Cretin; Buriez, Patrice
Cc: [email protected]
Subject: RE: [PATCH] kni: Use utsrelease.h to determine Ubuntu kernel version

Quoted 21 lines

-----Original Message-----
From: Simon Kågström [mailto:[email protected]]
Sent: Thursday, May 28, 2015 12:37 PM
To: Wodkowski, PawelX; Zhang, Helin; Alexander Guy; Julien Cretin; Buriez, Patrice
Cc: [email protected]
Subject: Re: [PATCH] kni: Use utsrelease.h to determine Ubuntu kernel version

Quoted 11 lines · PawelX
Quoted 6 lines

lib/librte_eal/linuxapp/kni/Makefile MODULE_CFLAGS += -I$(RTE_OUTPUT)/include -I$(SRCDIR)/ethtool/ixgbe -I$(SRCDIR)/e · line 50

Quoted 6 lines
lib/librte_eal/linuxapp/kni/Makefile +1 -2
-UBUNTU_KERNEL_CODE := $(shell cut -d' ' -f2 /proc/version_signature | \
-                        cut -d'~' -f1 | cut -d- -f1,2 | tr .- $(comma))
+UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE

$(RTE_KERNELDIR)/include/generated/utsrelease.h \

lib/librte_eal/linuxapp/kni/Makefile +1 -0
+	 | cut -d '"' -f2 | cut -d- -f1,2 | tr .- $(comma)`,1)

It is fine for me if it do the job and does not break build on other OS (also other Ubuntu versions especially 12.04 if we still support it). Please only check if UTS_RELEASE is available on all Ubuntu versions DPDK

Quoted 7 lines

support.

From some digging, it appears it entered the kernel tree in 2006 and moved to include/generated/ in 2009 so I guess that should be fine for DPDK builds?

// Simon

I also think that it is OK but I also think should check by building you (o ask someone to do it for you) on those systems not by theory :)

--
Pawel

Intel Corporation NV/SA
Kings Square, Veldkant 31
2550 Kontich
RPM (Bruxelles) 0415.497.718.
Citibank, Brussels, account 570/1031255/09

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

#6 lore raw
Quoted 10 lines

-----Original Message-----
From: Buriez, Patrice
Sent: Thursday, May 28, 2015 1:07 PM
To: Wodkowski, PawelX; Simon Kågström; Zhang, Helin; Alexander Guy; Julien Cretin
Cc: [email protected]
Subject: RE: [PATCH] kni: Use utsrelease.h to determine Ubuntu kernel version

Quoted 7 lines

Hi all,
Please forgive top reply and bottom disclaimer.
Not sure anyway that this email will reach the mailing list, since I did not subscribe to it.

I am worried about the removal of: cut -d'~' -f1 It was introduced by Pawel in commit

You are absolutely right. That is why I asked to check with documentation and to verify with real build on all supported Ubuntu versions. :)

Signature · 1 line
Pawel
#7 lore raw
In reply to Wodkowski, PawelX
Quoted 9 lines · PawelX
Quoted 6 lines
Quoted 1 line

Please only check if UTS_RELEASE is available on all Ubuntu versions DPDK

support.

From some digging, it appears it entered the kernel tree in 2006 and moved to include/generated/ in 2009 so I guess that should be fine for DPDK builds?

I also think that it is OK but I also think should check by building you (o ask someone to do it for you) on those systems not by theory :)

Well, I think this is one of the main motivations from something like what Thomas F. Herbert proposed in another thread recently,

DPDK: Proposal for a patch patch-test integration tree

basically, a continuous-integration-type of system should test-build (and probably test) any prospective patch to see that it builds for various targets. In my view, this would be a perfect match for github+travis-ci.

Anyway, I'll see if I can dig up an older Ubuntu to build on, unless someone else steps up and tests the patch. (My issue to start with was that the build fails on a 14.04 chroot on a 12.04 host, but I only have access to the chroot there).

// Simon

#8 lore raw
In reply to Simon Kagstrom

This ugly and fast becoming unmaintainable and ridiculous.

KNI needs to get out of being a bunch of out of tree code chasing the kernel API tail lights
and become something stable and submitted upstream.

Quoted 38 lines · Simon Kagstrom

/proc/version_signature is the version for the host machine, but in e.g., chroots, this does not need to match that DPDK is built for. Use utsrelease.h from the kernel sources instead and fake the upload version.

---
 lib/librte_eal/linuxapp/kni/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/librte_eal/linuxapp/kni/Makefile +3 -6
index fb673d9..ac99d3f 100644
@@ -44,10 +44,10 @@ MODULE_CFLAGS += -I$(RTE_OUTPUT)/include
-I$(SRCDIR)/ethtool/ixgbe -I$(SRCDIR)/e
 MODULE_CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h
 MODULE_CFLAGS += -Wall -Werror
 
-ifeq ($(shell test -f /proc/version_signature && lsb_release -si
 2>/dev/null),Ubuntu)
+ifeq ($(shell lsb_release -si 2>/dev/null),Ubuntu)
 MODULE_CFLAGS += -DUBUNTU_RELEASE_CODE=$(shell lsb_release -sr | tr -d .)
-UBUNTU_KERNEL_CODE := $(shell cut -d' ' -f2 /proc/version_signature | \
-                        cut -d'~' -f1 | cut -d- -f1,2 | tr .- $(comma))
+UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE
 $(RTE_KERNELDIR)/include/generated/utsrelease.h \
+        | cut -d '"' -f2 | cut -d- -f1,2 | tr .- $(comma)`,1)
 MODULE_CFLAGS +=
-D"UBUNTU_KERNEL_CODE=UBUNTU_KERNEL_VERSION($(UBUNTU_KERNEL_CODE))"
 endif
 
--

1.9.1

#9 lore raw
In reply to Simon Kagstrom

2015-05-27 13:45, Simon Kagstrom:

Quoted 4 lines

/proc/version_signature is the version for the host machine, but in e.g., chroots, this does not need to match that DPDK is built for. Use utsrelease.h from the kernel sources instead and fake the upload version.

Sorry, I don't really understand the problem.
Do you mean that /proc/version_signature is not readable from the chroot? Or do you mean that the /proc in the chroot is the host one and it doesn't match the OS installed in the chroot?

Please precise which case you try to solve and which tests you did with which Ubuntu versions?

#10 lore raw

2015-06-16 23:09, Thomas Monjalon:

Quoted 6 lines

2015-05-27 13:45, Simon Kagstrom:

Quoted 4 lines

/proc/version_signature is the version for the host machine, but in e.g., chroots, this does not need to match that DPDK is built for. Use utsrelease.h from the kernel sources instead and fake the upload version.

Quoted 7 lines

Sorry, I don't really understand the problem.
Do you mean that /proc/version_signature is not readable from the chroot? Or do you mean that the /proc in the chroot is the host one and it doesn't match the OS installed in the chroot?

Please precise which case you try to solve and which tests you did with which Ubuntu versions?

The issue is still not clearly described.
Closed in patchwork.