Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp280340lqg; Fri, 1 Mar 2024 05:15:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWnqo77UNyhzQ+ToWWIilNIUWtXQFkklhOuB6X74f92XkK4uMyAjqWKAAtxSmeV8O6MUZ0ao+vpTwtGLv7x5ftTCjlcmZqAdXIFqAkHVg== X-Google-Smtp-Source: AGHT+IHLLMCSQEuQjOmndA630vW4nDHV1S98C9eDgZ91dEFjJ26lWyUC+OdKYSLUEs1rVJVNg01+ X-Received: by 2002:a0c:e2cb:0:b0:68f:e80f:a27c with SMTP id t11-20020a0ce2cb000000b0068fe80fa27cmr1472271qvl.47.1709298954891; Fri, 01 Mar 2024 05:15:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709298954; cv=pass; d=google.com; s=arc-20160816; b=i9NFMgzHkitRdQXcSJkaABRlhF2gXPQjDWLL6RtRBcvGNSDr+ZWFVNrJrLtdiizv5+ jSYf4PEB9U/nSLbm2mZj7HaMuaQ5sWXyIiNaom8ERMndjUFV33YQrCNz6yP0EPd0swW4 UKbRdt2hx/ziyc1DGtXYA9xU9s7XN+LT5fqbccchrgNe0ENs1Puc0DnGJD15aYsc7+DT pjNAD6WSyVGMxENcJEhHHEfX4H9epXrzxxZT8guTCverB6tSfb4pvB+u7H2ej6HnsC8F 6Bb+88Z0a3Cjo55mpW061S3FARAVIHebj04xDkcEsrw/vxLfak0ZqD9jnQ6f1vVXtn/Z XPIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=b7jI6YpRXYWEOJt3lCJ5FPI/CE2amSmrkBbV5C7Gjjw=; fh=BXaEc0xf3ZcGZkegV8JVs6vGSfmcaQtCOawIxXBStIM=; b=NXUekfmvspQ8dDJ6tvaU/wRN75kELvfNen2TD+GJNAAzTDHiPC8p/7kGXEwjrMseys 7gZVW8GYCf2aGL3oA0PUrGiOAagxzGgzKFZmSzjgraj+f2Q7oiie6UmV9DbjI7FKWG4R tMqmwDS/JVYvUkK1zn2nCUce6SXEOf5Juf9ybkmFj/lNxjYXpqLGqY7SskMiKjou+bqE Zq/KuiO6/JYjTgRBBQHGZVXibiPLQtmQapsSUJSA5Hk6gAgOOIvf5vQIG86GTB3RADkf 1GvVTrXUXA13RP8cJL14BB5Ec7a59SlDGNbvGFxN6tQd69MmVhZ8V8njXUc1hO2pLoq2 1kqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AsYRQk45; 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-88443-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88443-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id iv8-20020ad45ce8000000b006903c840a3esi3581159qvb.438.2024.03.01.05.15.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 05:15:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88443-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=pass header.i=@gmail.com header.s=20230601 header.b=AsYRQk45; 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-88443-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88443-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7278E1C210B7 for ; Fri, 1 Mar 2024 13:15:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A6B76E604; Fri, 1 Mar 2024 13:15:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AsYRQk45" Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 EE7B66EB7E for ; Fri, 1 Mar 2024 13:15:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709298918; cv=none; b=NE8HtSfbK6aCY4y7vWDGHeRJCdwdWFsbRaNMOF/TlIp+mIGfyIaTWVQkGVxfmiAMEoRSvX4eBJ2/hKnP4ffT4P+X/pNFaWcNxM3TtkDqDWlbnilKceBmkVVjcRzrhsZRcEVhTwst906GUGRFLS2x+zVYfL9f3BaxGUUibPX0brY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709298918; c=relaxed/simple; bh=8mbZMluVV7uxCPUSfvI/xi4AxmELics9y5Dj7dgLU1E=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=L0nHi8hrcgyIiH7puRW1EltPAhp8aJHtBYOsFpa3boK/tBuWwyvkyvkG6GKyPRPM3B0X4N8VWUILPOm+zVo6t7LM4Sr7N8E6Qry9znv3XGgfzWLllpzC5VuMWx6GhI+Q07eZxWYOUOm5TcTAIxleYn+znn4AWifTSVgWdcaae/Y= 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=AsYRQk45; arc=none smtp.client-ip=209.85.167.42 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-lf1-f42.google.com with SMTP id 2adb3069b0e04-5131d0c3517so1975195e87.1 for ; Fri, 01 Mar 2024 05:15:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709298915; x=1709903715; 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=b7jI6YpRXYWEOJt3lCJ5FPI/CE2amSmrkBbV5C7Gjjw=; b=AsYRQk45By+X+HFe3EwpkJpNxKF9/NGb/2NySZ8/mbyYlR33Glt1Zl1ug/3ElyF9yd o7f4B6OzEPb9gEStENhuiPFj5R1qRASlGvECpekonyfukDk9jYKp5fxwF8Mtiz8KgDJp FRB0/rZyXfr6Av8HpEMOgWf3zf4r0bHcZCJ2Ieex/9NWaUwtSHoJS7JBIx45HsBFzlLn QgQTZtfWHWVyIRxeNfV29XrSlPcU7IDhmFkNfk0sT/kXDsuRxe19nH3/7vBuCDS0M1aj HmVNv7+Q8YIDbUkq6Rugx63VQZ08Uy5178wyHQh7VMGd1oyJeV0H9UA423Wlpjg03U5J YFsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709298915; x=1709903715; 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=b7jI6YpRXYWEOJt3lCJ5FPI/CE2amSmrkBbV5C7Gjjw=; b=Bh/d7Wm9qTqS2WHJDZAfgEgL1Nahz9rG83nLqjj+MdqIOQM4AfRns7zSYSC0NFmwtk CdtkmsgsbaYqWafGOqw/xd4yYe/jnwOQl2MbeTl0dmxB6K7w5ORyFiB2xlZZQNrSBFJh /LHRSMYTTJPDq8L6IeAsJdbYsCl2FnT4r0Ach+OpNPQOP8vdjSL+tckwX1aBvAB0Pqv6 kZivzvM57s0B2pWuSPpQ831y9KIgqD51WCWPdbIEgqC9xsj30esW3kFwva5dtocHnbky KCT4HsFBmt6xJRngt1P9RwMnBHlXh7ghrqdDxenUuO0qlfKsLnp8yay7Ph+jFNpgBK3N ek8w== X-Gm-Message-State: AOJu0YyKg/kPSBGGCtbxLsdh4+Sr7RmqVARJ+avMA8trcs/DBomDv/q+ dEkLjfyWt1crOp1tEJFhf6vV2y3BLG80474lKQeHqUtRw3lxU7NbhqA027UfhAr5X43e5znlu+S pPQpr55i0NK+/5BTZY3q78sLVLA== X-Received: by 2002:a05:6512:104b:b0:512:f29b:309e with SMTP id c11-20020a056512104b00b00512f29b309emr992425lfb.28.1709298914889; Fri, 01 Mar 2024 05:15:14 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240301084046.3370376-1-xin@zytor.com> In-Reply-To: <20240301084046.3370376-1-xin@zytor.com> From: Brian Gerst Date: Fri, 1 Mar 2024 08:15:03 -0500 Message-ID: Subject: Re: [PATCH v1 1/1] x86/fred: Fix init_task thread stack pointer initialization To: "Xin Li (Intel)" Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 1, 2024 at 3:41=E2=80=AFAM Xin Li (Intel) wrote= : > > As TOP_OF_KERNEL_STACK_PADDING is defined as 0 on x86_64, no one noticed > it's missing in the calculation of the .sp field in INIT_THREAD until it > is defined to 16 with CONFIG_X86_FRED=3Dy. > > Subtract TOP_OF_KERNEL_STACK_PADDING from the .sp field of INIT_THREAD. > > Fixes: 65c9cc9e2c14 ("x86/fred: Reserve space for the FRED stack frame") > Fixes: 3adee777ad0d ("x86/smpboot: Remove initial_stack on 64-bit") > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-lkp/202402262159.183c2a37-lkp@intel.co= m > Signed-off-by: Xin Li (Intel) > --- > arch/x86/include/asm/processor.h | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/proc= essor.h > index 26620d7642a9..17fe81998ce4 100644 > --- a/arch/x86/include/asm/processor.h > +++ b/arch/x86/include/asm/processor.h > @@ -664,8 +664,10 @@ static __always_inline void prefetchw(const void *x) > #else > extern unsigned long __end_init_task[]; > > -#define INIT_THREAD { = \ > - .sp =3D (unsigned long)&__end_init_task - sizeof(struct pt_re= gs), \ > +#define INIT_THREAD { \ > + .sp =3D (unsigned long)&__end_init_task - = \ > + TOP_OF_KERNEL_STACK_PADDING - \ > + sizeof(struct pt_regs), \ > } > > extern unsigned long KSTK_ESP(struct task_struct *task); > There is another spot in head_64.S that also needs this offset: /* Set up the stack for verify_cpu() */ leaq (__end_init_task - PTREGS_SIZE)(%rip), %rsp Brian Gerst