Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp65446pxh; Thu, 7 Apr 2022 14:07:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKtQS0Hrtt+2p9hUpkpW9A9QLLv7UNVbYa1CWO2FyQrzQHkoCF6DV9HMsOY8uEGKa1nyPx X-Received: by 2002:a05:6a00:1a91:b0:4fa:b21d:2ce with SMTP id e17-20020a056a001a9100b004fab21d02cemr16333589pfv.75.1649365653002; Thu, 07 Apr 2022 14:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649365652; cv=none; d=google.com; s=arc-20160816; b=moYh+h+hdRpWLXQTDwUBhXD1ChrMNfSIMqqkUdndTy7BB/vTOPZ8dT6/Onx4mzN5/b xBsOln2opKLmBhrkc2a+KQRspi1KF6zmZa29ZN3443s/WlAM2L+KGZnNkSEfnBUEsbcn COpxNcrlOoorm8jSbC5NjWmljqsopEVRQJue2p36tnsEt+5JkCNmGhHFC5dHMeCPuR6l xCFsnU4ZI2+6KikKXXvdmWKi2nELVwo03/GnLWjb58A4BG8aKyj8xJ8tVCE3081prOUh LilW0E/wpebqW6+6Z2gwemW8blA15JEO5bckSpIjW1GcmPqwuBTuphQ7Mjhn9p3gioCv J0Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=l8OgFspqIU7b4vxeuPh92V4JMHLE7mkjNVSAXOwkoiI=; b=fRWryOSewPGK0P+DAfxTsUU+BNMoYaOb+mHRdiQ6bM7boRlMwBD86CFx95RxDBIcYN 82Y6le/gg8TSjj5dm9/YK0Jm1xPvDFMTxNK6Tel61TU/BjQmSK6gXiPGQHxPMMqOAwIM 7U4EdhL5vzKfqhYGjajAPk0OiiVO5Is6Tn9x79RUfxA3pHxfaH1hRdjzq46Z1XeEDvGS d7hAdleTKqwoRiXj84u/BnVR/QzeNJztkh8iMpAUgOYzgtYDYKs+GUNOfv4ClISjvVj4 YKg62ThB8q0wwQPqUus9acqhHmSdATCX8bwjem8Vvy09VHECU2I6pKw0z/QFrfaFejW5 CPJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=hqEsqkdU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k4-20020a170902760400b00153b2d164a3si725038pll.171.2022.04.07.14.07.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 14:07:32 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=hqEsqkdU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5D24C48783E; Thu, 7 Apr 2022 13:14:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229630AbiDGTZS (ORCPT + 99 others); Thu, 7 Apr 2022 15:25:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbiDGTZQ (ORCPT ); Thu, 7 Apr 2022 15:25:16 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81DDE270858 for ; Thu, 7 Apr 2022 12:23:13 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id p21so8071529ioj.4 for ; Thu, 07 Apr 2022 12:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=l8OgFspqIU7b4vxeuPh92V4JMHLE7mkjNVSAXOwkoiI=; b=hqEsqkdUEZnH1z3sA9zbHCvR08eMANE+TcmOmjbDqr6CSsj75T6hADaySzUCuq0SeM w8EgXroBrA+8AiQz6o5psyA0BnEiA5dPpuNR5VWR5JMeOkqZYfSeU9xOJDozQ/6B7iTE EQEw0P1idXPRoOOjCOI0PDLVMOiRJSlqTlSm8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=l8OgFspqIU7b4vxeuPh92V4JMHLE7mkjNVSAXOwkoiI=; b=Eu0rQflSD1ncLxUCajzE/BpOjKjXVsh/2f5ffYBhtlk5yMkIcOby+e5zwHDqWrYIxT 8GpeyHPWneZ8IHcyXnNLFgG1d39JJ52itXLbUeM+yGH1RefIiG3aqupH4iqe4Mcb4UHU 41aZuSikmxeGx05yB64ViksplGUai232KUsD+VOU14/eP+JugQxGz3ogJVdHneZK2Iy3 25rt/y2pOYxQidGVYDg0AW28XKmlhxMm2+Io/+WnIh25vBaoTUVu7H1j9cV6qm8i6SMY dPeB9/8SzQYKYnNZo8LUhsOgM9+vlu+REL0+bpf6pOiVc92WH1EwXKMPw43T12nXj4tV 5FKg== X-Gm-Message-State: AOAM530YGI/nlRHGdqPiMsZOdg/QPcmG5V8HDb98cdkaaZj2Jge0obBr v5D09tO6dLQTtTD4Itbof4ly3A== X-Received: by 2002:a05:6602:490:b0:638:c8ed:1e38 with SMTP id y16-20020a056602049000b00638c8ed1e38mr6848815iov.202.1649359392707; Thu, 07 Apr 2022 12:23:12 -0700 (PDT) Received: from [192.168.1.128] ([71.205.29.0]) by smtp.gmail.com with ESMTPSA id i12-20020a056e020ecc00b002ca53aba365sm5885794ilk.64.2022.04.07.12.23.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Apr 2022 12:23:11 -0700 (PDT) Subject: Re: [PATCH bpf-next] selftests/bpf: Fix return value checks in perf_event_stackmap.c To: Yuntao Wang , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Cc: Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Shuah Khan , Hengqi Chen , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Shuah Khan References: <20220407153814.104914-1-ytcoode@gmail.com> From: Shuah Khan Message-ID: <7ac36fbe-aa44-9311-320b-1e953c29a3c4@linuxfoundation.org> Date: Thu, 7 Apr 2022 13:23:10 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20220407153814.104914-1-ytcoode@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 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,URIBL_BLOCKED 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 4/7/22 9:38 AM, Yuntao Wang wrote: > The bpf_get_stackid() function may also return 0 on success. Can you add couple of sentences to describe what this patch does? bpf_get_stackid() may also return doesn't really say anything about why this patch is needed. > > Signed-off-by: Yuntao Wang > --- > tools/testing/selftests/bpf/progs/perf_event_stackmap.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/bpf/progs/perf_event_stackmap.c b/tools/testing/selftests/bpf/progs/perf_event_stackmap.c > index b3fcb5274ee0..f793280a3238 100644 > --- a/tools/testing/selftests/bpf/progs/perf_event_stackmap.c > +++ b/tools/testing/selftests/bpf/progs/perf_event_stackmap.c > @@ -35,10 +35,10 @@ int oncpu(void *ctx) > long val; > > val = bpf_get_stackid(ctx, &stackmap, 0); > - if (val > 0) > + if (val >= 0) > stackid_kernel = 2; > val = bpf_get_stackid(ctx, &stackmap, BPF_F_USER_STACK); > - if (val > 0) > + if (val >= 0) > stackid_user = 2; > > trace = bpf_map_lookup_elem(&stackdata_map, &key); > Linux 5.18-rc1 shows a couple of more bpf_get_stackid() in this function. Removed in bpf-next - I assume. The change is good. I would like to see it explained better in the commit log. With the commit log fixed to explain why this change is needed and what happens if val equals to 0 condition isn't checked: Reviewed-by: Shuah Khan thanks, -- Shuah