Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3279665lfo; Mon, 23 May 2022 00:34:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9wbBF9GWbwTSGqQnZEfFkEQuyxRDi/9kL8DgQ2+dyI3tGK/mLxfzotaxvzFLTbzllXn9g X-Received: by 2002:a63:fc08:0:b0:3f9:e159:b114 with SMTP id j8-20020a63fc08000000b003f9e159b114mr10020763pgi.526.1653291240357; Mon, 23 May 2022 00:34:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1653291240; cv=pass; d=google.com; s=arc-20160816; b=0uUiDF8iCY3bZ+a6I13RF1x/ow0F9fbPnGoiQSOFnAU2tdXm0H5k/iVsnydhtYBMMY GJ+ECC5//YPZer5yNnlDFZYqjd5XyOXXzAsrjOdRcHFQsFz/5YCyluRv6Y4i1d6IndLv UEoo9ZQd4CkcQrQRcBvbZn7VeQj9AiJ1qoKYvAOVDwyBuT5iOTEiQrgvjtZPxjbMjqlD y+5jutuWIQq/tDF7mIoL/jB2gItXVw7+1801tkkT8jJbilczF7wDNXKWrBluKYNdDqqi 7FaMehGXVMsiC/gDj50pAOitoHFaRTinnugvQnIRtNKcJXpbU49Q2T7MyyG7WKtglSi7 yAhw== 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 :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=dKI6dQu6wjTQjbRSozjt86cO6m+HuXIEEDaxEzrfdXE=; b=jLGGhpIfhu8f3SdsjeCWQU7XjzUzSnWieZoCL9Xr8TpEn3IMxWZ/WTRNQlnwAMEzlS bDqnFecxKPZnJPSsJWBZ0Ke9sG1zT0b84jWrY/HZdFstBGL+gqspuv8hTZETfKPk19F3 xJN63aCGbo3wJ9DKPCMua+SFpPW+f4+cKQ6vFMrpMJNEb68NAE/j9+2PSN6xuMeaOKJE NDXnQPhdvShNtWgFPdmc+Z5QA3REp0TydQh/iQO1H2kpkd7Zs16j3HYQUihXV+U5jUsr DwhAOPEMoGoAW6+sksYZbw6XRQVdbdRfa1BAouAcoIOpaQtD0vZ3a8L3NCgcM3H/Ccp5 KABQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=cEVdlanj; 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 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q19-20020a170902bd9300b0015e89bf8982si8580215pls.261.2022.05.23.00.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:34:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=cEVdlanj; 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 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D7F671900EA; Sun, 22 May 2022 23:44:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350686AbiETPP2 (ORCPT + 99 others); Fri, 20 May 2022 11:15:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350684AbiETPPU (ORCPT ); Fri, 20 May 2022 11:15:20 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9528617706D; Fri, 20 May 2022 08:15:19 -0700 (PDT) Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24KC1rum017408; Fri, 20 May 2022 08:14:56 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=facebook; bh=dKI6dQu6wjTQjbRSozjt86cO6m+HuXIEEDaxEzrfdXE=; b=cEVdlanj8BCrlSJjXp/hdlknzURoKuEYi5hR/wOvfV//37i57MyLWD6iwdIXRh2xiOS7 d5fLd2EYENREr21SDkQMsIP6cX/+el7uklp4nqPe1f1L3P0yrUNTJkKZeKEy96Z1oD8c lgEbo1blFr+2IMn3PKUqv+kYwGFsrrlYHnM= Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3g5pj50c3a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 May 2022 08:14:55 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ABVPeFcTrVaHIHhat0uhsHaLo3ebCRApJoQiEA6HbXCookLkiMt5di7mm5Z1hwF/+Su34mC7uqiSeTJHBVabT5t45jIwIadTjH43qPhPFwS9Y4G75STNrzWAzBLed0oUQvw0X05esP6A1twASE0q5MXjaL+FkqJlW/5JuIXtfHI+iD9L8F1gH6Jo+mMBNobUIy5bTkJ+O+PuJUOv2SeIqoaBGcCc12hfF69+23nfmLbs6/4hICYPv7XzYeHg+gzFYeS53YqclUdBSNb9+Ckil0TJgN+cyV1kNZ1TzFd9jzPCuNRg9defOa2Yo+Lmqiy3teQTx/Dcm6XQ/+IgBeKa2Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dKI6dQu6wjTQjbRSozjt86cO6m+HuXIEEDaxEzrfdXE=; b=C90u9PlCVCyqTunEsbGgFs8BO+iA0SbiEMwSeFUpqHWPriZfOiOryeF7A/6MPwzrd1q9she0dNnvSTtDuVTKX+aLGU0CpQdyniYFtDt+wqsPCxJ14mvAqBRDkekfMG1jlWFomgvRqtQDuL1WyCyoX4ze5Cqu+4XYKo1chN/wQWJHzV1ZbVwtKKHH0a3u59b3NxZtJ16cp8sLvPWkTnudQTs5KUNFBUAsnxXGufV0mcxcCn67gmdWJ52PtKxY9UxbsWC7RYtpO9AAldUxPxeQ4ThJ8UrNSuJg84cvXt3XWoqbzcwaGd4ycTEYrqPSl4l8hDGiT20rF8pIL0YIzgOQjQ== 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 SN6PR1501MB2064.namprd15.prod.outlook.com (2603:10b6:805:d::27) by SA1PR15MB4532.namprd15.prod.outlook.com (2603:10b6:806:19b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.17; Fri, 20 May 2022 15:14:53 +0000 Received: from SN6PR1501MB2064.namprd15.prod.outlook.com ([fe80::5811:4996:bbfd:3c53]) by SN6PR1501MB2064.namprd15.prod.outlook.com ([fe80::5811:4996:bbfd:3c53%7]) with mapi id 15.20.5273.017; Fri, 20 May 2022 15:14:53 +0000 Message-ID: Date: Fri, 20 May 2022 08:14:50 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH bpf-next v1 2/5] cgroup: bpf: add cgroup_rstat_updated() and cgroup_rstat_flush() kfuncs Content-Language: en-US To: Yosry Ahmed , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , Hao Luo , Tejun Heo , Zefan Li , Johannes Weiner , Shuah Khan , Roman Gushchin , Michal Hocko Cc: Stanislav Fomichev , David Rientjes , Greg Thelen , Shakeel Butt , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, cgroups@vger.kernel.org References: <20220520012133.1217211-1-yosryahmed@google.com> <20220520012133.1217211-3-yosryahmed@google.com> From: Yonghong Song In-Reply-To: <20220520012133.1217211-3-yosryahmed@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BY3PR10CA0021.namprd10.prod.outlook.com (2603:10b6:a03:255::26) To SN6PR1501MB2064.namprd15.prod.outlook.com (2603:10b6:805:d::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6c46fa3f-7c8d-40dd-5aad-08da3a737e07 X-MS-TrafficTypeDiagnostic: SA1PR15MB4532:EE_ X-Microsoft-Antispam-PRVS: X-FB-Source: Internal X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k3pZk4MMLpjNkedYlpywNxtSmq0a54hHnHRTn43YTzeY3t2u0Od5UJCTSyi8soOdSF+HZvNCQaHQ7Oa77wynk/mHxd0f8DcvJzEYgfjEdajVrbRznnoniAaZZTb6TIiyYaBvumC/aKt/PhBAC4faPTRc/ROKbXhXCfvoH+lwzhU4+zHfaHQoSOIEUVe4bq9S17YiPttaY/qf1TiqAr2at0zfGGW5ePxgV4UOzWBuXsNr4Uyeaw3QN6nv9fJUaAtjBpp/so+qQO9xHt1gVuWfsOvu5b2senUSmJogrT6110MW+qS0Po+75zzeEm9YNHsUcMuZwnoutbfQaKXpmC124nKqxgzTUSmjIvg0xaAAZy6EvBMRuiJXI3ExCpgThRMiMItOGHbH9HGDxL2IJrvWy+eU4/oYs0NmerAltzfbbTy15tDvot1hyXwc6oitrOig76r/vXCc+ar5hWWE+MvWHKg7MY33d3trK6Vfq3HFFEGcNQY0G69H1Aymge5eg+UuSluO99dB/sWDX/+YGC+C4YdDCzakglIQ4An5KFgBS0hcUBf+w2nHWi0bCVsUsSGdgRPJwKXN6KlyjposLEC+eu4sy16aTmOU+UQU6q4gbUhEcMgeXfMcB/vGElJznpTf9U2NRVnuXM9S5FKZSPuh6v7m/5kYPdvxI0MEu+6GbbufcQl8qJZJj8Twq8Tpvp/0K0f21r67RI8THqVClp7+S2Vp4WKTAcuI7gb76w+JkkRYZYPlCE0kjg3izA+pqn1z X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR1501MB2064.namprd15.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(110136005)(86362001)(921005)(38100700002)(54906003)(4326008)(316002)(31696002)(66556008)(66946007)(66476007)(8676002)(2616005)(36756003)(8936002)(6506007)(2906002)(5660300002)(7416002)(508600001)(186003)(6512007)(31686004)(83380400001)(53546011)(6486002)(52116002)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QytOWFMyZkZRWWVtZW5GNzdlcm1lTk9taWtkNDJBd2I2VUtkUDUzb3poanM4?= =?utf-8?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ZWdjlQQkVTZDl0cVEzTWNIVUhBbmdrSHp1SEltdnNp?= =?utf-8?B?MCttK3hudWtLSUJkcjNPU29ZQno1RklLZ1dKb0VTc01Semx6N3lMYVJUUCs3?= =?utf-8?B?ei9hTFFvSGw0UkxWSld0S2FlKzJMSUxLUzRDM1NsQ1lzbzJRalRQZW1zWG1j?= =?utf-8?B?ZjdpdEN1bFk4KzJSalNGelFyVmdkNHBsUU9GOXFlUnVtc29GUVFKWnF6MTEy?= =?utf-8?B?bkNSV3N5eWZ1ZCtWSUU3aStqRDVId0dOajlUTjFDU3VNL3E4Z3BMbFcwTVND?= =?utf-8?B?OXNoTGxVM0JFenZoL2FFZy9vakZRNU9vV3BQeE55RzZGcUQ5ZDNINWQ2cHg2?= =?utf-8?B?TnJhQU1jY0M2MkxERzNGbXpucTdrTG4zUlVZaWhNRmRRc3BRcThaUm1PYVNl?= =?utf-8?B?TmplMWwwL1htaS81VnpuWGhhZCtEQ2IwNTRKaVVzWG95K3Byd3U3OWVZa0Uv?= =?utf-8?B?c1V5a3BGczluWjJjbjZTR0t1V1NITkhmZmM1d3BYZEE3elA3d2xQQ083WUh1?= =?utf-8?Q?SZv2C8J0s5swNCVg=3D?= X-OriginatorOrg: fb.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c46fa3f-7c8d-40dd-5aad-08da3a737e07 X-MS-Exchange-CrossTenant-AuthSource: SN6PR1501MB2064.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2022 15:14:53.8282 (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: SD/P0KWwhuJUNqGg1HGNCLNvxRHdlAZpMi/JL66nAMGssnR1QO6cCtQfQ4SdwTeH X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR15MB4532 X-Proofpoint-GUID: vcEZZZbk92WtRuoIe4SNG6wb0CrKhhRn X-Proofpoint-ORIG-GUID: vcEZZZbk92WtRuoIe4SNG6wb0CrKhhRn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-20_04,2022-05-20_02,2022-02-23_01 X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/19/22 6:21 PM, Yosry Ahmed wrote: > Add cgroup_rstat_updated() and cgroup_rstat_flush() kfuncs to bpf > tracing programs. bpf programs that make use of rstat can use these > functions to inform rstat when they update stats for a cgroup, and when > they need to flush the stats. > > Signed-off-by: Yosry Ahmed > --- > kernel/cgroup/rstat.c | 35 ++++++++++++++++++++++++++++++++++- > 1 file changed, 34 insertions(+), 1 deletion(-) > > diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c > index e7a88d2600bd..a16a851bc0a1 100644 > --- a/kernel/cgroup/rstat.c > +++ b/kernel/cgroup/rstat.c > @@ -3,6 +3,11 @@ > > #include > > +#include > +#include > +#include > + > + > static DEFINE_SPINLOCK(cgroup_rstat_lock); > static DEFINE_PER_CPU(raw_spinlock_t, cgroup_rstat_cpu_lock); > > @@ -141,7 +146,12 @@ static struct cgroup *cgroup_rstat_cpu_pop_updated(struct cgroup *pos, > return pos; > } > > -/* A hook for bpf stat collectors to attach to and flush their stats */ > +/* > + * A hook for bpf stat collectors to attach to and flush their stats. > + * Together with providing bpf kfuncs for cgroup_rstat_updated() and > + * cgroup_rstat_flush(), this enables a complete workflow where bpf progs that > + * collect cgroup stats can integrate with rstat for efficient flushing. > + */ > __weak noinline void bpf_rstat_flush(struct cgroup *cgrp, > struct cgroup *parent, int cpu) > { > @@ -476,3 +486,26 @@ void cgroup_base_stat_cputime_show(struct seq_file *seq) > "system_usec %llu\n", > usage, utime, stime); > } > + > +/* Add bpf kfuncs for cgroup_rstat_updated() and cgroup_rstat_flush() */ > +BTF_SET_START(bpf_rstat_check_kfunc_ids) > +BTF_ID(func, cgroup_rstat_updated) > +BTF_ID(func, cgroup_rstat_flush) > +BTF_SET_END(bpf_rstat_check_kfunc_ids) > + > +BTF_SET_START(bpf_rstat_sleepable_kfunc_ids) > +BTF_ID(func, cgroup_rstat_flush) > +BTF_SET_END(bpf_rstat_sleepable_kfunc_ids) > + > +static const struct btf_kfunc_id_set bpf_rstat_kfunc_set = { > + .owner = THIS_MODULE, > + .check_set = &bpf_rstat_check_kfunc_ids, > + .sleepable_set = &bpf_rstat_sleepable_kfunc_ids, There is a compilation error here: kernel/cgroup/rstat.c:503:3: error: ‘const struct btf_kfunc_id_set’ has no member named ‘sleepable_set’; did you mean ‘release_set’? 503 | .sleepable_set = &bpf_rstat_sleepable_kfunc_ids, | ^~~~~~~~~~~~~ | release_set kernel/cgroup/rstat.c:503:19: warning: excess elements in struct initializer 503 | .sleepable_set = &bpf_rstat_sleepable_kfunc_ids, | ^ kernel/cgroup/rstat.c:503:19: note: (near initialization for ‘bpf_rstat_kfunc_set’) make[3]: *** [scripts/Makefile.build:288: kernel/cgroup/rstat.o] Error 1 Please fix. > +}; > + > +static int __init bpf_rstat_kfunc_init(void) > +{ > + return register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, > + &bpf_rstat_kfunc_set); > +} > +late_initcall(bpf_rstat_kfunc_init);