Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3599076pxu; Tue, 15 Dec 2020 10:38:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxO4nLAu39TveCpcUaDF9FM1e12Ne4X36AQPxTo+BsztqeocX4/S6EW/TQhG6VOeI+Ika/e X-Received: by 2002:a17:906:f0d0:: with SMTP id dk16mr28119514ejb.144.1608057525010; Tue, 15 Dec 2020 10:38:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608057525; cv=none; d=google.com; s=arc-20160816; b=q14ThvISys4mXEQktECch4c6BGEtAUxnFewJt4qgHpE7mh0d1Eey8peXA7x0CGNBzC +SQ4KKFhdppezpdNMfHhfS08LfPV3u6ETrguJBMFGn8vdSVksNH2CaeDYQUspbkjVTAR SEbYibNWYsmhTuPcaP9Z/vcvjm6t+KFT1o8mcubQO5xDKEpWa6Q5uxQc5D4LfWdMExaJ uLuCIZg2EKcnsMVP3pt1rZunLWYJNRfwk0AWpMk/Y3+SZe8zcX+Ehe88ugwxwxH9XlVM KcZ/uhBGeaGxMggxmoNRIXShyfGG9ZDgZSaAzR5gODynoAjSRQS654NeqRJutDcvLwTs EDmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=I1WWEUvnMjs5fUymJpL74+Mkojs1oxn/NtiIZL/uohY=; b=WMxCL07WbaQ5rSmilTim8KRVVfb/WDRMQV0LD32YutwOptnStYBzXwQrxxRJzxBWGY 8i+VzeTjCUyUtN/s18hP5YqOEVz3Ktj6VVec2HXLnTqnNMkqWOfYw5vTugRSE1mhARII mc7JA0EmB9/xVoXpU2PuooLdSPecYjQRcLFmuoJZdVCsIMf1JQ0CuCqBoa80XXVTSMhC mf3C88AH5dJ66xBE1Kwlw1QgYxp62zb3skdahc/V2ZLRaoQkdzIbzC6ifBGhdnZoy/g3 Rncuxi64DGMo8A3XplzCXVlpPm8O933xjh+VDE5+vQhnspqsBzm93C2bhmCTtQIUJQFo zdfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="lAR/gkid"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s23si1282951ejf.192.2020.12.15.10.38.17; Tue, 15 Dec 2020 10:38:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="lAR/gkid"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731614AbgLOSgX (ORCPT + 99 others); Tue, 15 Dec 2020 13:36:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731444AbgLOSgJ (ORCPT ); Tue, 15 Dec 2020 13:36:09 -0500 Received: from mail-yb1-xb41.google.com (mail-yb1-xb41.google.com [IPv6:2607:f8b0:4864:20::b41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E37AC0617A6; Tue, 15 Dec 2020 10:35:29 -0800 (PST) Received: by mail-yb1-xb41.google.com with SMTP id x2so19893179ybt.11; Tue, 15 Dec 2020 10:35:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=I1WWEUvnMjs5fUymJpL74+Mkojs1oxn/NtiIZL/uohY=; b=lAR/gkidY3WSAoyBwj/99CU/bROfG4oB6YtdT9F/qSbQb+wFQcZppSTgO5q5pIGINV P0cEoUBrko0baGhgqKAald4iGzEMyeCAYSyjUx9xlRjaI5dYmNagiX2cLewFTE1qd+0z hIJy4qfOAr+yGOKao/9bIDG1fBg3OY+vWf9Oy40jD5Yuue8WJhjld4OR4l7gIZbLqkY+ YJtlwPmW0ITh8miz7gnbkWz84syT0C9Wzhua8jiTh+QSGNnObCoRLEp97Q7hZ5Jk+8CS HpO2D3Argl9l5qPMKi3OnzXRm2L4xWbtehCypZa5Be2PJZES4IfjgUi4VBUWlng65mw8 8FUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=I1WWEUvnMjs5fUymJpL74+Mkojs1oxn/NtiIZL/uohY=; b=IRSgw8JhRas3hQRZyRWHRDooHC17EsmdBp31qKBvp3VcVs1/aMfNpY7wynHSYLbiPm cGVUmt1IkRPHE7vCNY1PR64sHbvDaHWL+0JjLonZORi8HUSWznCjWg+vT/DY5fNtKr+L Z1R0BmSYYIXEg765IUNTiZvL01uvi/scoRYW8NT3thzqIgZBG0GDJkru8nX8q94yEBTx ImJMX4fgliX8vpPeDLzny30Hlm0fdjwm/xS7a8LrMAc4yTsYjp7H3UNE8a2GOv8JvVoB rYOtX2a2oqlUPV723iGzY62IuGTCKDIq9V6lBFbRjHxAIOYlHuVKA3fPPQRhim92H9hE NQmQ== X-Gm-Message-State: AOAM530ufwhr/lV8QHVN/fXbkLNeIefhRH+DG6mGgPufOcFm+gSQ3g91 P3H8q3TS3qVc4PdkTg1+t1Ibd68uT6GDFmN60Ak= X-Received: by 2002:a25:4107:: with SMTP id o7mr2644943yba.459.1608057328878; Tue, 15 Dec 2020 10:35:28 -0800 (PST) MIME-Version: 1.0 References: <20201215121816.1048557-1-jackmanb@google.com> <20201215121816.1048557-3-jackmanb@google.com> In-Reply-To: <20201215121816.1048557-3-jackmanb@google.com> From: Andrii Nakryiko Date: Tue, 15 Dec 2020 10:35:18 -0800 Message-ID: Subject: Re: [PATCH bpf-next v2] libbpf: Expose libbpf ringbufer epoll_fd To: Brendan Jackman Cc: bpf , Alexei Starovoitov , Daniel Borkmann , KP Singh , Florent Revest , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 15, 2020 at 4:18 AM Brendan Jackman wrote: > > This provides a convenient perf ringbuf -> libbpf ringbuf migration > path for users of external polling systems. It is analogous to > perf_buffer__epoll_fd. > > Signed-off-by: Brendan Jackman > --- > Difference from v1: Added entry to libbpf.map. > I've already applied this yesterday as a4d2a7ad8683 ("libbpf: Expose libbpf ring_buffer epoll_fd"), no need to re-send. > tools/lib/bpf/libbpf.h | 1 + > tools/lib/bpf/libbpf.map | 1 + > tools/lib/bpf/ringbuf.c | 6 ++++++ > 3 files changed, 8 insertions(+) > > diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h > index 6909ee81113a..cde07f64771e 100644 > --- a/tools/lib/bpf/libbpf.h > +++ b/tools/lib/bpf/libbpf.h > @@ -536,6 +536,7 @@ LIBBPF_API int ring_buffer__add(struct ring_buffer *rb, int map_fd, > ring_buffer_sample_fn sample_cb, void *ctx); > LIBBPF_API int ring_buffer__poll(struct ring_buffer *rb, int timeout_ms); > LIBBPF_API int ring_buffer__consume(struct ring_buffer *rb); > +LIBBPF_API int ring_buffer__epoll_fd(struct ring_buffer *rb); > > /* Perf buffer APIs */ > struct perf_buffer; > diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map > index 7c4126542e2b..7be850271be6 100644 > --- a/tools/lib/bpf/libbpf.map > +++ b/tools/lib/bpf/libbpf.map > @@ -348,4 +348,5 @@ LIBBPF_0.3.0 { > btf__new_split; > xsk_setup_xdp_prog; > xsk_socket__update_xskmap; > + ring_buffer__epoll_fd; I've put this in the alphabetic order... > } LIBBPF_0.2.0; > diff --git a/tools/lib/bpf/ringbuf.c b/tools/lib/bpf/ringbuf.c > index 5c6522c89af1..45a36648b403 100644 > --- a/tools/lib/bpf/ringbuf.c > +++ b/tools/lib/bpf/ringbuf.c > @@ -282,3 +282,9 @@ int ring_buffer__poll(struct ring_buffer *rb, int timeout_ms) > } > return cnt < 0 ? -errno : res; > } > + > +/* Get an fd that can be used to sleep until data is available in the ring(s) */ > +int ring_buffer__epoll_fd(struct ring_buffer *rb) ... and also added const here, btw. > +{ > + return rb->epoll_fd; > +} > > base-commit: b4fe9fec51ef48011f11c2da4099f0b530449c92 > -- > 2.29.2.576.ga3fc446d84-goog >