From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id AC9F0F72 for ; Wed, 25 Jul 2018 11:25:04 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id s14-v6so5287453wmc.1 for ; Wed, 25 Jul 2018 02:25:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=vu+RaPVG4XSPFKESpTE1x321Wl2Q4MrEsAHQ4RJcsII=; b=TTIL5TOwM9e2KBglpRkfRUlX7aVIJ24EJX6NdLB45vLL8AEwEj+EKWfhe3NG5D4S6K I4KqcHKmRonz26Dse07OG53C+NZFfqfhvszKpBfRJ0qBvUijukm5zOpFC27JGR0sVu33 l3j290lm8KeaDVxgfqOrV1Jkv3iaEzhaDh6L7cxEw8S1KRytzGMgg3xR4VjXmTanY3Tu Jn0qjZIkZkcxyA0mehfjL48TFlBsOe7fsHUSsMwMVUrIgZ2j5ArocOrCFwf6oPUedHLZ MeU27jEWnaYglmV3GdS1/VLQxWrgbGNgtm1Lf7UnQUFDZbj8tzjqGFrS/Wgy8BBLi1k7 jJnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=vu+RaPVG4XSPFKESpTE1x321Wl2Q4MrEsAHQ4RJcsII=; b=MIPfsLgO9dq4o0MiFr18lTsTrlPK/k/7hHNoL43ufmoYPwzrqSKd1cZ70r8fMQvd3r yF3Vg+ZGb3ZuHtv5Xlc7dq9llDm6nyss/COYOYSz239d4v+nuguWSYdIJhEy0HIyAdxm +yp4mYT8/OYyDJ1xeDzXFz9LyV97hCiQ7/rLZHhTXBUGGgbvNixOttTkEfb1/kgZPmoj Ht0u09Yq+x2wNUvmhrW9WDWYVTSgPm6t0iC8hlZDqf+XoJBhIhSd5szH5jK57LdcA4Nm 4oR6ttraAFYV5KfruIIjaGuXp4U0AUZsgk9S4W6VxrGT3xhB/4v2H0Ku7P7Eb/JGwos3 XU7Q== X-Gm-Message-State: AOUpUlGxRolWRmqnw2xnkUbWU88d2U6lRpkWPEqKt4h7e/iT5vpZFrpd zgFI5aQxVCvK4rH27AWrdqpYIg== X-Google-Smtp-Source: AAOMgpcnk8taCGS4B8ZiRNipZnmeJpE6C/qRNMBMQ8YDubeQyrA1WfAyT9lCwfT65DDD6AdjBdm0vg== X-Received: by 2002:a1c:ec9d:: with SMTP id h29-v6mr4312653wmi.94.1532510704395; Wed, 25 Jul 2018 02:25:04 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id l11-v6sm13697214wru.25.2018.07.25.02.25.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 02:25:03 -0700 (PDT) Date: Wed, 25 Jul 2018 11:24:47 +0200 From: Adrien Mazarguil To: "Yaroslav Brustinov (ybrustin)" Cc: Shahaf Shuler , Yongseok Koh , "dev@dpdk.org" , "stable@dpdk.org" , =?utf-8?B?TsOpbGlv?= Laranjeiro , "Hanoch Haim (hhaim)" Message-ID: <20180725092447.GW5211@6wind.com> References: <20180724085445.52206-1-shahafs@mellanox.com> <20180724120048.GQ5211@6wind.com> <20180724120551.GR5211@6wind.com> <20180724160346.GU5211@6wind.com> <470558cc469c49f9b5c6454b5b6c54c0@XCH-ALN-002.cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <470558cc469c49f9b5c6454b5b6c54c0@XCH-ALN-002.cisco.com> Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix linkage error for glue lib X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jul 2018 09:25:04 -0000 On Wed, Jul 25, 2018 at 07:38:39AM +0000, Yaroslav Brustinov (ybrustin) wrote: > +Hanoch > > I've added -std=c11 flag to our compilation to check. > > Without alignas(max_align_t): > /usr/bin/ld: Warning: alignment 8 of symbol `mlx5_glue' in src/dpdk/drivers/net/mlx5/mlx5_glue.c.11.o is smaller than 32 in src/dpdk/drivers/net/mlx5/mlx5_rxq.c.11.o > > With alignas(max_align_t): > /usr/bin/ld: Warning: alignment 16 of symbol `mlx5_glue' in src/dpdk/drivers/net/mlx5/mlx5_glue.c.11.o is smaller than 32 in src/dpdk/drivers/net/mlx5/mlx5_rxq.c.11.o > > Using alignas(64) does not produce linker warning. OK, let's forget max_align_t. Even better, how about alignas(RTE_CACHE_LINE_SIZE) just in case the same GCC version complains about the lack of a 128 byte alignment on architectures like IBM POWER8. (remember to #include for RTE_CACHE_LINE_SIZE) > -----Original Message----- > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com] > Sent: Tuesday, July 24, 2018 19:04 > To: Yaroslav Brustinov (ybrustin) > Cc: Shahaf Shuler ; Yongseok Koh ; dev@dpdk.org; stable@dpdk.org; Nélio Laranjeiro > Subject: Re: [PATCH] net/mlx5: fix linkage error for glue lib > > On Tue, Jul 24, 2018 at 02:24:12PM +0000, Yaroslav Brustinov (ybrustin) wrote: > > Hi, > > > > Are you OK with C11? > > I saw in file dpdk/drivers/net/mlx4/mlx4_utils.c: > > > > * C11 code would include stdalign.h and use alignof(max_align_t) however > > * we'll stick with C99 for the time being. > > > > :) > > Hah, this code was originally intended to become a generic EAL function hence the C99 but got rejected. Mellanox PMDs otherwise rely on C11 features already. > > > As far as I understand, the issue is alignment of the pointer itself, not the struct. > > I'm not familiar with this command: "alignof(max_align_t)". > > Applying this on the struct: > > > > struct mlx5_glue { > > ... > > } __attribute__((__aligned__(64))); > > > > struct __attribute__((__aligned__(64))) mlx5_glue { > > ... > > }; > > > > ...still keeps the linker unhappy. > > Right, this was my first (wrong) suggestion that doesn't work on types. How about the second one instead? Here's how the diff on mlx5_glue.h should look > like: > > +#include > #include > #include > > [...] > > +alignas(max_align_t) > const struct mlx5_glue *mlx5_glue; > > Another comment regarding this patch, commit log should probably mention it addresses a GCC bug that cannot be reproduced with latter versions. Keep in mind DPDK recommends to use at least GCC version 4.9. > > > -----Original Message----- > > From: Shahaf Shuler [mailto:shahafs@mellanox.com] > > Sent: Tuesday, July 24, 2018 16:51 > > To: Adrien Mazarguil > > Cc: Yongseok Koh ; dev@dpdk.org; Yaroslav > > Brustinov (ybrustin) ; stable@dpdk.org; Nélio > > Laranjeiro > > Subject: RE: [PATCH] net/mlx5: fix linkage error for glue lib > > > > Yaroslav, > > > > Tuesday, July 24, 2018 3:06 PM, Adrien Mazarguil: > > > Subject: Re: [PATCH] net/mlx5: fix linkage error for glue lib > > > > Odd, how could this happen assuming both files are compiled during > > > > the same run using identical flags? Looks like a compiler issue. > > > > > > > > Anyway, may I suggest an alignment constraint on the structure > > > > type in mlx5_glue.h instead, so that all users inherit it. E.g. using C11 syntax: > > > > > > > > #include > > > > #include > > > > > > > > [...] > > > > alignas(max_align_t) > > > > struct mlx5_glue { > > > > [...] > > > > }; > > > > > > My bad, this is not a correct use for alignas(), it doesn't work on types. > > > How about this instead: > > > > > > alignas(max_align_t) > > > const struct mlx5_glue *mlx5_glue; > > > > Can you confirm the above suggestion fixes your issue? > > > > > > > > > > > -- > Adrien Mazarguil > 6WIND -- Adrien Mazarguil 6WIND