From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 6736533C506 for ; Tue, 27 Jan 2026 10:13:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769508826; cv=none; b=AAUoLv+FxjaQEw8I1AVtnlgwPkCySBqD0G7exuglyj5bpEzl7RhOKU/N3r2s6FluqzmiImmj46M1jREQePpeQX1O9TFU8XZTTSmFNjmtKtlEEPAHMrqESNqZsg2Nl2tygKFDqjFHKdaXYekms2Pf2SlLfaMxy/eFVrg5taWTESY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769508826; c=relaxed/simple; bh=Hddp8EH1yXGPY9z/p4cAF0itGV0OTB2M/8Fb3IcnAGY=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZC3Lu/4CBVhrKD5Qkl6H84zzxwYxJiFyo7cpjoEHFRo8R+SEFoBxyUyQgdxUmkxnJDxFiFimbFGXSaCZH3mZAFpWBgHEzKiHl67OFywnGwRzCDuvFC2aDe8JnlFJjFfhRDeeEc2aCYDu+r/EVGHn3wu9wrT7MV1hne1vIOQCndc= 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=b+LN1ixL; arc=none smtp.client-ip=209.85.128.46 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b+LN1ixL" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-47ee0291921so46692405e9.3 for ; Tue, 27 Jan 2026 02:13:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769508820; x=1770113620; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=hOVCHa5FK0FHzhkRB3PH07haTP2XM7pEmD3OPviuoK0=; b=b+LN1ixLKOU+NYPL8gXEqqt4Ss4pccb9Z5A2sARFyiKiVBSSyEMCJEdqz1lOK76teD XqQ8QX7xZVWyGTEXvaZ9M0e7cKv0Vb4BvjxJ7V0jeyhO4DxRIUSbBOB/Du9p9WLBl0FR i04NeBUN0icN9tlJSvVb9/ymGnMk4wwSM/nt2Z7Wz2w4fEU3p9zUAXwej87u13KiuY23 zkauNvMk0swUfk65D8If+IG91VKtAg5XN3IrQUUKEAb2CVW+c8jiLcQLho4Y9AJDpzjr uNlVTDpdhgWSb+OGCsdxz0aigC0UVChKvPjT4SQKG6pwlpGXSyoXN4/KK1YkIc1Iar98 loWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769508820; x=1770113620; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=hOVCHa5FK0FHzhkRB3PH07haTP2XM7pEmD3OPviuoK0=; b=cHtxAaTOfH9/qHJGI4I+t+1bPDn8haH0w0bRtYVhb95SsgG+ID5ze9ZTwnQ4S2URVK XdP8fYRfnh8R8kWpxxjHQ/e02QEOEJPxjqTWY42KM79EJkfaJaRtnShQy3EBhdAFmk2H 1fUo4FyX01n99bSk6r7//iKEUYccunPLPy5glzYVsa2TDo9u55jqChVAd/scbyRXD7+s p2BJeJHCVHrNCib5VLH6UYaevJMe+KzlZPrh5MneboNh6uEC0euayZxI97C/tOPbxhUt QAhe6qP1jZifCB/P7bRk6RAHSYNfLXoMEVf4kzylyQ1OHtng+gmzfKu+LDhVatHEj03Y 7Ygw== X-Forwarded-Encrypted: i=1; AJvYcCX2G8BAd6Z9xUUEBsNGmL1e4VmVvSpd5HwJxhu4yED4axq7tKqA5CiV9FtUBgHQ/Ylf6yYf/sq5b5iS3xk=@vger.kernel.org X-Gm-Message-State: AOJu0YxOcMZXEsMVm0tru10vWpSv6BKgHZnnZO8FLcxsh5m7I4vkoOG0 TOzyU7LC0JVuJw4sWmBAqNgre75PKizJqFHeCTw52Aq0AWEPX0GIoNUj X-Gm-Gg: AZuq6aLUzYoZp30XbALkvVEpUboxoNgqcDpUX1tGc5sLdSqjriDhcAFpMJBR7PbExp1 WXc7kUNgat/b/8Q1OPo/l3T90T8C7YyQYAQyVTs+LBH+snpU1JO0XiGUidmpV6hFpk/8s7UfYTv ScwVoRJAjLQLhwFsFHyjm0uwxpHMY8Q0voxxJow0p2IWIO5PVHhnjC7r+WyNd89OhKbcZxtKMA3 O8CtRbksHaX277alPeiAEew9e6C1Cyfs3MebTBfQyTVeWHJkf9o3ePrxQxCsK8VNI/h1hJ13LUs o2yZLIz+YLkFTSDLLUmdUOiBOwGAj7ooqFHMQowzCjcYLMxYltaomFZ2YDqj9CM9YflI0fsFm7/ H9B/Sb1UlWZ1qIhAFjIlmHiDBXWX6fc4jIfDTWwnX775TdPGEN+tVPz+A/wxy062/E50IYXKFLF FtLTq1ti4ENbBgcAlnF8poWU12TFqstg6fqDOFjMiMcZc012fG0saU X-Received: by 2002:a05:600c:450b:b0:480:426e:9d38 with SMTP id 5b1f17b1804b1-48069c96b8amr12421685e9.27.1769508819768; Tue, 27 Jan 2026 02:13:39 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48066bfb59asm47613355e9.7.2026.01.27.02.13.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 02:13:39 -0800 (PST) Date: Tue, 27 Jan 2026 10:13:34 +0000 From: David Laight To: Marco Elver Cc: Peter Zijlstra , Will Deacon , Ingo Molnar , Thomas Gleixner , Boqun Feng , Waiman Long , Bart Van Assche , llvm@lists.linux.dev, Catalin Marinas , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] arm64: Optimize __READ_ONCE() with CONFIG_LTO=y Message-ID: <20260127101334.352794d1@pumpkin> In-Reply-To: References: <20260126002936.2676435-1-elver@google.com> <20260126002936.2676435-3-elver@google.com> <20260126111643.534c8274@pumpkin> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) 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=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 27 Jan 2026 00:15:38 +0100 Marco Elver wrote: > On Mon, 26 Jan 2026 at 12:16, David Laight wrote: > > > > On Mon, 26 Jan 2026 01:25:11 +0100 > > Marco Elver wrote: ... > > Also is the 'default' branch even needed? > > READ_ONCE() rejects sizes other than 1, 2, 4 and 8. > > A quick search only found one oversize read - for 'struct vcpu_runstate_info' > > in arch/x86/kvm/xen.c > > Requiring that code use a different define might make sense. > > > > I also did some x86-64 build timings with compiletime_assert_rwonce_type() > > commented out. > > Expanding and compiling that check seems to add just over 1% to the > > build time. > > So anything to shrink that define is likely to be noticeable. > > The compiletime_assert_rwonce_type() is for the benefit of the > asm-generic variant, which is implemented like the 'default' case here > by default. True, but compiletime_assert_rwonce_type() stops you getting to the 'default' case in this version - unless code uses __READ_ONCE() and I couldn't find any examples. So the 'default' could probably just be a BUILD_BUG_ON(). Although part of the 'bloat' from compiletime_assert_rwonce_type() is the repeated definition of the error function. A few places define an 'error function' rather than using compiletime_assert(), perhaps there should be: #define compiletime_error_fn(name, msg) \ __noreturn extern void name __compiletime_error(msg) for consistency. If compiletime_assert_rwonce_type() used a named function this code could just call the same one. > This here is only the arm64 override of all that with LTO. I keep missing that conditional (and that it means clang) ... It also explains why only a few builds get a signedness error from min() because the 'atomic ? x : y' causes integer promotion to happen. David