Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp872963pxb; Fri, 22 Apr 2022 13:08:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKPgA5SDgeKlrYPgT8M9ii6Nt3Pmz7vaCk6t/rIdV+XCt3KUkvFx2dy6uMdzH7vqObST66 X-Received: by 2002:a17:90b:33ca:b0:1d4:d5ab:40b0 with SMTP id lk10-20020a17090b33ca00b001d4d5ab40b0mr15727896pjb.96.1650658093117; Fri, 22 Apr 2022 13:08:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650658093; cv=none; d=google.com; s=arc-20160816; b=kg2dUvk3QbcyxwdYRJ/a6fug0+ez+4h7NdNJmsY7Wgpt3xE176cHVe8CMxG34iZIJF rRrghc7xbWdiCGNBk8nR06uT6cIW/wLBBMfWePKqJmDl5dRTBVx5UeIf+UzJztTfYPYm meSFdjj0nxReRbbvle0T6kDfCC31p8gB9Zj9gFV5SKcLuF4ZYoTXqlSJH0MQ601nS7jq Lt+bvqQ/0mtd75RArfVcbf+ZgZQtjibBk94Lhqi9AFdTVJxHlcBxKy0Mp/sG0Bq2WA2Q Sr+zSY9TIZcHDx4HwHkXqaDzKBoWtzdPfuR78TSNLie4sHmHR/Hki77k5nWzVpsCrHSv +kfA== 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=E8pbstQIKMU8n6W0382loX5SA213a1sxeL3uH3Qg3JI=; b=EjW+f9TYxOdjYXdwSCv6lZInS48wps9R6GxLJ4/SaePRLJx0sBjfrJn6uMLcLxCAvf /iv0Cz3QzFigMfoVQSnNOfoL+ksVbtHl0t8sO49ShbMcL191N+UMbvdqwfOB7HB4y7jE /ZxQhnYrYOaz0LNYXKGVbB79sKcd4SJ8Ebs28w6ORz1HFFndJRaQpOo+t+yLRBi1cfHy F4gMBaiaBbrbbe2R/HhQLxJaLndzMNx0YnMtFZ0Ehv8/wA6ytBoeZvBybxJ0u5ro62bI v1oy5Ej/faX59h/KBu88VJlkn/+UUk2daox8p0VNf96LL63adJGUXS+KQ8ASor5Dl/y8 w+Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=k3XSeJBN; 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 kk15-20020a17090b4a0f00b001d1ad44a667si14329203pjb.6.2022.04.22.13.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 13:08:13 -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=@gmail.com header.s=20210112 header.b=k3XSeJBN; 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 90506199807; Fri, 22 Apr 2022 12:04:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381036AbiDTRVI (ORCPT + 99 others); Wed, 20 Apr 2022 13:21:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235399AbiDTRVG (ORCPT ); Wed, 20 Apr 2022 13:21:06 -0400 Received: from mail-vs1-xe35.google.com (mail-vs1-xe35.google.com [IPv6:2607:f8b0:4864:20::e35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F60E45AF4; Wed, 20 Apr 2022 10:18:20 -0700 (PDT) Received: by mail-vs1-xe35.google.com with SMTP id t202so2173807vst.8; Wed, 20 Apr 2022 10:18:20 -0700 (PDT) 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=E8pbstQIKMU8n6W0382loX5SA213a1sxeL3uH3Qg3JI=; b=k3XSeJBNpwXtCKAiE6JPyVsJWnTxJ4iqv54j9tbN8FuaqK46ZMp4gtSFZCjKfonLPE R/cnoFlLe7QKfuwRT9aYsfaMsGKOets5M+f+K9PmO09ISJssgjjb52fl+KGPKvKJOdks FYpMcjAmjLbc8HeOPo6IiJ1qSx1KwtuP4hStjQ48xQbeH2F/YNOSCVUEwjNItGkzQ2lf 8WBUkXWJOTK9mXA0qLglRkFXFzxbf1t1YRo3No1Y6xRmw7sEBSY6xxuOuHoOuzHR4Yk3 e5Z5bS3okR3eq8MWMu5cq91aUu191A6fSfCRx7XiR9Nm4CoAYk+UVlYzPRle/M1JzMJr DTuw== 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=E8pbstQIKMU8n6W0382loX5SA213a1sxeL3uH3Qg3JI=; b=pzOQzXzzadA7KMuQTcn9m9y0awaElFzr18a/kvmqdlpOrO6nVT7k8dTM64HItfKOMU bSocJW9eL2kWZ4+7wDRWR/eiN1zxpTiVAodqI62b2QyfltUXcxNoSK5giJIN8+a2ns0Q yQyX5cz+FS7gBTUaEE7rzthdqSGqpOZV6nYmiddVbqFhh+G5lbVgvnxNHPOBLUyKaBwd A5PQsEsd1G/iWhL6NaDEnIUqE+/2cpFLQoL6+8EA5+ol44d8ugCJDmiubU4LKqT83jTT 2ao/KJ47iO98ff+OouQaPDUNYpfDxXOU1bUQ7QkPgxyzFlIvzjhSiWKvvsHKUwd12CjX mLhA== X-Gm-Message-State: AOAM530GpNG7b4LEQtoPmkhQHZXcRDTLyngTPi1YXXld15RFO7fBCMmz sQILDIrFUN4s8ucBwUh2qlp2gyT5e++FEKxnwew= X-Received: by 2002:a67:f80b:0:b0:32a:17d6:7fb2 with SMTP id l11-20020a67f80b000000b0032a17d67fb2mr6263197vso.40.1650475099231; Wed, 20 Apr 2022 10:18:19 -0700 (PDT) MIME-Version: 1.0 References: <20220414223704.341028-1-alobakin@pm.me> <20220414223704.341028-9-alobakin@pm.me> In-Reply-To: <20220414223704.341028-9-alobakin@pm.me> From: Andrii Nakryiko Date: Wed, 20 Apr 2022 10:18:08 -0700 Message-ID: Subject: Re: [PATCH bpf-next 08/11] samples: bpf: fix shifting unsigned long by 32 positions To: Alexander Lobakin , Yonghong Song Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Jonathan Lemon , Nathan Chancellor , Nick Desaulniers , Dmitrii Dolgov <9erthalion6@gmail.com>, Quentin Monnet , Tiezhu Yang , Kumar Kartikeya Dwivedi , Chenbo Feng , Willem de Bruijn , Daniel Wagner , Thomas Graf , Ong Boon Leong , "linux-perf-use." , open list , Networking , bpf , llvm@lists.linux.dev 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 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, Apr 14, 2022 at 3:46 PM Alexander Lobakin wrote: > > On 32 bit systems, shifting an unsigned long by 32 positions > yields the following warning: > > samples/bpf/tracex2_kern.c:60:23: warning: shift count >= width of type [-Wshift-count-overflow] > unsigned int hi = v >> 32; > ^ ~~ > long is always 64-bit in BPF, but I suspect this is due to samples/bpf/Makefile still using this clang + llc combo, where clang is called with native target and llc for -target bpf. Not sure if we are ready to ditch that complicated combination. Yonghong, do we still need that or can we just use -target bpf in samples/bpf? > The usual way to avoid this is to shift by 16 two times (see > upper_32_bits() macro in the kernel). Use it across the BPF sample > code as well. > > Fixes: d822a1926849 ("samples/bpf: Add counting example for kfree_skb() function calls and the write() syscall") > Fixes: 0fb1170ee68a ("bpf: BPF based latency tracing") > Fixes: f74599f7c530 ("bpf: Add tests and samples for LWT-BPF") > Signed-off-by: Alexander Lobakin > --- > samples/bpf/lathist_kern.c | 2 +- > samples/bpf/lwt_len_hist_kern.c | 2 +- > samples/bpf/tracex2_kern.c | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > [...]