From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CD04C3A5A7 for ; Wed, 4 Sep 2019 12:19:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DEAB122CED for ; Wed, 4 Sep 2019 12:19:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbfIDMTK (ORCPT ); Wed, 4 Sep 2019 08:19:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46724 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727929AbfIDMTK (ORCPT ); Wed, 4 Sep 2019 08:19:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 950C510A8122; Wed, 4 Sep 2019 12:19:09 +0000 (UTC) Received: from astarta.redhat.com (ovpn-116-92.ams2.redhat.com [10.36.116.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3B58C6092D; Wed, 4 Sep 2019 12:19:08 +0000 (UTC) From: Yauheni Kaliuta To: Magnus Karlsson Cc: Magnus Karlsson , bpf , Network Development Subject: Re: [PATCH bpf 2/2] libbpf: remove dependency on barrier.h in xsk.h References: <1554792253-27081-1-git-send-email-magnus.karlsson@intel.com> <1554792253-27081-3-git-send-email-magnus.karlsson@intel.com> Date: Wed, 04 Sep 2019 15:19:06 +0300 In-Reply-To: (Magnus Karlsson's message of "Wed, 4 Sep 2019 12:25:13 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Wed, 04 Sep 2019 12:19:09 +0000 (UTC) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Hi, Magnus! >>>>> On Wed, 4 Sep 2019 12:25:13 +0200, Magnus Karlsson wrote: > On Wed, Sep 4, 2019 at 8:56 AM Yauheni Kaliuta > wrote: >> >> Hi, Magnus! >> >> >>>>> On Wed, 4 Sep 2019 08:39:24 +0200, Magnus Karlsson wrote: >> >> > On Wed, Sep 4, 2019 at 7:32 AM Yauheni Kaliuta >> > wrote: >> >> >> >> Hi, Magnus! >> >> >> >> >>>>> On Tue, 9 Apr 2019 08:44:13 +0200, Magnus Karlsson wrote: >> >> >> >> > The use of smp_rmb() and smp_wmb() creates a Linux header dependency >> >> > on barrier.h that is uneccessary in most parts. This patch implements >> >> > the two small defines that are needed from barrier.h. As a bonus, the >> >> > new implementations are faster than the default ones as they default >> >> > to sfence and lfence for x86, while we only need a compiler barrier in >> >> > our case. Just as it is when the same ring access code is compiled in >> >> > the kernel. >> >> >> >> > Fixes: 1cad07884239 ("libbpf: add support for using AF_XDP sockets") >> >> > Signed-off-by: Magnus Karlsson >> >> > --- >> >> > tools/lib/bpf/xsk.h | 19 +++++++++++++++++-- >> >> > 1 file changed, 17 insertions(+), 2 deletions(-) >> >> >> >> > diff --git a/tools/lib/bpf/xsk.h b/tools/lib/bpf/xsk.h >> >> > index 3638147..317b44f 100644 >> >> > --- a/tools/lib/bpf/xsk.h >> >> > +++ b/tools/lib/bpf/xsk.h >> >> > @@ -39,6 +39,21 @@ DEFINE_XSK_RING(xsk_ring_cons); >> >> > struct xsk_umem; >> >> > struct xsk_socket; >> >> >> >> > +#if !defined bpf_smp_rmb && !defined bpf_smp_wmb >> >> > +# if defined(__i386__) || defined(__x86_64__) >> >> > +# define bpf_smp_rmb() asm volatile("" : : : "memory") >> >> > +# define bpf_smp_wmb() asm volatile("" : : : "memory") >> >> > +# elif defined(__aarch64__) >> >> > +# define bpf_smp_rmb() asm volatile("dmb ishld" : : : "memory") >> >> > +# define bpf_smp_wmb() asm volatile("dmb ishst" : : : "memory") >> >> > +# elif defined(__arm__) >> >> > +# define bpf_smp_rmb() asm volatile("dmb ish" : : : "memory") >> >> > +# define bpf_smp_wmb() asm volatile("dmb ishst" : : : "memory") >> >> > +# else >> >> > +# error Architecture not supported by the XDP socket code in libbpf. >> >> > +# endif >> >> > +#endif >> >> > + >> >> >> >> What about other architectures then? >> >> > AF_XDP has not been tested on anything else, as far as I >> > know. But contributions that extend it to more archs are >> > very welcome. >> >> Well, I'll may be try to fetch something from barrier.h's >> (since I cannot consider myself as a specialist in the area), >> but at the moment the patch breaks the build on that arches. > Do you have a specific architecture in mind and do you have > some board/server (of that architecture) you could test AF_XDP > on? I do care about s390 and ppc64 and I can run tests for them. [...] -- WBR, Yauheni Kaliuta