Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp806647pxb; Thu, 17 Feb 2022 15:25:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzv3kjne3BTY6zWBGoc5AHoabRxib5n/1Z6Iz4GLjEWYYmgS1iwCxfkhRTK+16+tmIkYvRx X-Received: by 2002:a17:902:7b8d:b0:14b:8884:b4ad with SMTP id w13-20020a1709027b8d00b0014b8884b4admr4827044pll.120.1645140318467; Thu, 17 Feb 2022 15:25:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645140318; cv=none; d=google.com; s=arc-20160816; b=rMGlO+d9n/P+xGXN+lriMU6RyXUsovacTCfLLzW9d2nDFUMx0rIf9Nv2XuSHLqcCZR 8BEx+SLaatST6oXYQSsQ0jsq9R0UAlo7Skkt+UbywqYwBB01iu6GvmbwUuf8RBaPzrVD HrGreHhEhtl9KQlIlXlqXCUV8dwRWwqyAjmDtO1Sk9tigqbUMTn4qKBBBU1F4yyOEr4U 4zttABgZdeQlYFjQg+U2Xlow5u+kP1kyoQfP25C51FkI60109tDNl3NZxAmoFGHptnCy WB2WzQYcLMuhS4ynbGom/T8jJv1S9k0Ujj6btWd56RHHoUSEi3DfjwyKeMgfXcfzju3V Ut5g== 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=/Xms7LO7cPVPOQl8+2SFpWEDKuxRRkay4Sft0SGc9bY=; b=V4FrFrJvkbdsJ0Udn8EsrRe0W1H85WLNCp3v8rqXDO5tUcr9NIifQHGgURL2M8baOg KQBAq5N/shSypysBBxCn18c3U23wvxzYudommUm5LrEHqLrTOaNHJnk3Fp6hzev1lOIU PsHsDcKajVbYm8qLlbsaEUzIFkmF8MIrkqU+G1kvze4+zasom86+gU/ddM/ZtNsPZZkP ylpsdvWOnVG6tipxmHii/TDIXSbfpTTXCSz6l2JesgmDeHCLNTAyAbyW3YTXhjem11Mh td/1OhDwD/LYNow0vIlkt1b9ADNjNYJtbzstdN9khMSgt8H6EjL1T0rb5ZVYyomc4gYh 0FAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NpXhdUse; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b20si14515455pls.109.2022.02.17.15.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 15:25:18 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=NpXhdUse; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 053B43525D; Thu, 17 Feb 2022 15:11:04 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245261AbiBQVuG (ORCPT + 99 others); Thu, 17 Feb 2022 16:50:06 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231612AbiBQVuF (ORCPT ); Thu, 17 Feb 2022 16:50:05 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2DCF165C06; Thu, 17 Feb 2022 13:49:50 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id z2so5360998iow.8; Thu, 17 Feb 2022 13:49:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/Xms7LO7cPVPOQl8+2SFpWEDKuxRRkay4Sft0SGc9bY=; b=NpXhdUseollFh3xfuow1UWeu6kuIlc8MEd70XdcWOJ0ZWNwN8j8mLttgZn39Nlawfz fx6xL2+OweiX7BAMy6TAENXNOXyhncpxSHYhn5OT7pzWtiniNjXPWRfYbuvCZ+wQHgOf K9N0pvl+B3SS2gJ3+XoFl2Bwe5c6cxXS+bNdFZTsdKfV2nXPFy/vkUR4VJM6H8HuacQ0 8hmRjOnTYRhCRx6AxhamgvkGTA9udu6XUYO71bFvD760Fpqe1X04sEIwvfw3+zDnSEFY ZJcQLy/L/iqiFZilkWQDtezVVTxbcaOj95ijAZs5UGIWUvo9e4VYsnGibM+JNyjnTQG1 d3jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/Xms7LO7cPVPOQl8+2SFpWEDKuxRRkay4Sft0SGc9bY=; b=jz4evxBYzGTofZZVxx4RKMHEre2FHsXHmGbRNVnOgY/PEEjIcf7k+yTSi4uf3wmNVl WW0AX9IEmi15/ZgG/MLCqpDfPV7CEBNPdWCmyxMysdreTY4gf0OT9wIgFKEBHAHvGaRb FIX+uBcSwj9ZZS+fjLFmvmUpeG+DCJLlrPyrKPU/kCrfnMMJ7RRzxtAnCg7e5IpC0Pbz eR/V5baAgwGMnr50UkU27Mj2OHpeq7tswaEcEeiFynbP7KUBw/Yw7Yt81rtM2GRBokpH IVSk3bTbn9JeWtVAxC5pT9Mug/KX1O//rVDvd6ZzQYy5xyv2dZ5ZOU9abO0Gpl2BCftk 0Amw== X-Gm-Message-State: AOAM533edzeEeAFO3D1qk7aUVwBgx99p5LbrNxF3Rilv3a56mrEtKhjU jDc9OBIA+MisC/A8fpidC+qWtcI8apTeGueXud8= X-Received: by 2002:a05:6638:22c3:b0:30a:2226:e601 with SMTP id j3-20020a05663822c300b0030a2226e601mr3297478jat.237.1645134590110; Thu, 17 Feb 2022 13:49:50 -0800 (PST) MIME-Version: 1.0 References: <20220217131916.50615-1-jolsa@kernel.org> <20220217131916.50615-3-jolsa@kernel.org> In-Reply-To: <20220217131916.50615-3-jolsa@kernel.org> From: Andrii Nakryiko Date: Thu, 17 Feb 2022 13:49:39 -0800 Message-ID: Subject: Re: [PATCH 2/3] perf tools: Remove bpf_map__set_priv/bpf_map__priv usage To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Andrii Nakryiko , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Ian Rogers , "linux-perf-use." , bpf Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 5:19 AM Jiri Olsa wrote: > > Both bpf_map__set_priv/bpf_map__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 | 62 ++++++++++++++++++++++++++++++++---- > 1 file changed, 55 insertions(+), 7 deletions(-) > [...] > +static int map_set_priv(struct bpf_map *map, void *priv) > +{ > + void *old_priv; > + > + if (!bpf_map_hash) { > + bpf_map_hash = hashmap__new(ptr_hash, ptr_equal, NULL); > + if (!bpf_map_hash) same as in previous patch, on error this is not going to be NULL > + return -ENOMEM; > + } > + > + old_priv = map_priv(map); > + if (old_priv) { > + bpf_map_priv__clear(map, old_priv); > + return hashmap__set(bpf_map_hash, map, priv, NULL, NULL); > + } > + return hashmap__add(bpf_map_hash, map, priv); > +} > + [...]