Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp1003889lqs; Wed, 6 Mar 2024 03:35:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXVWmj2f+LxqxWo533Lqvmgig5N1VJUdcl88pLMxm6E6w6RQllIJEP2VtTfJFP4A+Brf30x8PRX8bk79QTNBmqZhrjen/10QPDPb1T9GA== X-Google-Smtp-Source: AGHT+IEI2SNAlFGnfhkuTa2ZCaxgJNBq889pJIq+usrM+5qX+n73tAooWWDD2jXLWA1TjhQpiYOR X-Received: by 2002:a17:90a:9416:b0:29b:77fc:ca6f with SMTP id r22-20020a17090a941600b0029b77fcca6fmr2129864pjo.15.1709724931268; Wed, 06 Mar 2024 03:35:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709724931; cv=pass; d=google.com; s=arc-20160816; b=ZoWOVe7SJQrBycvTgKJqsq5p6cOBlibk4fvSWfo7yBrFVB2hLVF9gTzCSxXHu8A0cC gNhLvPVGc1SW7cuS4iwwl49MZqkFppWwwN9g7w3H0Z3ghNnTW1pg2ucg3//IKb1fJgow Qxn3HjZOSkv8BD2xu59GUCDZ7aFytCEhgon3zZPR8UFOwfhv504xdd4PBXoF4tfqa65n ldOZFU0eDCEmI1YSStY+gAKcyJKFtb2gParVWBvRfEUbMRvY7ZNnpHBq8zrrv2TMi4I0 BcRdQUX6VWLtanXOmmaQ/BnqfouoGEQeFT2rALg5Qg4fswvH1vLo3LPFW0zX54vLPtdP 79PA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=v5JAMBrNDP5b7jIy8twzxHR53DVo5CONXkezKDhBooE=; fh=KDtgcP6a/IogC1+PwbJ5tg51h8lm5r3MFHHy3QjNZkM=; b=ba6s4y6CPK4d7Zr6iRb/Hwd/zUleMPmrUhSxhvrrs7yi6QYOBVt4G8Yhq4oXwF6yEX HMt/iONmJvgjQZZZXv3gGVRGYiNB4GjZhwPV6W3ZmV++J1SM+WNmV0J05f8daai7G+kE Izo0F2No1+kVv8VfkwPUj+N4U91ubuEadliC7N3QYjN6wpFURCH+Q+zt686GbYWGoZfU NrEtnQrCAMVOBvRgVGsvKXoIFvL0i4gUAs4CQaXh784crolbsX6X6fIJR96WwyH9ZHy2 f8jAAgPuBS+LKCqFnGI/No3TmDyoCkx+8ja8hvLA/MdfHOPAr0nGlrhziQufBlT2YZIx 9+Rw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tesarici.cz header.s=mail header.b=ACUaXUva; arc=pass (i=1 spf=pass spfdomain=tesarici.cz dkim=pass dkdomain=tesarici.cz dmarc=pass fromdomain=tesarici.cz); spf=pass (google.com: domain of linux-kernel+bounces-93840-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93840-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tesarici.cz Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id pw13-20020a17090b278d00b0029b62d81633si3078354pjb.54.2024.03.06.03.35.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 03:35:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93840-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@tesarici.cz header.s=mail header.b=ACUaXUva; arc=pass (i=1 spf=pass spfdomain=tesarici.cz dkim=pass dkdomain=tesarici.cz dmarc=pass fromdomain=tesarici.cz); spf=pass (google.com: domain of linux-kernel+bounces-93840-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93840-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tesarici.cz 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 ADC18B2406B for ; Wed, 6 Mar 2024 11:12:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C78A605D5; Wed, 6 Mar 2024 11:12:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tesarici.cz header.i=@tesarici.cz header.b="ACUaXUva" Received: from bee.tesarici.cz (unknown [77.93.223.253]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A83A762D9 for ; Wed, 6 Mar 2024 11:12:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=77.93.223.253 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709723542; cv=none; b=GJkeGksJTTztlcIxZ2i7j1ezojRrMFtuCOq5vNx5rMZRVwn49zH16o3kkQvePlderSSq96it3xEjDCugMFZsuLc9TV5t7qUq3cyoFztjWZ+buGk5dGf4y+Zf0zrwQlC/6TBZ+O0f22UHGgnXdsFsUaxOdheGYBWUtw3v0M8E68g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709723542; c=relaxed/simple; bh=wmU/DUhfL3HovQWf0NwpKdiQKOYEvrY68QLwAtIMdKU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=g3M5Wy/7+znSvfeM55dFzMdDaiAnfAvJQrThTdGrD9RAOKyC/gbaGEeVrdVdea0HmXptcAl1DF8nU8JaoLbeCu6aL7ECqCUFoqvabtvdGF6hQw35mLpK+CtSxgupu1oTRcQ4M1WJHw6qegrqrudooSqAf11JqMNJXbfKBXDhDeI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tesarici.cz; spf=pass smtp.mailfrom=tesarici.cz; dkim=pass (2048-bit key) header.d=tesarici.cz header.i=@tesarici.cz header.b=ACUaXUva; arc=none smtp.client-ip=77.93.223.253 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tesarici.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tesarici.cz Received: from meshulam.tesarici.cz (dynamic-2a00-1028-83b8-1e7a-4427-cc85-6706-c595.ipv6.o2.cz [IPv6:2a00:1028:83b8:1e7a:4427:cc85:6706:c595]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bee.tesarici.cz (Postfix) with ESMTPSA id 1771D1C964D; Wed, 6 Mar 2024 12:12:17 +0100 (CET) Authentication-Results: mail.tesarici.cz; dmarc=fail (p=quarantine dis=none) header.from=tesarici.cz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tesarici.cz; s=mail; t=1709723538; bh=v5JAMBrNDP5b7jIy8twzxHR53DVo5CONXkezKDhBooE=; h=From:To:Cc:Subject:Date:From; b=ACUaXUvacShu6y73ZneV5eg+QL4cfJNYceBIwSoDPbNHX/S+hKo9mNTsvadU5FzCv 14SRl4wTP5eNUFzlaTT7arH2x2HPMg8gFtbMLkl6CO1Mi3RQF/9TQTTpesOi7kjQXd kPNCSZm5bR/shpSPPoFizvNNWNg/GBAVfyTBiMVonu3YmlHTMf4Od2oE4dj/0iVlC/ PzYf5qoY3tNK/sTwcUQfToDC2S5bfd42/gQ4EotR7buRprXn0HUFncRPON+TfkVNPY M6yFuNvJ+0xvt7p5xZPmLir2+9wY8jbQqLrLU+atv1mPf8yz9CEVpkrcZ0MO10Kbtw YrQa05SdLQn5Q== From: Petr Tesarik To: "David S. Miller" , Eric Dumazet , Linux regressions mailing list , linux-kernel@vger.kernel.org (open list) Cc: "Linux regression tracking (Thorsten Leemhuis)" , Petr Tesarik , stable@kernel.org Subject: [PATCH 1/1] u64_stats: fix u64_stats_init() for lockdep when used repeatedly in one file Date: Wed, 6 Mar 2024 12:11:57 +0100 Message-ID: <20240306111157.29327-1-petr@tesarici.cz> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Fix bogus lockdep warnings if multiple u64_stats_sync variables are initialized in the same file. With CONFIG_LOCKDEP, seqcount_init() is a macro which declares: static struct lock_class_key __key; Since u64_stats_init() is a function (albeit an inline one), all calls within the same file end up using the same instance, effectively treating them all as a single lock-class. Cc: stable@kernel.org Fixes: 9464ca650008 ("net: make u64_stats_init() a function") Closes: https://lore.kernel.org/netdev/ea1567d9-ce66-45e6-8168-ac40a47d1821@roeck-us.net/ Signed-off-by: Petr Tesarik --- include/linux/u64_stats_sync.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h index ffe48e69b3f3..457879938fc1 100644 --- a/include/linux/u64_stats_sync.h +++ b/include/linux/u64_stats_sync.h @@ -135,10 +135,11 @@ static inline void u64_stats_inc(u64_stats_t *p) p->v++; } -static inline void u64_stats_init(struct u64_stats_sync *syncp) -{ - seqcount_init(&syncp->seq); -} +#define u64_stats_init(syncp) \ + do { \ + struct u64_stats_sync *__s = (syncp); \ + seqcount_init(&__s->seq); \ + } while (0) static inline void __u64_stats_update_begin(struct u64_stats_sync *syncp) { -- 2.44.0