Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1637855lqa; Mon, 29 Apr 2024 14:38:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVgu2CbFCp+3dQKEyMfX25zqPaB7i++rcO0eVfRHO2dvKqC1ZWioj55sALATSiKU2G2CpkoiXeE6acaeAtW6xroy98uLlc9NfSCmGZOkQ== X-Google-Smtp-Source: AGHT+IENLxYItW5F+Avsom7YiFFzPy7H3MNjT3noZS0Na2IXeMk45GERNwi1Hj+FnLwXtAkzQVD2 X-Received: by 2002:a17:90a:888:b0:2a5:3f9a:97ae with SMTP id v8-20020a17090a088800b002a53f9a97aemr11076378pjc.38.1714426695300; Mon, 29 Apr 2024 14:38:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714426695; cv=pass; d=google.com; s=arc-20160816; b=z9lyO6o1h5mP9jLRqfwjIyloPsX6H81lnFlakwx+JMbw0JgaTDJD2smko3hMFUJbKO 5BO+DR23wKOJOxBeN6hFr9ttbOeUlFQX1HEeR5ZXzEwKRo1Ci0RcHFc6ry0Rme4L8Q7Z CSahxxCRkpzWnNbodRPlQi0Zk3vOXCtR/4foqlDKBMLOk1dzCPTuJrNgcA930ebWvd6Y gwgeQZkgU+4DI4wghjpvV02l8aqx78E/lLSShYJM9c/71ebcLYSul+ypqli9JUbw+b8i jnpwbEIB9EoySha64JlIJKWqnjPq3QN+N8vJy+s8FZ2a/gpn4QYzqlShYoVX0Ncwnd2d CsBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=OIprfau9HNmVx8+h0zObXjXi6FS5vux/SKaDT2brkWE=; fh=Y7/mu50QUXrVRugqWTXEiRA62vwMbdmWI/bhNXU0aI0=; b=mLLGKiO/jr9bqDGsUlgv6IoQfGRPl5FyqNqMcJqLp36+9Ov+pziZkeHfQBoOU+LUrK IoW1WHC6112v+o0XnBeGToqljiEyMp/sZRsl8BVHUMJPNI7ZR+PiGBRaJjDTOE3tgxKU E610gTs7iRIPEfQEk2S+6Lh8nBMJkEqtxn07kvU8KRFAkV2y/VRv/u+xZzmPPNK7N4c5 Veiqiiax+L7smL5ryLzTYnjX17gflfdej4+99hYemGXS69ptqGOFbGIP6QAp82t4AzJS K2Z6f4cB883RV+tLbhLG8wi8G6O2tQPLlngzs9CpKeXFce9aMEJMlSf3lSABeZpMnKpO 93KA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=D8sSBLeL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163072-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163072-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d5-20020a17090a8d8500b002a22f4dba43si20547390pjo.17.2024.04.29.14.38.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 14:38:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163072-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=D8sSBLeL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163072-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163072-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9C9B4287839 for ; Mon, 29 Apr 2024 21:30:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EDD61836FF; Mon, 29 Apr 2024 21:30:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D8sSBLeL" Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (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 DF5431836DE; Mon, 29 Apr 2024 21:30:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714426226; cv=none; b=lt3gKh1WEnkDL1m4IgopVdiY6oJwGWt7UwpS1Hsx8NFs3AcRdk7QAEvAJ+H+GL4dEZ04B23M5VLpZdzQUhbzBgIr4hEwRtPaTFngJIpBMiFRalL8Wc7Lnj7nH4klqDast+d/p8gi8CGeJv1OZDiI8F+gv5SQ3mLiEOHEPYWdEGo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714426226; c=relaxed/simple; bh=kpvICPZMlsZfPJroQtt4wrumVDC1dFOAcBXHJhfrORg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=EcmsWIJ8NqzaZqxC2TTuI+8NlDYItDrnUpl5AD45RnkRhf9kq3O/+mRUB5JDhjwZMqrqyjLBQ7gqeiwg63l1Hjt+tjkFcHZcZ4Y/4qGzSS8T6nQgqCETK9xzAR8yNooLupJYEDjSOLsPIGHlwcm6tFuic4AwILnQdP67A1r/M3s= 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=D8sSBLeL; arc=none smtp.client-ip=209.85.208.174 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 Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2e060d49f87so11553201fa.0; Mon, 29 Apr 2024 14:30:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714426222; x=1715031022; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=OIprfau9HNmVx8+h0zObXjXi6FS5vux/SKaDT2brkWE=; b=D8sSBLeLB6QgC9VLfrx2FJktuj2Tfp0v7AZzgR2NmTlXR+p50bQKZduODlIjgEpdDe s1MG/urzwT9qpjw+zZmZgLYE0SkSRiC6Tuc+4Ak6sGNcuH8E4G6mLheVNo79FTLZrYpd /V2eaqaZDc8SK50hJP98SrUuSdd7Oukws+6+MLogRJ0/vYUB9X+3mT1scz5j9PoM2xf5 RpW/Bw3hcOsM+PrLUSoWZlLk7+bvddA99LfHWw5xJAZ+0P2mVh3+uqaY+/alV3rcqMH8 fhZd9yG4mm5epE+Mjm+qSIonp4FGiBcJEJGD3vdnvNe5wsg+L1W2Rb7aXYKcuOP+1KIc iBhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714426222; x=1715031022; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OIprfau9HNmVx8+h0zObXjXi6FS5vux/SKaDT2brkWE=; b=A+cpRxBSCwA9+YBKrZePQHPQf7GWZ0avHYhEGHO/CEUAayCIguWfhoSwMPzejyXW1M O/GDsKRO4QMYnrKuR7JppmhaXPhLY00Rn4SitqFld9IgItzIol6V6FLwrTgYSDFVIal9 d1TfR7nunIj/xNjcC6NbUDIPdP9t0VvuYy5b6JwQ0r1cyfq4QOJHSLKrhs+e+V8G8pwY Pw0AERLk+hjmdNkU0N0WlMZQLsfaUt7lIZUZ+8Et8VrvIkRfCtVCLwgXcYvg9gago5GF hrzMb+YK5uNhGw/uN4d+PzRsUyQhuvFYj9uRtwzENsCBsf8P322WUgWUceFV9q8fxQ+E 5KiA== X-Forwarded-Encrypted: i=1; AJvYcCVXVepzQL45nUyMPg3ZvW1Nh5SSucSwuXEV6C7LdC+dL0J0BSIQhndHPEvj+SH/SgGthrKbaG3g4h4GVlwwzybA5GIOCpRTHtoOjGGwVYUf8bTThouW0CGwaJR5L+E0rvfyqMwyz2L/4UCX X-Gm-Message-State: AOJu0YzMx3jHMNwsGG5y5xDRmP/uDHopPr6nqxp8OKunBfSaSMdJN1g0 HOioXa3WGJcP3LyGb7SPgmmkcyVPzOef2333GfsZokXtZYHuYT3zVw/iOnXnmmMkYQzx3GN9tY2 00UhrOwC9dVc2EYLc/D0RTlVg+z0= X-Received: by 2002:a05:651c:198c:b0:2df:1c6a:214b with SMTP id bx12-20020a05651c198c00b002df1c6a214bmr322490ljb.13.1714426221796; Mon, 29 Apr 2024 14:30:21 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <202403020457.RCJoQ3ts-lkp@intel.com> <87edctwr6y.ffs@tglx> <87a5nhwpus.ffs@tglx> <87y1b0vp8m.ffs@tglx> <87sf18vdsq.ffs@tglx> <87le70uwf0.ffs@tglx> <87edcruvja.ffs@tglx> <87bk7vuldh.ffs@tglx> <87bk7ux4e9.ffs@tglx> In-Reply-To: <87bk7ux4e9.ffs@tglx> From: Uros Bizjak Date: Mon, 29 Apr 2024 23:30:09 +0200 Message-ID: Subject: [RFC PATCH] Use x86 named address spaces to catch "sparse: incorrect type in initializer (different address spaces)" __percpu errors To: Thomas Gleixner Cc: Linus Torvalds , LKML , Arjan van de Ven , X86 ML , Luc Van Oostenryck , Sparse Mailing-list , "Paul E. McKenney" , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Dennis Zhou , Tejun Heo , Christoph Lameter Content-Type: multipart/mixed; boundary="000000000000f1b815061742f5a7" --000000000000f1b815061742f5a7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 4, 2024 at 12:49=E2=80=AFAM Thomas Gleixner wrote: > >> > That's so sad because it would provide us compiler based __percpu > >> > validation. > >> > >> Unfortunately, the c compiler can't strip qualifiers, so typeof() is > >> of limited use also when const and volatile qualifiers are used. > >> Perhaps some extension could be introduced to c standard to provide an > >> unqualified type, e.g. typeof_unqual(). > > > > Oh, there is one in C23 [1]. > > Yes. I found it right after ranting. > > gcc >=3D 14 and clang >=3D 16 have support for it of course only when add= ing > -std=3Dc2x to the command line. > > Sigh. The name space qualifiers are non standard and then the thing > which makes them more useful is hidden behind a standard. > > Why can't we have useful tools? > > Though the whole thing looks worthwhile: > > #define verify_per_cpu_ptr(ptr) \ > do { \ > const void __seg_gs *__vpp_verify =3D (typeof((ptr) + 0))NULL; = \ > (void)__vpp_verify; \ > } while (0) > > #define per_cpu_ptr(ptr, cpu) \ > ({ \ > verify_per_cpu_ptr(ptr); \ > (typeof_unqual(*(ptr)) *)(uintptr_t)ptr + per_cpu_offset(cpu); \ > }) > > unsigned int __seg_gs test; > > unsigned int foo1(unsigned int cpu) > { > return *per_cpu_ptr(&test, cpu); > } > > unsigned int foo2(unsigned int cpu) > { > unsigned int x, *p =3D per_cpu_ptr(&x, cpu); > > return *p; > } > > x.c:29:23: error: initializing 'const __attribute__((address_space(256)))= void *' with an expression of type 'typeof ((&x) + 0)' (aka 'unsigned int = *') changes address space of pointer > unsigned int x, *p =3D per_cpu_ptr(&x, cpu); > > That's exactly what we want. It would have caught all the long standing > and ignored __percpu sparse warnings right away. > > This also simplifies all the other per cpu accessors. The most trivial > is read() > > #define verify_per_cpu(variable) \ > { \ > const unsigned int __s =3D sizeof(variable); = \ > \ > verify_per_cpu_ptr(&(variable)); \ > BUILD_BUG_ON(__s =3D=3D 1 || __s =3D=3D 2 || __s =3D=3D 4 || __s = =3D=3D 8, \ > "Wrong size for per CPU variable"); \ > } > > #define __pcpu_read(variable) \ > ({ \ > verify_per_cpu(variable); \ > READ_ONCE(variable); \ > }) > > which in turn catches all the mistakes, i.e. wrong namespace and wrong > size. > > I'm really tempted to implement this as an alternative to the current > pile of macro horrors. Of course this requires to figure out first what > kind of damage -std=3Dc2x will do. > > I get to that in my copious spare time some day. Please find attached the prototype patch that does the above. The idea of the patch is to add named address qualifier to the __percpu tag= : -# define __percpu BTF_TYPE_TAG(percpu) +# define __percpu __percpu_seg_override BTF_TYPE_TAG(percpu) So instead of being merely a benign hint to the checker, __percpu becomes the real x86 named address space qualifier to enable the compiler checks for access to different address spaces. Following the above change, we can remove various casts that cast "fake" percpu addresses at the usage site and use the kernel type system to handle named AS qualified addresses instead: -#define __my_cpu_type(var) typeof(var) __percpu_seg_override -#define __my_cpu_ptr(ptr) (__my_cpu_type(*(ptr))*)(__force uintptr_t)(p= tr) -#define __my_cpu_var(var) (*__my_cpu_ptr(&(var))) -#define __percpu_arg(x) __percpu_prefix "%" #x +#define __my_cpu_type(var) typeof(var) +#define __my_cpu_ptr(ptr) (ptr) +#define __my_cpu_var(var) (var) +#define __percpu_arg(x) "%" #x As can be seen from the patch, various temporary non-percpu variables need to be declared with __typeof_unqual__ to use unqualified base type without named AS qualifier. In addition to the named AS qualifier, __typeof_unqual__ also strips const and volatile qualifiers, so it can enable some further optimizations involving this_cpu_read_stable, not a topic of this patch. The patch is against the recent -tip tree and needs to be compiled with gcc-14. It is tested by compiling and booting the defconfig kernel, but other than that, as a prototype patch, it does not even try to be a generic patch that would handle compilers without __typeof_unqual__ support. The patch unearths and fixes some address space inconsistencies to avoid __verify_pcpu_ptr and x86 named address space compile failures with a defconfig compilation, demonstrating the effectiveness of the proposed approach. Uros. --000000000000f1b815061742f5a7 Content-Type: text/plain; charset="US-ASCII"; name="pcpu-unqual.diff.txt" Content-Disposition: attachment; filename="pcpu-unqual.diff.txt" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lvlh32xn0 ZGlmZiAtLWdpdCBhL2FyY2gveDg2L2luY2x1ZGUvYXNtL3BlcmNwdS5oIGIvYXJjaC94ODYvaW5j bHVkZS9hc20vcGVyY3B1LmgKaW5kZXggM2JlZGVlMTgwMWUyLi5kMjUwNWE0N2RjMjcgMTAwNjQ0 Ci0tLSBhL2FyY2gveDg2L2luY2x1ZGUvYXNtL3BlcmNwdS5oCisrKyBiL2FyY2gveDg2L2luY2x1 ZGUvYXNtL3BlcmNwdS5oCkBAIC04OSwxMCArODksMTAgQEAKIAogI2VuZGlmIC8qIENPTkZJR19T TVAgKi8KIAotI2RlZmluZSBfX215X2NwdV90eXBlKHZhcikJdHlwZW9mKHZhcikgX19wZXJjcHVf c2VnX292ZXJyaWRlCi0jZGVmaW5lIF9fbXlfY3B1X3B0cihwdHIpCShfX215X2NwdV90eXBlKCoo cHRyKSkqKShfX2ZvcmNlIHVpbnRwdHJfdCkocHRyKQotI2RlZmluZSBfX215X2NwdV92YXIodmFy KQkoKl9fbXlfY3B1X3B0cigmKHZhcikpKQotI2RlZmluZSBfX3BlcmNwdV9hcmcoeCkJCV9fcGVy Y3B1X3ByZWZpeCAiJSIgI3gKKyNkZWZpbmUgX19teV9jcHVfdHlwZSh2YXIpCXR5cGVvZih2YXIp CisjZGVmaW5lIF9fbXl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