Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3723191pxf; Mon, 29 Mar 2021 09:37:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyoIzRbs92ANm/zYLp8OIOaTQpSlQLJT82eFws5cv4Hwa1chst9/SuZcCck7mh1p7VBglX X-Received: by 2002:a17:906:14d4:: with SMTP id y20mr29378351ejc.190.1617035865283; Mon, 29 Mar 2021 09:37:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1617035865; cv=pass; d=google.com; s=arc-20160816; b=SjHI2iEQqYEaWKvX9QaZSIVs3RGfIoHCXm7Z02EuS10VaVRqHK9qTnkF56rUWTevSD XOp3bOwL8X/xvbgiEIxys+kNqRk2TUUOTM15MHv0U3LNs02NxEFmZ5KVVsVdZcF3rW6q aMFM0XqMHoQ/cAC/J4fW8/uMoNVjfF1pwouI9wpk4VKofwKtiQ0ZufruGgpLvj4rcAYp VqpGrO5SBfmuL1HjhiBuhAQE6XaSrD8TARnbx5CWHBOMx6FQ2YpjV9bDM8WJGPlzUPx6 91CSoP3SJQHZXT8e5E/5GdmlEwvDvqomlvDXTwNtlp5Th3EpmMA6NQcG4VMGCrrx9/SI Ha6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=XiXjkavEul61MVJ/8hyeE+4L+cvRmfekiUQZc4/FDqY=; b=eg+5JISR35SVd1uKPG/2kyL0HMNPcKwvcEdXwjSNuy/2o48ST4/NsqJvry91osJ4qL tt/U2kmmqY6it4TpWqd+SMy3+May4nhou7wjdEQmSlCBK7IEcctu8+JCeqa8smAUO+H1 FojRxlJ5jfYDCdXl2ShBR6Zq6NcYSkcX2E4niXsZU/FHKNwZhyvS78uO2OmbzBLvuv9g FoHPvsd8Q1sfqhrIM6qE7EbxY0gIXXGK6sTTtGW4Lr3CfZQmcnx5/YaNXPbNYRCMryrX zG75fLOCS5n7oMFDzgT1euaezS+DTkxj8UzZlQV6nuUElbIXlq36zGFJ0RQEbcZ1zkbs d2lw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=VQttJDZH; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); 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=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m15si7980178ejx.443.2021.03.29.09.37.22; Mon, 29 Mar 2021 09:37:45 -0700 (PDT) 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=@fb.com header.s=facebook header.b=VQttJDZH; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); 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=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231213AbhC2QeI (ORCPT + 99 others); Mon, 29 Mar 2021 12:34:08 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:20400 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231134AbhC2Qdg (ORCPT ); Mon, 29 Mar 2021 12:33:36 -0400 Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12TGPLOG025504; Mon, 29 Mar 2021 09:28:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=facebook; bh=XiXjkavEul61MVJ/8hyeE+4L+cvRmfekiUQZc4/FDqY=; b=VQttJDZHNTM1+DGVCVdp0r1wy1mL0C/QV8qsSAHudVX6HszwAGKX/uiVkmA4WUWAvIBD neQFq5UUlc4AoxbhZ5KAmqw2pgtoR+bliGGGELhcLbyM6x3aPgG4mgaCVPTyfrDrmefw iCHNWpN3QD3FQ+P5Qtj0IPuqs+8MlDUbUIo= Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com with ESMTP id 37kdyt1h4f-15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 29 Mar 2021 09:28:22 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (100.104.98.9) by o365-in.thefacebook.com (100.104.94.230) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 29 Mar 2021 09:28:20 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jnA+8QSKooKa2xWT01CVlQ3K2SV50rteuPi1MknZp0dXsDMflPIo/PrRq8vFNq8G8WYD7Hh/Xx/62BHhg3oRHM6R2K3IyCk0ivouN5MEqyT9OPrXGecmrThi8rk/s0XqdsOGp1Vtp63vEdN/SLbXUGbuesR0Hmos9OK30Db7tHxdCE/GDhSA5huuqUdVzYXUTOp8XhvqjzDAq+GwiElXdYKDTRFZ8de5PwpYpENolhBCbz5apn+i6dtkUvDz8p40CaRRUXysQW6ZolN9/Pk5vnno4/3jyN3pzlwdqLjK9eUE2pjZWWOgSdAXSJcDk+BdfsM8GtM+RS1ne9oVmGr9iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XiXjkavEul61MVJ/8hyeE+4L+cvRmfekiUQZc4/FDqY=; b=m6aW2uY44N8MPJYaxDiE5/UmLcvlqOMDjjarpBDYzM9kdWRnrmQp6/p6airmq5en5G7dGlnDVd3R0it+S8/jm4Kf4U8cqZJ34x3AhL50KslbytVVGkdIAeP1ixEgBMs4NffFuGGlsiU9b8ioddnFmr1SpWemehKY7egy4Vb4NcbmpOmPL26pJ8o8xQoAu+937MMxaSlIfrKC30pUqEV2wsoWgrIq7CvhDv38VyrCzQhoNkzlG6Ovd3FN92iqpT7wIYf000V08PBcXbA7vvJgi5OArQgObZU1jmtVpLx7+Vegj65Vj1CDcz/EbrtJpFG8wARM4l58fFEy968+zslyGg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fb.com; dmarc=pass action=none header.from=fb.com; dkim=pass header.d=fb.com; arc=none Received: from BYAPR15MB2999.namprd15.prod.outlook.com (2603:10b6:a03:fa::12) by SJ0PR15MB4680.namprd15.prod.outlook.com (2603:10b6:a03:37d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.24; Mon, 29 Mar 2021 16:28:18 +0000 Received: from BYAPR15MB2999.namprd15.prod.outlook.com ([fe80::1ce0:8b27:f740:6b60]) by BYAPR15MB2999.namprd15.prod.outlook.com ([fe80::1ce0:8b27:f740:6b60%4]) with mapi id 15.20.3933.039; Mon, 29 Mar 2021 16:28:18 +0000 From: Song Liu To: Pedro Tammela CC: Pedro Tammela , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin Lau , Yonghong Song , John Fastabend , KP Singh , Shuah Khan , Joe Stringer , Quentin Monnet , Yang Li , "netdev@vger.kernel.org" , "bpf@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-kselftest@vger.kernel.org" Subject: Re: [PATCH bpf-next] libbpf: Add '_wait()' and '_nowait()' macros for 'bpf_ring_buffer__poll()' Thread-Topic: [PATCH bpf-next] libbpf: Add '_wait()' and '_nowait()' macros for 'bpf_ring_buffer__poll()' Thread-Index: AQHXI+03ORNntXupUk6L4u8Dfh+Z4qqbKTIA Date: Mon, 29 Mar 2021 16:28:18 +0000 Message-ID: References: <20210328161055.257504-1-pctammela@mojatatu.com> <20210328161055.257504-3-pctammela@mojatatu.com> In-Reply-To: <20210328161055.257504-3-pctammela@mojatatu.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3654.60.0.2.21) authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=fb.com; x-originating-ip: [2620:10d:c090:400::5:876e] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c796a977-2139-4a57-a461-08d8f2cfa96a x-ms-traffictypediagnostic: SJ0PR15MB4680: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-fb-source: Internal x-ms-oob-tlc-oobclassifiers: OLM:3968; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: r1YupgcawPwb/kGQbKJL7eNXbmsFU6c2zutI9TKasNR6ZxTyQGAiwDDjgMy53bGi63deMl8qC100wN7Eitcf28WYVsx/8H6d0WbQfKE2duu0nmtKJ1XU8Mk/CVkpjYgzfGAPMOYyxc0fYJU8/4C3JoZpciNjMbiMeYXsUb2fbODDcxygFvTtzmjGkZZW6zEJm1Nn7VehqCRwc8IuE7bdQscr9D/Di8JS8R2sYj8y1a173ny4ufSMdzc1ASsMyiwaxn3UuBFE2NtHxPuwZTucniNqDNFXIxD3fFdDqcblSMfVS7lD3U8xXxjMACmeqtuh7eUMhMQKeD+t6Sj41KN8VTEOCscaY4FTI2tLkQ0AsJ0lMi/oL6W1EMT+fVcZcvNLVmpy48N2xsYj0TyBBPMWh0YQOrHoYB2OlpsydGhMiSUugjs8jKB+Y1Qc6PjiBmJI1IsOwYFcB71eBYcV7gq99feRTm8OIW5R+dSyruefVmvQc83P8s9LbxVswQpcTsVZkd5TtIjUXmcdKO4as9LscY/yr/Jkzrlyz7Sy3PTFT/jA6w9H6LUkj+stVbiZh5kOS+MgS1a97RiWCPpqvqa3jjlYGdG7RJWVKMiTu8zvsju/1Xc0rvskH2YnhqkwNdcyp0RgM9uS3dPqni0A2hBLNhq/EqQDKZuz4gWM3BPCg0fMOsfpr+1AiOW3k1wsaN6XkjlSSwvMHi83VCDzSBj1vEZxJ/zrd5F7TiRo41+s9cA= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR15MB2999.namprd15.prod.outlook.com;PTR:;CAT:NONE;SFS:(136003)(366004)(376002)(39860400002)(346002)(396003)(33656002)(54906003)(316002)(5660300002)(66946007)(2616005)(4326008)(6916009)(71200400001)(186003)(6486002)(478600001)(83380400001)(7416002)(6512007)(38100700001)(86362001)(8936002)(66556008)(2906002)(66476007)(6506007)(64756008)(66446008)(53546011)(76116006)(8676002)(36756003)(101420200003)(45980500001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?eFMOLdSIUdrwCegIF9c6gkMVt//TTgrNFJIiUwc5D66F+FRosnDGCtUMSy52?= =?us-ascii?Q?AHQdiZbggwW783AIM171+UP2x45Kp7c11oo4TL+sTw7pdrFTIfo8GWRz/tzb?= =?us-ascii?Q?gUirXJbab0OwDbYqeKgAYXU0vM4WLMOrJxuxq92lMTIoyZu5YlmaDusvt0DR?= =?us-ascii?Q?KdtCONtgIpED8gfebmekyYfjn2dMyaKU/LU0CvIojQ0nEvTh2UXdOtsNoIJP?= =?us-ascii?Q?imo9iKvvPZ8Ds2hE7qbkFdON4L/G2SfjOz7nIZi2ukMGRL86KpiixVB/w/+6?= =?us-ascii?Q?6YQkPsSVL0qpRh262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7horsTnDdD?= =?us-ascii?Q?lRg6EhmJbw/Y4Rfevr9rH12rZgeERDMqg86bmcc/2dl7DST7eIYW3jJm84Tp?= =?us-ascii?Q?NJF+Xw+ZukmOSthtm/lsy5AZLfTJROOP5TU/kyxWEagG4rXjSwF6RpCfW2i5?= =?us-ascii?Q?GEJHUK06idw+PyfqDcJXfb/yCBKnw3++A/sRrcuM74SS/Lnmmn/JA4E57MY4?= =?us-ascii?Q?O8X968k=3D?= Content-Type: text/plain; charset="us-ascii" Content-ID: <2C97E86928BA2049A6E95A74BA4ECA8F@namprd15.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR15MB2999.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c796a977-2139-4a57-a461-08d8f2cfa96a X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2021 16:28:18.6246 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: eEMzW4hXWG99WAQrlLnbkmR5XjLlraYFXkQoY/h75b49zSChEGm4aVOcSKnWPY46iALNqLvMYXOtoC3+g+tZzQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR15MB4680 X-OriginatorOrg: fb.com X-Proofpoint-GUID: x7958uYfxtXFtYJg_IYqIzE1DFTdvEBD X-Proofpoint-ORIG-GUID: x7958uYfxtXFtYJg_IYqIzE1DFTdvEBD X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-29_10:2021-03-26,2021-03-29 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 priorityscore=1501 malwarescore=0 mlxscore=0 bulkscore=0 clxscore=1015 phishscore=0 mlxlogscore=999 impostorscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103290121 X-FB-Internal: deliver Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Mar 28, 2021, at 9:10 AM, Pedro Tammela wrote: >=20 > 'bpf_ring_buffer__poll()' abstracts the polling method, so abstract the > constants that make the implementation don't wait or wait indefinetly > for data. >=20 > Signed-off-by: Pedro Tammela > --- > tools/lib/bpf/libbpf.h | 3 +++ > tools/testing/selftests/bpf/benchs/bench_ringbufs.c | 2 +- > tools/testing/selftests/bpf/prog_tests/ringbuf.c | 6 +++--- > tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c | 4 ++-- > 4 files changed, 9 insertions(+), 6 deletions(-) >=20 > diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h > index f500621d28e5..3817d84f91c6 100644 > --- a/tools/lib/bpf/libbpf.h > +++ b/tools/lib/bpf/libbpf.h > @@ -540,6 +540,9 @@ 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(const struct ring_buffer *rb); >=20 > +#define ring_buffer__poll_wait(rb) ring_buffer__poll(rb, -1) > +#define ring_buffer__poll_nowait(rb) ring_buffer__poll(rb, 0) I think we don't need ring_buffer__poll_wait() as ring_buffer__poll() alrea= dy=20 means "wait for timeout_ms".=20 Actually, I think ring_buffer__poll() is enough. ring_buffer__poll_nowait()= =20 is not that useful either.=20 Thanks, Song