[v4,1/2] config: correct cpu instruction set for cross build

Message ID 20231205035259.3516625-2-joyce.kong@arm.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series config changes for cross build |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Joyce Kong Dec. 5, 2023, 3:52 a.m. UTC
The platform value would be 'native' only when not cross build.
Move the operation about modifying cpu_instruction_set while
platform equals 'native' to the not cross build branch.

Fixes: bf66003b51ec ("build: use platform for generic and native builds")
Cc: stable@dpdk.org

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 config/meson.build | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
  

Comments

Stephen Hemminger Dec. 7, 2023, 10:41 p.m. UTC | #1
On Tue,  5 Dec 2023 03:52:58 +0000
Joyce Kong <joyce.kong@arm.com> wrote:

> The platform value would be 'native' only when not cross build.
> Move the operation about modifying cpu_instruction_set while
> platform equals 'native' to the not cross build branch.
> 
> Fixes: bf66003b51ec ("build: use platform for generic and native builds")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

Looks right, what is the impact on existing users doing current cross builds?

Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  
Joyce Kong Dec. 8, 2023, 2:51 a.m. UTC | #2
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Friday, December 8, 2023 6:41 AM
> To: Joyce Kong <Joyce.Kong@arm.com>
> Cc: thomas@monjalon.net; Ruifeng Wang <Ruifeng.Wang@arm.com>;
> bruce.richardson@intel.com; dev@dpdk.org; nd <nd@arm.com>;
> stable@dpdk.org
> Subject: Re: [PATCH v4 1/2] config: correct cpu instruction set for cross build
> 
> On Tue,  5 Dec 2023 03:52:58 +0000
> Joyce Kong <joyce.kong@arm.com> wrote:
> 
> > The platform value would be 'native' only when not cross build.
> > Move the operation about modifying cpu_instruction_set while platform
> > equals 'native' to the not cross build branch.
> >
> > Fixes: bf66003b51ec ("build: use platform for generic and native
> > builds")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> 
> Looks right, what is the impact on existing users doing current cross builds?

The original operation changes cpu_instruction_set to 'native' when both 'platform == native' and 'cpu_instruction_set == auto'.
There was no impact on the existing users for current cross build, as the cross files set cpu field to a specific arch, such as 'armv8-a', and this didn't trigger the modification for cpu_instruction_set.
However, if we want to use a common arch in cross files like 'auto', the modification operation would override 'native' value to cpu_instruction_set and b7676fcccab4 ("config: verify machine arch flag") would break the build as it tries to test -march=native.

> 
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  
Pavan Nikhilesh Bhagavatula Jan. 19, 2024, 7:39 p.m. UTC | #3
> -----Original Message-----
> From: Joyce Kong <Joyce.Kong@arm.com>
> Sent: Friday, December 8, 2023 8:21 AM
> To: Stephen Hemminger <stephen@networkplumber.org>
> Cc: thomas@monjalon.net; Ruifeng Wang <Ruifeng.Wang@arm.com>;
> bruce.richardson@intel.com; dev@dpdk.org; nd <nd@arm.com>;
> stable@dpdk.org
> Subject: [EXT] RE: [PATCH v4 1/2] config: correct cpu instruction set for cross
> build
> 
> External Email
> 
> ----------------------------------------------------------------------
> > -----Original Message-----
> > From: Stephen Hemminger <stephen@networkplumber.org>
> > Sent: Friday, December 8, 2023 6:41 AM
> > To: Joyce Kong <Joyce.Kong@arm.com>
> > Cc: thomas@monjalon.net; Ruifeng Wang <Ruifeng.Wang@arm.com>;
> > bruce.richardson@intel.com; dev@dpdk.org; nd <nd@arm.com>;
> > stable@dpdk.org
> > Subject: Re: [PATCH v4 1/2] config: correct cpu instruction set for cross
> build
> >
> > On Tue,  5 Dec 2023 03:52:58 +0000
> > Joyce Kong <joyce.kong@arm.com> wrote:
> >
> > > The platform value would be 'native' only when not cross build.
> > > Move the operation about modifying cpu_instruction_set while platform
> > > equals 'native' to the not cross build branch.
> > >
> > > Fixes: bf66003b51ec ("build: use platform for generic and native
> > > builds")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> > > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> >
> > Looks right, what is the impact on existing users doing current cross builds?
> 
> The original operation changes cpu_instruction_set to 'native' when both
> 'platform == native' and 'cpu_instruction_set == auto'.
> There was no impact on the existing users for current cross build, as the cross
> files set cpu field to a specific arch, such as 'armv8-a', and this didn't trigger
> the modification for cpu_instruction_set.
> However, if we want to use a common arch in cross files like 'auto', the
> modification operation would override 'native' value to cpu_instruction_set
> and b7676fcccab4 ("config: verify machine arch flag") would break the build
> as it tries to test -march=native.
> 
> >
> > Acked-by: Stephen Hemminger <stephen@networkplumber.org>

Tested-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
  
Thomas Monjalon March 6, 2024, 2:43 p.m. UTC | #4
> > > > The platform value would be 'native' only when not cross build.
> > > > Move the operation about modifying cpu_instruction_set while platform
> > > > equals 'native' to the not cross build branch.
> > > >
> > > > Fixes: bf66003b51ec ("build: use platform for generic and native
> > > > builds")
> > > > Cc: stable@dpdk.org
> > > >
> > > > Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> > > > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > >
> > > Looks right, what is the impact on existing users doing current cross builds?
> > 
> > The original operation changes cpu_instruction_set to 'native' when both
> > 'platform == native' and 'cpu_instruction_set == auto'.
> > There was no impact on the existing users for current cross build, as the cross
> > files set cpu field to a specific arch, such as 'armv8-a', and this didn't trigger
> > the modification for cpu_instruction_set.
> > However, if we want to use a common arch in cross files like 'auto', the
> > modification operation would override 'native' value to cpu_instruction_set
> > and b7676fcccab4 ("config: verify machine arch flag") would break the build
> > as it tries to test -march=native.
> > 
> > >
> > > Acked-by: Stephen Hemminger <stephen@networkplumber.org>
> 
> Tested-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

Applied without the second patch of the series, thanks.
  

Patch

diff --git a/config/meson.build b/config/meson.build
index a9ccd56deb..0f37bc733c 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -121,13 +121,14 @@  else
             cpu_instruction_set = 'generic'
         endif
     endif
+    if platform == 'native'
+        if cpu_instruction_set == 'auto'
+            cpu_instruction_set = 'native'
+        endif
+    endif
 endif
 
-if platform == 'native'
-    if cpu_instruction_set == 'auto'
-        cpu_instruction_set = 'native'
-    endif
-elif platform == 'generic'
+if platform == 'generic'
     if cpu_instruction_set == 'auto'
         cpu_instruction_set = 'generic'
     endif