Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1502645lqg; Sun, 3 Mar 2024 13:20:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUbJNoxJ5aJ/GYtTA+sMuhyj2jGMz/3tbNDEp/igUC8hwt968sTYJB6kUdx1ip30YqhdtpxHElIQ9mCB5Vwn8uDlh84/zYsrGTPdcoqJg== X-Google-Smtp-Source: AGHT+IGbV5A97noRvvvuz9W1AXbK5uO6og1xk7Vfx1R2m24wEydQVOMs6Ogz4qQFoeOLIZVuJLiW X-Received: by 2002:a0c:cd10:0:b0:68f:52ce:ea81 with SMTP id b16-20020a0ccd10000000b0068f52ceea81mr7284219qvm.29.1709500811970; Sun, 03 Mar 2024 13:20:11 -0800 (PST) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id gs4-20020a056214226400b0068f45954c32si8363056qvb.30.2024.03.03.13.20.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 13:20:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89910-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=JY1J8DdB; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-89910-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89910-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (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 ny.mirrors.kernel.org (Postfix) with ESMTPS id AFB051C209D4 for ; Sun, 3 Mar 2024 21:20:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD80D7A707; Sun, 3 Mar 2024 21:20:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JY1J8DdB" Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (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 67BF8A957; Sun, 3 Mar 2024 21:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709500806; cv=none; b=LTZH+F3zSfbg9cxcN8pi/zgyuJVRhSHcOOb3HvQM/SPgO3wcQGdjW2W1UfavKmBPP6DcUXM8EnaOE/kpCpri+lZ/+zMZatOBSaMS3o0Ga1RdCwfDeMaoBuhf/vyVuFOYiDamLQfnYnaRcAo+K9m72snnS8z158JUA5vJuHlg7As= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709500806; c=relaxed/simple; bh=b1+PGDPg3AaCd4KGYAy/tgATvccAE7wfNpG/Ok+p19I=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=FlUOJNoctnv8wlB1EaqTZ/+OpbY6tE9bvOxNyicVK7ddvtcAcktNI7mgET9S9JatehxytJIS2ywh0g0fAmJm78R4zRFLTPjBlppKt3z6Bf+w6+Wao2P/QAsFlCsHfHjcJLGk8oNhKEy4z2OpKFbDht0dKzbJKmumQLrqek8tJUo= 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=JY1J8DdB; arc=none smtp.client-ip=209.85.208.177 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-f177.google.com with SMTP id 38308e7fff4ca-2d311081954so42019111fa.2; Sun, 03 Mar 2024 13:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709500802; x=1710105602; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2BwYkjBXlBZesoIUNfa0a3rUePDN3R4LPFfw17Gvsbs=; b=JY1J8DdByHMwTQK+qO9xnml1DaSXZMAdWdzz6fCIbi1zTRnt5V8jNTSglbT28ogMLu rAI67tE3zSuywEdNJ2AYwy08DnVUO0v5MHqJGbAm87SG2hN46ABtrSgIBT814DQPCEav g1ICN69E4BP84qenVfr5scZYK94qCRMHVE48Sffe1Xn61k7etoT7JfR6QK7Kn8ODDmRt 6sa3nw2/FMIxe8Q5VuQ5NxvlfRVFOrQsZAP4R8nGrrTUt7FJj6KYa2Y6idbRvBIQ1v4t q/ryPC03yKEJKIKU2bv5Iph/+p/vLrNhY7fCbX9YD+r0qIInRqs0KgOmoE8hlzvDUqUx ljEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709500802; x=1710105602; h=content-transfer-encoding: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=2BwYkjBXlBZesoIUNfa0a3rUePDN3R4LPFfw17Gvsbs=; b=LOURs2GgTA5T1X+g2tRTfBktmUSp2XPPYz6db4wwNxL5dLPRkhwGzNBTA0Ynt8zZ/l 6VVvP2rs1JFCVsiULqeQxLVaSrzjnRRLEkU5NMwt21qBy1r8TKyDRCJA0+YW5U+ih6IO N636eD1w6an4q0hLVU+k8TMuFxO5T6dWzatvrhJumzyT8Ts3eq/tnEGcY8wTyIYOVtJs 7ulQ/UBISfCTYXIA5sPyzmj7GxGqBhZU2R6Az2MnUkgiuWQmqszXZuecB5Po25qBG0Wr VAppd3n6SwuauF603jFNTPiyo5/1tvo2DaRG+yACqGgcOcwCb3BdInQnk3Xqoou/623P fjyA== X-Forwarded-Encrypted: i=1; AJvYcCUD5uRAkQg0Am+Du0SJBXHiAfg30XHTIKcShLAzlTSFroXLfvUB2Zxq65rNmTXshceRGD/MhLH72ui5vx7DUDfDcZsIhp5+zxnqXENzpJqGlzNTFvPu8AgPxnIKYLkmcb4WesCoNQQsaHhz X-Gm-Message-State: AOJu0YyY6q3eQq1+XmnOD2bD8xyiAMgHn8HHyDpQBg70WHYgNHhe2Fw2 j5kFZd7lkIYh74rE4Rp4ErTT0qzT+CYnCksmfGVuHCKC+kI12Rk99FKxKjY37T3rkxAne2+0CsK Qwb+pNf2JSLUdSPjiuRekJT/igB18VyMgOvM= X-Received: by 2002:a05:651c:1689:b0:2d2:9fc2:9bb8 with SMTP id bd9-20020a05651c168900b002d29fc29bb8mr4590358ljb.25.1709500802496; Sun, 03 Mar 2024 13:20:02 -0800 (PST) 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> In-Reply-To: From: Uros Bizjak Date: Sun, 3 Mar 2024 22:19:50 +0100 Message-ID: Subject: Re: arch/x86/include/asm/processor.h:698:16: sparse: sparse: incorrect type in initializer (different address spaces) To: Thomas Gleixner Cc: Linus Torvalds , kernel test robot , oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Arjan van de Ven , x86@kernel.org, Luc Van Oostenryck , Sparse Mailing-list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Mar 3, 2024 at 9:24=E2=80=AFPM Uros Bizjak wrot= e: > > On Sun, Mar 3, 2024 at 9:21=E2=80=AFPM Uros Bizjak wr= ote: > > > > On Sun, Mar 3, 2024 at 9:10=E2=80=AFPM Thomas Gleixner wrote: > > > > > > On Sun, Mar 03 2024 at 20:03, Uros Bizjak wrote: > > > > On Sun, Mar 3, 2024 at 5:31=E2=80=AFPM Thomas Gleixner wrote: > > > >> I did not follow the __set_gs work closely, so I don't know whethe= r Uros > > > >> ever tried to actually mark the per CPU variable __set_gs right aw= ay, > > > >> which would obviously catch the above 'foo' nonsense. > > > > > > > > No, because [1]: > > > > > > > > "gcc does not provide a way to remove segment qualifiers, which is = needed > > > > to use typeof() to create local instances of the per-cpu variable. = For > > > > this reason, do not use the segment qualifier for per-cpu variables= , and > > > > do casting using the segment qualifier instead." > > > > > > Right. I just figured that out myself when playing with it in user > > > space. > > > > > > 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]. > > [1] https://en.cppreference.com/w/c/language/typeof FYI: gcc-14 compiles this testcase: --cut here-- __seg_gs int a; __typeof_unqual__(a) b; int foo (void) { return a; } int bar (void) { return b; } --cut here-- to (gcc -O2): foo: movl %gs:a(%rip), %eax ret bar: movl b(%rip), %eax ret So, it *does* strip the __seg_gs qualifier here. Uros.