From nobody Sun Feb 8 21:47:15 2026 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (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 E59372FC890 for ; Thu, 29 Jan 2026 00:57:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769648225; cv=none; b=XzP0aqQzPrJwyd+CUNoUi2mZuVMoPtHgS3NAWqbYkXofjCLJoe2awNqWCVe42pmtesWAgCK4rgGicl0VR51je1Sg6ihHpVhM0mggmmbF0HJn0GBzZdXIwxuMg9I8Zn8vkfZvmedczChn5LMsAUJPpfptlQnbwlhyZiBHXlptYxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769648225; c=relaxed/simple; bh=h+6CO9INn+2XL4U9JHeOtddCEAyJ9YJLjzkVO1qGO/c=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=keY02yeEPdQs0eNL4d0jB/u0JE28xAP/iq8Q2iiIBAimObzgszoV0PWQ6Yzo/1GbruR8g7auD1iBWHGJZTtbqDBuIIr4Hybv8gewgRS98qRNgvyTltQuHuTgIpqMeLRR2TCnSqWwhjUxQQakBbqoWChDbHM/2V1eLMhwpHod5eE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--elver.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=QaoWXpP9; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--elver.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="QaoWXpP9" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-4801bceb317so3755355e9.1 for ; Wed, 28 Jan 2026 16:57:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769648221; x=1770253021; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=t0NjJX+kK82UqSM94A1K+UHi4bU7NWZzsNdcUlluZDA=; b=QaoWXpP9qSmgRYyAacsSDUClZ88ojzPy5sMFJSmfD2UcUsgJoYp5ViJFmXzvHvpG0g HRhovAkX/N+Jcf1SP/Xt0TEL51G8PGtq9WfY9rBJQE0A6jQ8Bx+bmef3/Ciom7wpJ4Xr SbYDuHQkrI+M0SvbTC5e0yKF7pkJ75699UWOmo1YV+0RhBugQxE8+ieHWoLhkCjLab4+ 6RubICnhVcbgTAYe+QNrfrlS+JKBYVF/c2vecEzOqZz2vxTX5o14omNpRq6YeQttucmk UBx/+Fw0A6k35iTFYU2WvfqOroSlCD7ZuEX/qQDvvL1zgVUgQM4wbqeHvogjo+a1uUT2 cG/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769648221; x=1770253021; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=t0NjJX+kK82UqSM94A1K+UHi4bU7NWZzsNdcUlluZDA=; b=G75QQ/MEvpP51FFv7st77EOABm+0iRZJj2Jjm+V4FXImvnZLCrU16e+RKI5grw1pb+ 0A/RzP8cicjXSjJJdXfKBEFz6zxvmVFLgmsEWkx/Ihnic0RpE22J7CqroPUjIY2KBQGD Nbl9APE87zEbT2Lpc4UquwWpkj/Jx4fiWpfTxCzMQa/niBdIR8b7ccqO+DGADSYbKIrZ NNEhjeKfocEolWbSyZEz3q4r/ZjT7vgaPQMn+ncS9E1/7FJMMj8dVWZ6kNDFU7dchnvA FK3pwmi9D4RnsMyJ75wn0usMaIrzmdZUSJ6XvvTfxkEXNLTdGt0FyimMv2rfYY42cuWI 2rqg== X-Forwarded-Encrypted: i=1; AJvYcCUARj4pUxdqCL4wD/8B33BKJjz3rOx/C92/O4OvyTSc+vfNuG5WeOPxtwcFkh5eihMQxxb3oLS2DKaiGbg=@vger.kernel.org X-Gm-Message-State: AOJu0YyygbZ9jM3lE8FiK/2kMAVHJYoGPqCkkWaWZnELAL3zdkBVBDhu MLCJwjs8nd8y5mMZvpfJC+JiN9BBDTKO3OVfopkOFVLDmDIgQ9UOIjc6nhKnpCYI21M0nsNBu1R lEg== X-Received: from wmna1.prod.google.com ([2002:a05:600c:681:b0:480:694a:dd63]) (user=elver job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:3b13:b0:480:699c:abe9 with SMTP id 5b1f17b1804b1-48069c86f58mr73598185e9.37.1769648221236; Wed, 28 Jan 2026 16:57:01 -0800 (PST) Date: Thu, 29 Jan 2026 01:52:32 +0100 In-Reply-To: <20260129005645.747680-1-elver@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260129005645.747680-1-elver@google.com> X-Mailer: git-send-email 2.53.0.rc1.217.geba53bf80e-goog Message-ID: <20260129005645.747680-2-elver@google.com> Subject: [PATCH v2 1/3] arm64: Fix non-atomic __READ_ONCE() with CONFIG_LTO=y From: Marco Elver To: elver@google.com, Peter Zijlstra , Will Deacon Cc: 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, stable@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The implementation of __READ_ONCE() under CONFIG_LTO=3Dy incorrectly qualified the fallback "once" access for types larger than 8 bytes, which are not atomic but should still happen "once" and suppress common compiler optimizations. The cast `volatile typeof(__x)` applied the volatile qualifier to the pointer type itself rather than the pointee. This created a volatile pointer to a non-volatile type, which violated __READ_ONCE() semantics. Fix this by casting to `volatile typeof(*__x) *`. With a defconfig + LTO + debug options build, we see the following functions to be affected: xen_manage_runstate_time (884 -> 944 bytes) xen_steal_clock (248 -> 340 bytes) ^-- use __READ_ONCE() to load vcpu_runstate_info structs Fixes: e35123d83ee3 ("arm64: lto: Strengthen READ_ONCE() to acquire when CO= NFIG_LTO=3Dy") Cc: Signed-off-by: Marco Elver Reviewed-by: Boqun Feng --- arch/arm64/include/asm/rwonce.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/rwonce.h b/arch/arm64/include/asm/rwonc= e.h index 78beceec10cd..fc0fb42b0b64 100644 --- a/arch/arm64/include/asm/rwonce.h +++ b/arch/arm64/include/asm/rwonce.h @@ -58,7 +58,7 @@ default: \ atomic =3D 0; \ } \ - atomic ? (typeof(*__x))__u.__val : (*(volatile typeof(__x))__x);\ + atomic ? (typeof(*__x))__u.__val : (*(volatile typeof(*__x) *)__x);\ }) =20 #endif /* !BUILD_VDSO */ --=20 2.53.0.rc1.217.geba53bf80e-goog