From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a6-smtp.messagingengine.com (fout-a6-smtp.messagingengine.com [103.168.172.149]) (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 9D45F246BB9; Wed, 1 Oct 2025 01:46:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759283199; cv=none; b=U20ukx8JvhbSyeiv5buP3CqRLbNmbIXsxc2Lkzu8DAQwBieUGtrLDNJvEQiDHXcfZWOupJIsS4Hjy4D/gobL+s2e/EQvMO3yrYQzEpMZwYy646ECZwZalXVKzXAyQGeTWaeNJNsInyfeX5cSdwyDZUucQ0SH4gHtwbaFR5RkDnw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759283199; c=relaxed/simple; bh=mwsU1ysAGhs3U/iSYpxh8bvI2wtk7MMT8xz0AVWe2g4=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=NvcIinLaYjIv5x1gTRQJWiPBg+yN6ql3tHhPNNJuQMSOW7Xrgu8UnaeU8LYH0phDSRyxH65doEC2AY6VG5IaGvyQSgZWsFO3qPsbIYqkCq9ltKH1WNRJga643JYUbVafNH6LE0x/FPfvv2yqzT9C5ZyTtXrt1rC3DsPY3rakURE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=none smtp.mailfrom=linux-m68k.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=MlxOv+Lw; arc=none smtp.client-ip=103.168.172.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="MlxOv+Lw" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id 9AF7CEC010C; Tue, 30 Sep 2025 21:46:36 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Tue, 30 Sep 2025 21:46:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1759283196; x=1759369596; bh=ivXED/lLknyu9sYEAc0al0uTM1FIS3FdbvE tdmKVtoY=; b=MlxOv+LwCVCG7ZxwFbC74EGzjcm7fNEu9PHcvoN3sPE/16frMTf ZTXC7uSg7uQyF+DqtoKJo1VeuUG7rzHBFcybk3jybFNTBO8wus8n1T4hZP8RTEqH 5P2VU9eBIRbE52Evx9MI/uyCH5AvvtkRO/kleDH10Zr5xPb3IFhoYdV4AqQsnlvF xn+FsHuBGG35pFO2a6FxytNIWUjtYCThTnA8lNhj6O3br5BLYUoXa3WIXZYq//ql mNBdKR6c+N7Ro8DyLQqzKc+4G/HlGF45qn7K4yYXaM/UNSMITy8+LzVYxBxdhfev bN1lrI61xFD3XYYdsv3LNU25yoehQGutwZg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdekudeltdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefujgfkfhggtgesthdtredttddtvdenucfhrhhomhephfhinhhnucfvhhgr ihhnuceofhhthhgrihhnsehlihhnuhigqdhmieekkhdrohhrgheqnecuggftrfgrthhtvg hrnhepleeuheelheekgfeuvedtveetjeekhfffkeeffffftdfgjeevkeegfedvueehueel necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepfhhthh grihhnsehlihhnuhigqdhmieekkhdrohhrghdpnhgspghrtghpthhtohepuddvpdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopehgvggvrhhtsehlihhnuhigqdhmieekkhdroh hrghdprhgtphhtthhopegrrhhnugesrghrnhgusgdruggvpdhrtghpthhtohepphgvthgv rhiisehinhhfrhgruggvrggurdhorhhgpdhrtghpthhtohepfihilhhlsehkvghrnhgvlh drohhrghdprhgtphhtthhopegrkhhpmheslhhinhhugidqfhhouhhnuggrthhiohhnrdho rhhgpdhrtghpthhtohepsghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmpdhrtghpth htoheptghorhgsvghtsehlfihnrdhnvghtpdhrtghpthhtohepmhgrrhhkrdhruhhtlhgr nhgusegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrh drkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i58a146ae:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 30 Sep 2025 21:46:32 -0400 (EDT) Date: Wed, 1 Oct 2025 11:46:34 +1000 (AEST) From: Finn Thain To: Geert Uytterhoeven cc: Arnd Bergmann , Peter Zijlstra , Will Deacon , Andrew Morton , Boqun Feng , Jonathan Corbet , Mark Rutland , linux-kernel@vger.kernel.org, Linux-Arch , linux-m68k@vger.kernel.org, Lance Yang Subject: Re: [RFC v2 2/3] atomic: Specify alignment for atomic_t and atomic64_t In-Reply-To: Message-ID: <7c2c4da1-57f6-23b6-dbff-6288ef3f2a4f@linux-m68k.org> References: <6c295a4e-4d18-a004-5db8-db2e57afc957@linux-m68k.org> <57ac401b-222b-4c85-b719-9e671a4617cf@app.fastmail.com> <86be5cf0-065e-d55d-fdb6-b9cf6655165e@linux-m68k.org> Precedence: bulk X-Mailing-List: linux-m68k@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Tue, 30 Sep 2025, Geert Uytterhoeven wrote: > > To silence the misalignment WARN from CONFIG_DEBUG_ATOMIC, for 64-bit > > atomic operations, for my small m68k .config, it was also necesary to > > increase ARCH_SLAB_MINALIGN to 8. However, I'm not advocating a > > Probably ARCH_SLAB_MINALIGN should be 4 on m68k. Somehow I thought that > was already the case, but it is __alignof__(unsigned long long) = 2. > I agree -- setting ARCH_SLAB_MINALIGN to 4 would be better style, and may avoid surprises in future. Right now that won't have any effect because that value gets increased to sizeof(void *) by calculate_alignment() and gets increased to ARCH_KMALLOC_MINALIGN or ARCH_DMA_MINALIGN by __kmalloc_minalign(). > > ARCH_SLAB_MINALIGN increase, as that wastes memory. I think it might be > > more useful to limit the alignment test for CONFIG_DEBUG_ATOMIC, as > > follows. > > Did you check what would be the actual impact of increasing it to 4 or 8? > > > --- a/include/linux/instrumented.h > > +++ b/include/linux/instrumented.h > > @@ -68,7 +68,7 @@ static __always_inline void instrument_atomic_read(const volatile void *v, size_ > > { > > kasan_check_read(v, size); > > kcsan_check_atomic_read(v, size); > > - WARN_ON_ONCE(IS_ENABLED(CONFIG_DEBUG_ATOMIC) && ((unsigned long)v & (size - 1))); > > + WARN_ON_ONCE(IS_ENABLED(CONFIG_DEBUG_ATOMIC) && ((unsigned long)v & (size - 1) & 3)); > > I'd make that an arch-overridable define instead of hardcoded 3. > How about (sizeof(atomic_long_t) - 1)? Can you comment on this, Peter?