Received: by 2002:ac2:5a04:0:0:0:0:0 with SMTP id q4csp972236lfn; Fri, 18 Feb 2022 02:01:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVoPP8n9W3lYtQinPygR/jBmS8iDLKOyiPfFsrQTbZPOnOkSKIOTp1jFHVPMupUocdptmm X-Received: by 2002:a05:6a00:2402:b0:4e1:46ca:68bd with SMTP id z2-20020a056a00240200b004e146ca68bdmr7237300pfh.70.1645178475482; Fri, 18 Feb 2022 02:01:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645178475; cv=none; d=google.com; s=arc-20160816; b=wgEtByXmmqn6BFRDCnYvZfo8J4mjcqWTY1NpS28ntXeZGUtmThtAQUs/cQOJ5OY28f Xn7uS0djI9dncUKFWCP2unVdldaGowiKV0ASQ1FB5AOxbh5cbqXoe83wlkBX38hlWjat kderth/K+w0PPJB0g1rf+A41SkfGHu6VV+nKtHqAM+6499uze/bNWapAqSvrTG/KQCFr Du7rFVRwxcHER3d87D5/tzviNJSX5xKcZnR8MVFv9e7Vv3ju8qupsrhl7ybOOue/x3L6 kGIGSyXm4cexE/gw7e2Z2i/AbmpAuWxC2d+nVTIL7eIARbZFhrHIsv51Ozz9xksTcYlU P/Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZYxZ73c+F4J6jMvbnzlZ5/TEHyIV+XiIyxVP9fH3B1M=; b=Sev93uHB9GZO3VgU2lNTVKYt9P69LYOBpSYX7y1ECOkzyzzYvxrOMtkCpsqmR08wjf 5ysppqpzaVbZsMyll08bCez5uwCfVuJlusv372wy/J7QA7HydFmxifckUYHeEHknuU8f KnbX1lus1UH7lCyEHvtVeaS/Fx2l34rinFwOQsSWYBBwB48bSi8ropN8q1JkRc2KKhKD /GGVGXK76GCjgtLSMD+7G0ejjE39YZm+5oxEenLoa3OwJwyQ0D6qOou8Ua//qTrWJ1M3 WmpzyvTmZIs9BCZMnmk0hw3RHp/8/cVZS/C3tdzFEI2qwKIxkYsD2u1hEPaD02XOwugu watQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iPVKlwSP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15si340209pgk.116.2022.02.18.02.01.00; Fri, 18 Feb 2022 02:01:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iPVKlwSP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232989AbiBRJBu (ORCPT + 99 others); Fri, 18 Feb 2022 04:01:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232957AbiBRJBs (ORCPT ); Fri, 18 Feb 2022 04:01:48 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1914C50476; Fri, 18 Feb 2022 01:01:31 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id u1so13322861wrg.11; Fri, 18 Feb 2022 01:01:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZYxZ73c+F4J6jMvbnzlZ5/TEHyIV+XiIyxVP9fH3B1M=; b=iPVKlwSPbFttDZnZ5Es+EotVr6BSKpP0TrQChOGASg6H20kOJzZuVDooyplF9ShgAZ IOSt5vS+zz6z2AvBGmQDpQomb3RkFLmAQCmFmgihBLjNbVMxKBbhMGPlAILWL60Z4shD 7h3Lhi86Y2KukyWmn1/Xe2xecHKYglxNfTCD6YNrv87CbfyhhtcDI1KD5XsspbXxEGb+ a18K9lVokQMyqKHURj9pZSZOZQUInuQvc1Zi7LBFmwl0YJUUBdE6SAAFHgSApRUpvBpS n0QhuM9KNTkmIcRGRDhKD8Nqejq2gh/m6K4WaCKsrxq+msSti+c2qvk17n7exbjLn8QB ODfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZYxZ73c+F4J6jMvbnzlZ5/TEHyIV+XiIyxVP9fH3B1M=; b=PWbM+r2wo8VqfvxLvaXfoQEzyEGy0LGqFCUHTK4/pFI7i/4e73Cp6K+V4vka05gRXI nRJ+O5PNRoHgYnOvgh+weyORCyPrre/PXlXBt8eTqN69/elyoskyNPzuRuDv5BKiZXcb Cpw/UF3WDH92T4N6m+8EUX4z4XLsmxDp0FBZ7Z1Yt1NBDRiyXLzJZiTZ3FBQbsglb4II RmSsS+c5q0AgJsYAFRBYS/Qz24OQisDSfpDLp5qxV88wwRz27N4OuPWgpEedt0zC18FA WNLsm9WX+U4gOz4Q1CdJYy8YaJ8qdnsZ5AxqjYF+IPz7+UGDZLMN6JZTxXBER4q0yLbP xGKw== X-Gm-Message-State: AOAM533+CUJgQ9d+b8P1UIqMnFhS2ML7J8SeTr1ZYzjx0cgI6w+uwb2e B6sF8xhIW1sZ14P5PfujbmQ= X-Received: by 2002:a5d:6b8b:0:b0:1e5:2d46:d150 with SMTP id n11-20020a5d6b8b000000b001e52d46d150mr5314811wrx.380.1645174889506; Fri, 18 Feb 2022 01:01:29 -0800 (PST) Received: from krava ([2a00:102a:5012:d617:c924:e6ed:1707:a063]) by smtp.gmail.com with ESMTPSA id r10sm1172969wrv.28.2022.02.18.01.01.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 01:01:29 -0800 (PST) Date: Fri, 18 Feb 2022 10:01:25 +0100 From: Jiri Olsa To: Andrii Nakryiko Cc: Jiri Olsa , Arnaldo Carvalho de Melo , Andrii Nakryiko , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Ian Rogers , "linux-perf-use." , bpf Subject: Re: [PATCH 1/3] perf tools: Remove bpf_program__set_priv/bpf_program__priv usage Message-ID: References: <20220217131916.50615-1-jolsa@kernel.org> <20220217131916.50615-2-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Thu, Feb 17, 2022 at 01:47:16PM -0800, Andrii Nakryiko wrote: > On Thu, Feb 17, 2022 at 5:19 AM Jiri Olsa wrote: > > > > Both bpf_program__set_priv/bpf_program__priv are deprecated > > and will be eventually removed. > > > > Using hashmap to replace that functionality. > > > > Suggested-by: Andrii Nakryiko > > Signed-off-by: Jiri Olsa > > --- > > tools/perf/util/bpf-loader.c | 91 +++++++++++++++++++++++++++++------- > > 1 file changed, 75 insertions(+), 16 deletions(-) > > > > [...] > > > + > > +static int program_set_priv(struct bpf_program *prog, void *priv) > > +{ > > + void *old_priv; > > + > > + if (!bpf_program_hash) { > > + bpf_program_hash = hashmap__new(ptr_hash, ptr_equal, NULL); > > + if (!bpf_program_hash) > > should use IS_ERR here ah right, thanks jirka > > > + return -ENOMEM; > > + } > > + > > + old_priv = program_priv(prog); > > + if (old_priv) { > > + clear_prog_priv(prog, old_priv); > > + return hashmap__set(bpf_program_hash, prog, priv, NULL, NULL); > > + } > > + return hashmap__add(bpf_program_hash, prog, priv); > > } > > [...]