Message ID | 20230127135755.79929-18-mathieu.desnoyers@efficios.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp848911wrn; Fri, 27 Jan 2023 06:03:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXv/ljVNmi8yWBbe+38AGGhkavx08rGXGDrbWQ2f56m7QzmdbXzy3rHK9dekjZmVNfOLqADi X-Received: by 2002:a17:902:8498:b0:194:4724:806d with SMTP id c24-20020a170902849800b001944724806dmr36740142plo.33.1674828206324; Fri, 27 Jan 2023 06:03:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674828206; cv=none; d=google.com; s=arc-20160816; b=r/Oe+X2KRVHWq2MqsCSYj48jftfkeb3p5rQCc1NKE1JoaeeonUogzBGit1tnwz3YEg E7LQ4QqngldRqu1Fa07HJZCHorb93LU3AriYQ0sVOI9VudTch9mftn3Y/y6xsJBHaZni BwEVdh6KykuCWvOUg/ycVAWquBiHqkIfD5WPwLHnG66Yps/vPE24DU05Sk4ZXKb3UMnV dizyqSCY0WV7C1c/qAX0VSTmjNsHhI9yEMPt3+zx1Z5UzPwqXPGRZjyIwforC0vCnfYY 1eNkdJI1jAlOo3K6caCKyfb1KGxbFOicLXPN4MUeT3NENvUfNwwiMPhKso0BV49b7WoU TtJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6CleP35fxoEiU0ajTeGKWafhIRZKf9qtqIf1q/vai4o=; b=rPs4TwlvTTmnI38dbjYOjsvTPvTU5q5fF8QDtB+2KNHhMSmaPZ80nV+HgxLmqUDHYU xnkvHX3DR3kQRK70zQNz9NXbDZY0zko3HCZkx7kl5YbG0UoTyPVBn5iWUhw6awSaYy1O Hd+G00vt33Fi5AFp0rJewKaUqlvCZJ2DslzkPiEPB98suVDzFOwFegqfrdMigf52FcwR qckLe7uzKC9dzBSxaOdqwgVNukMQ8ZgmncB4ENXfyTYazIHHtw9oGd0uYTM4NSwX+WjH I+Dl8au2zr/5EN4i0uaeXhXYz+qkWuyxL87KU3v5L7Hl4Yp17BUhsOEKTllm5AOE+2Fw NbLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=hZDmL7dy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p5-20020a1709028a8500b00196390097d0si4315823plo.502.2023.01.27.06.03.03; Fri, 27 Jan 2023 06:03:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=hZDmL7dy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234564AbjA0N7F (ORCPT <rfc822;lekhanya01809@gmail.com> + 99 others); Fri, 27 Jan 2023 08:59:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233715AbjA0N6L (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 27 Jan 2023 08:58:11 -0500 Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68A3622012; Fri, 27 Jan 2023 05:58:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1674827884; bh=cTnlMtt/TSsCRchCKp67NRzjFc2OauBkH++SjQF+yLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hZDmL7dy7O2Ch69odJb+uxDN1ztpocAPZgbInxLegCpGkBT2uIve++5ALcSwFTrt6 H6VC1ypiyuQcIoiJCMtTBjzjLDU3MkYjKtmE44KbilAT2V0+KGaeGfVJ5h2XWAj0SO VNAxmOekgJ6exPS50DZMkInYwLF9ueZg4n4klwuHOEJI/5zu8trLaLIbYpkSmho7ll fOAK4W8jDIyBdrBZcSzVc/yGGZjvQx+l03PY3IAtWd6kOVeSvxxDAMOf/WMGBjIlua rO/atyofT5xpL0b02JWBfoeAMhhoJmo4f7tI9eedYMbz7ORHsfTRDxUG5gUyq60+dk fkoavG7xVcpig== Received: from localhost.localdomain (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4P3K0X5QMGzhxV; Fri, 27 Jan 2023 08:58:04 -0500 (EST) From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> To: Shuah Khan <shuah@kernel.org>, linux-kselftest@vger.kernel.org, Ingo Molnar <mingo@redhat.com> Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, stable@vger.kernel.org Subject: [PATCH 17/34] selftests: net: Fix incorrect kernel headers search path Date: Fri, 27 Jan 2023 08:57:38 -0500 Message-Id: <20230127135755.79929-18-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127135755.79929-1-mathieu.desnoyers@efficios.com> References: <20230127135755.79929-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RDNS_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756184661549613324?= X-GMAIL-MSGID: =?utf-8?q?1756184661549613324?= |
Series |
selftests: Fix incorrect kernel headers search path
|
|
Commit Message
Mathieu Desnoyers
Jan. 27, 2023, 1:57 p.m. UTC
Use $(KHDR_INCLUDES) as lookup path for kernel headers. This prevents
building against kernel headers from the build environment in scenarios
where kernel headers are installed into a specific output directory
(O=...).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org
Cc: Ingo Molnar <mingo@redhat.com>
Cc: <stable@vger.kernel.org> [5.18+]
---
tools/testing/selftests/net/Makefile | 2 +-
tools/testing/selftests/net/bpf/Makefile | 2 +-
tools/testing/selftests/net/mptcp/Makefile | 2 +-
tools/testing/selftests/net/openvswitch/Makefile | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
Comments
Hi Mathieu, On 27/01/2023 14:57, Mathieu Desnoyers wrote: > Use $(KHDR_INCLUDES) as lookup path for kernel headers. This prevents > building against kernel headers from the build environment in scenarios > where kernel headers are installed into a specific output directory > (O=...). Thank you for the patch! > Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> > Cc: Shuah Khan <shuah@kernel.org> > Cc: linux-kselftest@vger.kernel.org > Cc: Ingo Molnar <mingo@redhat.com> > Cc: <stable@vger.kernel.org> [5.18+] (It might be useful to add a "Fixes" tag as well to clearly indicate the dependence with a specific commit and better understand the fix.) (and add all the individual maintainers of the files you modify -- feel free to use 'b4' to help you for this task ;-) ) (...) > diff --git a/tools/testing/selftests/net/mptcp/Makefile b/tools/testing/selftests/net/mptcp/Makefile > index 43a723626126..06bba013bcef 100644 > --- a/tools/testing/selftests/net/mptcp/Makefile > +++ b/tools/testing/selftests/net/mptcp/Makefile > @@ -2,7 +2,7 @@ > > top_srcdir = ../../../../.. > > -CFLAGS = -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES) > +CFLAGS = -Wall -Wl,--no-as-needed -O2 -g $(KHDR_INCLUDES) I only looked at the modification here with MPTCP selftests and it looks good to me. It makes sense because if KHDR_INCLUDES is not set, it will be set later by lib.mk I suppose. Just one small thing: I guess you can also remove "top_srcdir" variable that is no longer used, right? I see that "lib.mk" uses a variable with the same name but it overrides its value anyway. But it is likely I missed something there :) If indeed it is no longer needed, I guess a few Makefile can be adapted according to: git grep top_srcdir -- tools/testing/selftests/*/ I guess most of these Makefile are very similar, no? For MPTCP, we simply looked at what was done elsewhere :) Cheers, Matt
On 2023-01-27 11:21, Matthieu Baerts wrote: > Hi Mathieu, > > On 27/01/2023 14:57, Mathieu Desnoyers wrote: >> Use $(KHDR_INCLUDES) as lookup path for kernel headers. This prevents >> building against kernel headers from the build environment in scenarios >> where kernel headers are installed into a specific output directory >> (O=...). > > Thank you for the patch! You're welcome :) > >> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> >> Cc: Shuah Khan <shuah@kernel.org> >> Cc: linux-kselftest@vger.kernel.org >> Cc: Ingo Molnar <mingo@redhat.com> >> Cc: <stable@vger.kernel.org> [5.18+] > > (It might be useful to add a "Fixes" tag as well to clearly indicate the > dependence with a specific commit and better understand the fix.) Just a bit of context: I found this problematic pattern in my own selftests (rseq and membarrier), and figured that it was an issue all across the board. I did an initial single-patch fix, and then split it up in 34 patches based on feedback from Shuah Khan. I know it should have a Fixed ... tag, but I simply don't have time to do the historical investigation work for all the 34 patches form this patchset. Perhaps someone else is up to the task ? > > (and add all the individual maintainers of the files you modify -- feel > free to use 'b4' to help you for this task ;-) ) If this can be automated, then perhaps Shuah can use it to append the relevant information ? > > (...) > >> diff --git a/tools/testing/selftests/net/mptcp/Makefile b/tools/testing/selftests/net/mptcp/Makefile >> index 43a723626126..06bba013bcef 100644 >> --- a/tools/testing/selftests/net/mptcp/Makefile >> +++ b/tools/testing/selftests/net/mptcp/Makefile >> @@ -2,7 +2,7 @@ >> >> top_srcdir = ../../../../.. >> >> -CFLAGS = -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES) >> +CFLAGS = -Wall -Wl,--no-as-needed -O2 -g $(KHDR_INCLUDES) > > I only looked at the modification here with MPTCP selftests and it looks > good to me. It makes sense because if KHDR_INCLUDES is not set, it will > be set later by lib.mk I suppose. > > Just one small thing: I guess you can also remove "top_srcdir" variable > that is no longer used, right? I see that "lib.mk" uses a variable with > the same name but it overrides its value anyway. But it is likely I > missed something there :) > > If indeed it is no longer needed, I guess a few Makefile can be adapted > according to: > > git grep top_srcdir -- tools/testing/selftests/*/ > Yes, this should perhaps come as additional fixes on top of my series. I don't have time to do it myself though. Anyone willing to contribute it ? > I guess most of these Makefile are very similar, no? For MPTCP, we > simply looked at what was done elsewhere :) Yes, I did likewise. Thanks for the feedback, Mathieu > > Cheers, > Matt
On 1/27/23 06:57, Mathieu Desnoyers wrote: > Use $(KHDR_INCLUDES) as lookup path for kernel headers. This prevents > building against kernel headers from the build environment in scenarios > where kernel headers are installed into a specific output directory > (O=...). > > Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> > Cc: Shuah Khan <shuah@kernel.org> > Cc: linux-kselftest@vger.kernel.org > Cc: Ingo Molnar <mingo@redhat.com> > Cc: <stable@vger.kernel.org> [5.18+] > --- > tools/testing/selftests/net/Makefile | 2 +- > tools/testing/selftests/net/bpf/Makefile | 2 +- > tools/testing/selftests/net/mptcp/Makefile | 2 +- > tools/testing/selftests/net/openvswitch/Makefile | 2 +- > 4 files changed, 4 insertions(+), 4 deletions(-) > Adding net maintainers: Would you me to take this patch through kselftest tree? If you decide to take this through yours: Acked-by: Shuah Khan <skhan@linuxfoundation.org> thanks, -- Shuah
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 3007e98a6d64..bab1222c7d50 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -2,7 +2,7 @@ # Makefile for net selftests CFLAGS = -Wall -Wl,--no-as-needed -O2 -g -CFLAGS += -I../../../../usr/include/ $(KHDR_INCLUDES) +CFLAGS += $(KHDR_INCLUDES) TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh \ rtnetlink.sh xfrm_policy.sh test_blackhole_dev.sh diff --git a/tools/testing/selftests/net/bpf/Makefile b/tools/testing/selftests/net/bpf/Makefile index 4abaf16d2077..207b6b958f66 100644 --- a/tools/testing/selftests/net/bpf/Makefile +++ b/tools/testing/selftests/net/bpf/Makefile @@ -7,7 +7,7 @@ BPFDIR := $(abspath ../../../lib/bpf) APIDIR := $(abspath ../../../include/uapi) CCINCLUDE += -I../../bpf -CCINCLUDE += -I../../../../../usr/include/ +CCINCLUDE += $(KHDR_INCLUDES) CCINCLUDE += -I$(SCRATCH_DIR)/include BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a diff --git a/tools/testing/selftests/net/mptcp/Makefile b/tools/testing/selftests/net/mptcp/Makefile index 43a723626126..06bba013bcef 100644 --- a/tools/testing/selftests/net/mptcp/Makefile +++ b/tools/testing/selftests/net/mptcp/Makefile @@ -2,7 +2,7 @@ top_srcdir = ../../../../.. -CFLAGS = -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES) +CFLAGS = -Wall -Wl,--no-as-needed -O2 -g $(KHDR_INCLUDES) TEST_PROGS := mptcp_connect.sh pm_netlink.sh mptcp_join.sh diag.sh \ simult_flows.sh mptcp_sockopt.sh userspace_pm.sh diff --git a/tools/testing/selftests/net/openvswitch/Makefile b/tools/testing/selftests/net/openvswitch/Makefile index 2f1508abc826..41ddfa9fdd1d 100644 --- a/tools/testing/selftests/net/openvswitch/Makefile +++ b/tools/testing/selftests/net/openvswitch/Makefile @@ -2,7 +2,7 @@ top_srcdir = ../../../../.. -CFLAGS = -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES) +CFLAGS = -Wall -Wl,--no-as-needed -O2 -g $(KHDR_INCLUDES) TEST_PROGS := openvswitch.sh