Received: by 2002:ab2:7853:0:b0:1fa:5c73:8e2d with SMTP id m19csp4213lqp; Thu, 30 May 2024 10:13:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWG8miHJniIGBHAuxOMqR5HUEWly1ao/1Z9Ypwcl9QmU4drbJq1HSSiWdveUiG0VKHi40yOcGb9TjVaEJ2RVAqvy/ag0UAlHWPbw1eTcA== X-Google-Smtp-Source: AGHT+IG/N9HpvLAGNrvRcvOrsT5b6h8t7mKO8OQhhOTN5yQYF+7cq6Hneg9cWPokGx/4LHUemJMC X-Received: by 2002:a05:6a00:f94:b0:6ea:bb00:dbb6 with SMTP id d2e1a72fcca58-702311171c9mr3148303b3a.8.1717089190589; Thu, 30 May 2024 10:13:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717089190; cv=pass; d=google.com; s=arc-20160816; b=rhayT0mhHnRt8n4acYV0rzNNObuGU8YDZbunATVH55uAnssF1MmTClweIx52YjHjK6 QiTvTWe/UFEhksBuTZa3q4GySjcdi8m3D7UiXrn6egdFUMiHKHDCHZ9IVYxB/SRj4Nc5 E7uzq+Sw4yRYxPDrdcYs4Nprl8m5nd+QT5SO2uiwRs0dGEt2bbw/Cd79T/JZ1UYB786j InfAc9ib1d3SLPpf5VmQowzWQLU1HM6GSnXg8ryrAPc3iAcp2LzlkQmPiWaHM0MJ2+7T QeZUAVlW6Zi9RgkwaHdThJGU+Vu+5cRjv2KIuo2ARi+VGK89El4gTSr3JY8s+LhQqDcs 9vSQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=b5dMIK+YmRjKcd+w3hKSLG4KLhKC/IhFM8M8zHEuCAE=; fh=21/EwnYeWjjeBHs1ni+yhh/hItYZhnO6FPvEndoQTk0=; b=dzAK01MsEnPdJkvu8x1JYdCU7vY0heoMH7nJA8+J/AE8OotsggX1E7ZUxiQD2VFRpj Ni98yZKzmBMiWGC7WhoZH7vTwOtZESNyzLiXo0LCWhCYyyoo3fmzPXV6YNsNk+rYdUVf ANFz/zu+J9wKeJZFBzOaaS2TqIBeuJyVxpJuBFcuaFGG9KGoKCW1kV4/V6e5DTOsy7HY ogkd4uDAGBMBixKRfsPc9AksxIe9GGvGed1AKB09wTnU+B67WKRvJRP4jamVK2mN+O/A MftBB3xjj/4iuUqFhh/55krYjKMSSrSk9uLn7fTSiEIBIlpfkVONo28c52DKVafAt5FJ WA6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hMV1UhCL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-195713-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195713-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-7023fb5a7a3si327415b3a.221.2024.05.30.10.13.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:13:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195713-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hMV1UhCL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-195713-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195713-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 576DBB261F1 for ; Thu, 30 May 2024 17:11:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 48E214597A; Thu, 30 May 2024 17:11:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hMV1UhCL" Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FDE94653C; Thu, 30 May 2024 17:11:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717089076; cv=none; b=bR+Zr0e7Zo8gRtq3bkkqWgY19QBbt8eENnOYZIDkqVy75pZCyaeIKz0IkHBqoR+qslLXjTEaCuAGQrAGHTH2Zg+otC0JyGFNIUvjcT4DaHA8V9SaSNK1BQg8+7X72431Q6x2xW3rsfHCPGE5O/sIaQ+GiCuvfpRZhb9O8ghJ/mA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717089076; c=relaxed/simple; bh=w1P9GtWTZiHFljha6+hHxilF9/Ml0j8wVOwBBGlUVKc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FNu+bgo4MCselEaJDzQO4m8v62Yr2W/5wPMFQDMxqa1GqjFDxw4HS1DpDtoC3O8E/Wx3XXTNDWKgMvhATvP9Ocah6EvfoveH9B/3Xw/7j0dk8uNwiQTQhJff6VH8Z61TwF6GSpQd98p8jneQJF2VCzDC947KGWDmhURmYKkTC0E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hMV1UhCL; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1f61f775738so6362865ad.2; Thu, 30 May 2024 10:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717089074; x=1717693874; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=b5dMIK+YmRjKcd+w3hKSLG4KLhKC/IhFM8M8zHEuCAE=; b=hMV1UhCLwlKxQjhs6r8tmhQMgu61oo8J5jwJFpDBAlq3ec9zZsrynG+aYyHTEQZbXn KIG42d8cQLeBKwqPBK5pTiCMegaiysg5zgiVC3IW7cqQR8Hc2yLDgCgPzJ9pWlq0eEri jxGS42BTCR3unVO5qyime7FKXurFSTUM6RQtb3KuSCQZN8lf+3sNN4zGxKoqK3KiCnjq u4nfj0K4xpbtBlLG6NLpT/k/VZ1ZAVeJx5VqVRBK/wdQ+YoOllW085K3QQq6BRu8oyT5 f37NnnHNAzFDD+71I49hkzMcVP1TrhR0cSbo0A32OEyaX9Avwp0j9SX4mOWZG0k7zk8P MlUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717089074; x=1717693874; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=b5dMIK+YmRjKcd+w3hKSLG4KLhKC/IhFM8M8zHEuCAE=; b=AVhcHGnaDEu05WxJHV6xTh2FFTljODLqOaYhFn5zQtFqeD722JXF4zZkkgF01xDpGC XEldUxksEaFSlyRHN4Hij+1NRVlLDyuXAHwLMHomD5TboI7ypUPyrp1bErZwQjyw8YA6 6lu0S9sRw8tXo4lAGcGuKnX9kCgDHKuOlWSq2PkI5DrGcQHX+nWpf6VuKDueAJUvZACC zUUEFIxONrfxt48Aq+aBKZrmcGmKPBVA0G7yfLLPLaMh69/VL8jf4+CHfsZFPkwEeO0R WiKnoD4ji0dt/LOy+NckHoE89m515q0L80Hw85V8hdzr729CbGGL/k3JXnky7lVmGx84 3gtw== X-Forwarded-Encrypted: i=1; AJvYcCXgoYfDCGX7YthnArIzmCDwcPDl2MGVok6fM30fxa7co+GXFEzxvbueWtqFxBBWAW8x56498JAqCCjJ9SZ8KhvjsriMuL06Pd6HCENyUOg6bKF63aG9EtSazG5FdBC9o5MHmvno X-Gm-Message-State: AOJu0YzIuv536NXXANqPIHFQo1sR8wRa27TRdlzFk4oyjhFn+w21IGR5 dBhGSwdBoIhGfNIa4eEjubiOr07IWE5HGl7wKy/xr/6uc+BTed3a X-Received: by 2002:a17:902:c7d2:b0:1f3:a14:5203 with SMTP id d9443c01a7336-1f61962bd45mr20087525ad.38.1717089074324; Thu, 30 May 2024 10:11:14 -0700 (PDT) Received: from localhost ([216.228.127.129]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323dd824sm203895ad.128.2024.05.30.10.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:11:13 -0700 (PDT) Date: Thu, 30 May 2024 10:11:11 -0700 From: Yury Norov To: Robin Murphy Cc: Alexander Lobakin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexander Potapenko , nex.sw.ncis.osdt.itp.upstreaming@intel.com, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v6 13/21] bitmap: make bitmap_{get,set}_value8() use bitmap_{read,write}() Message-ID: References: <20240327152358.2368467-1-aleksander.lobakin@intel.com> <20240327152358.2368467-14-aleksander.lobakin@intel.com> <5a18f5ac-4e9a-4baf-b720-98eac7b6792f@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5a18f5ac-4e9a-4baf-b720-98eac7b6792f@arm.com> On Wed, May 29, 2024 at 04:12:25PM +0100, Robin Murphy wrote: > Hi Alexander, > > On 27/03/2024 3:23 pm, Alexander Lobakin wrote: > > Now that we have generic bitmap_read() and bitmap_write(), which are > > inline and try to take care of non-bound-crossing and aligned cases > > to keep them optimized, collapse bitmap_{get,set}_value8() into > > simple wrappers around the former ones. > > bloat-o-meter shows no difference in vmlinux and -2 bytes for > > gpio-pca953x.ko, which says the optimization didn't suffer due to > > that change. The converted helpers have the value width embedded > > and always compile-time constant and that helps a lot. > > This change appears to have introduced a build failure for me on arm64 > (with GCC 9.4.0 from Ubuntu 20.04.02) - reverting b44759705f7d makes > these errors go away again: > > In file included from drivers/gpio/gpio-pca953x.c:12: > drivers/gpio/gpio-pca953x.c: In function ‘pca953x_probe’: > ./include/linux/bitmap.h:799:17: error: array subscript [1, 1024] is outside array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds] > 799 | map[index + 1] &= BITMAP_FIRST_WORD_MASK(start + nbits); > | ^~ > In file included from ./include/linux/atomic.h:5, > from drivers/gpio/gpio-pca953x.c:11: > drivers/gpio/gpio-pca953x.c:1015:17: note: while referencing ‘val’ > 1015 | DECLARE_BITMAP(val, MAX_LINE); > | ^~~ > ./include/linux/types.h:11:16: note: in definition of macro ‘DECLARE_BITMAP’ > 11 | unsigned long name[BITS_TO_LONGS(bits)] > | ^~~~ > In file included from drivers/gpio/gpio-pca953x.c:12: > ./include/linux/bitmap.h:800:17: error: array subscript [1, 1024] is outside array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds] > 800 | map[index + 1] |= (value >> space); > | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ > In file included from ./include/linux/atomic.h:5, > from drivers/gpio/gpio-pca953x.c:11: > drivers/gpio/gpio-pca953x.c:1015:17: note: while referencing ‘val’ > 1015 | DECLARE_BITMAP(val, MAX_LINE); > | ^~~ > ./include/linux/types.h:11:16: note: in definition of macro ‘DECLARE_BITMAP’ > 11 | unsigned long name[BITS_TO_LONGS(bits)] > | ^~~~ > > I've not dug further since I don't have any interest in the pca953x > driver - it just happened to be enabled in my config, so for now I've > turned it off. However I couldn't obviously see any other reports of > this, so here it is. It's a compiler false-positive. The straightforward fix is to disable the warning For gcc9+, and it's in Andrew Morton's tree alrady. but there's some discussion ongoing on how it should be mitigated properlu: https://lore.kernel.org/all/0ab2702f-8245-4f02-beb7-dcc7d79d5416@app.fastmail.com/T/ Thanks, YUry