From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD2A8C433FE for ; Fri, 4 Nov 2022 16:01:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DB776B0071; Fri, 4 Nov 2022 12:01:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 58B086B0074; Fri, 4 Nov 2022 12:01:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47AC66B0075; Fri, 4 Nov 2022 12:01:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 38D796B0071 for ; Fri, 4 Nov 2022 12:01:36 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id F19381C71A0 for ; Fri, 4 Nov 2022 16:01:35 +0000 (UTC) X-FDA: 80096224950.16.E75EEC5 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf16.hostedemail.com (Postfix) with ESMTP id 8F1D118001D for ; Fri, 4 Nov 2022 16:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=wpJfP/2Wf+9TM1Ly0AcXL7cMe2wzVyoEhqWc7Sdl3rA=; b=Tu5ihBp3rXsAbF7+JMo/NqT3Tv ZBN4eAbFJ+9th7ufkgd8BpOqLU5vZ1FneT2oBzXuae+q8VkC00nj+pt4w1hlLYggUKN6Zg8SV1Ilb bJSDhBvhinllMAEv+UkmivmZ+FHKOBjB0z3In3OiyFCO2lxxFzNopLBLTX5oz18aKylZAD1dWYEDZ fKLPQnNbpk+n4i/G+Ymt23rMY9llgLcs/PmU0LMPRAdgCSSD8yrn26agWeINnCbtzJniBee5l8t00 VUAoP/B3NVGQCzmOaVARnFna5S6x21LsB1mqYk4Vno6RkI7VJCmYs8CuW7jybidPO5sbXN6bh0e6Y ELHW5L7g==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqz8R-007Tvp-0g; Fri, 04 Nov 2022 16:01:35 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3942430008D; Fri, 4 Nov 2022 17:01:29 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 229E5209E95D6; Fri, 4 Nov 2022 17:01:29 +0100 (CET) Date: Fri, 4 Nov 2022 17:01:29 +0100 From: Peter Zijlstra To: Linus Torvalds Cc: Nathan Chancellor , Uros Bizjak , x86@kernel.org, willy@infradead.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, aarcange@redhat.com, kirill.shutemov@linux.intel.com, jroedel@suse.de Subject: Re: [PATCH 11/13] x86_64: Remove pointless set_64bit() usage Message-ID: References: <20221022111403.531902164@infradead.org> <20221022114425.168036718@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Tu5ihBp3; spf=none (imf16.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667577695; a=rsa-sha256; cv=none; b=1QdJhbjbKt5EdT21tLhZPLxWUgSJUClqBtzEFCf7TyCJSPJYn2G5SRkLmx91ewdR2Gw9eB GfvM2tZMXRuLM/nBH4g7rEV/pvzVWn+sy2hmIFkwOjP5dnkjMMwZr+iLpFrB+iwDfHNfaT Q0QCYojbBYeHFNYKls+3/rdvitRQp1Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667577695; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wpJfP/2Wf+9TM1Ly0AcXL7cMe2wzVyoEhqWc7Sdl3rA=; b=O04KWlJuhOwD94e8MTcDDG+qPThDi5PvBz3G1L8YiJD57Bj1B+GYn5dAgsFtaODYM9Bgx3 JDY8u0dN1I6q7jeKSxtZxmwEC2IM9RVExw+JJCOTwsHcolJ5euYsztcNW01KhdsxCHIQU7 OUX4qS4tEL49um5+zoRwvx6mWyy50u0= X-Rspam-User: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Tu5ihBp3; spf=none (imf16.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 8F1D118001D X-Stat-Signature: 1s9s6xpktkrcg5casytt1em95zexetge X-HE-Tag: 1667577693-162980 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Nov 03, 2022 at 01:39:17PM -0700, Linus Torvalds wrote: > And even after I checked *that*, I then checked the 'struct irte' to > check that it's actually properly defined, and it isn't. Considering > that this all requires 16-byte alignment to work, I think that type > should also be marked as being 16-byte aligned. > > In fact, I wonder if we should aim to actually force compile-time > checking, because right now we have > > VM_BUG_ON((unsigned long)(p1) % (2 * sizeof(long))); > VM_BUG_ON((unsigned long)((p1) + 1) != (unsigned long)(p2)); > > in our x86-64 __cmpxchg_double() macro, and honestly, that first one > might be better as a compile time check of __alignof__, and the second > one shouldn't exisrt at all because our interface shouldn't be using > two different pointers when the only possible use is for one single > aligned value. So cmpxchg_double() does a cmpxchg on a double long value and is currently supported by: i386, x86_64, arm64 and s390. On all those, except i386, two longs are u128. So how about we introduce u128 and cmpxchg128 -- then it directly mirrors the u64 and cmpxchg64 usage we already have. It then also naturally imposses the alignment thing. Afaict the only cmpxchg_double() users are: arch/s390/kernel/perf_cpum_sf.c drivers/iommu/amd/iommu.c drivers/iommu/intel/irq_remapping.c mm/slub.c Of those slub.c is the only one that cares about 32bit and would need some 'compat' code to pick between cmpxchg64 / cmpxchg128, but it already has everything wrapped in helpers so that shouldn't be too big of a worry. Then we can convert these few users over and simply delete the whole cmpxchg_double() thing.