Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp469929lqt; Thu, 6 Jun 2024 08:47:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX9UKZJZ0QPsyXs+KYI2+QVzn8LgasXVVcTQ+Y721UCpYsGoWsSvknD5fM6oH9+t5psIYxmGw3hiRx3GxCU/8wm0M67cOcE1seY2YmKoQ== X-Google-Smtp-Source: AGHT+IFNH0PzrMp5oBE+RxCGmMGykSvSbSbVkXKwgB6yryRRGG6lVQNcOgzxoRXFBFM95tVDOUdG X-Received: by 2002:a05:6a21:3295:b0:1b1:f322:4c81 with SMTP id adf61e73a8af0-1b2b70504d6mr6909919637.36.1717688847270; Thu, 06 Jun 2024 08:47:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717688847; cv=pass; d=google.com; s=arc-20160816; b=ZSGwp82l/iM/zvGC7nxU7UzNqW7CmOOPQHCym0+kiLy+YdLLGHY7UV+odWxvG94ejU 9NgX14eq61l/cH8PqUmprAIHAKKury/N7c1X1ithm6ZxznjVb1T9pD0KA8kpf7W1TsRQ 4vqrGr6V+igU/iqrh+idAqX7+ioetTMmLmkvvJtwkcW20W6/aN8UnEkUeJZy2m6Cg+HP 8OlftWmDgaPsfSPBV5n4VGD67O5dnguHx14ETESBWS4jzGY/BXYDN3kNGTuketX8XmW0 02ZqlHhV0XSZM4XuY7glSBrNevo4Sod5+c9uSRE7S44m3YnAHRCwq8Y+xLXW7Yp2Ki9H yUaA== 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=Pyiq1sRZOIKUcWY3fSoYAYeVrpMvl8oHpujcmV9B7v4=; fh=/DK9Xnva/kj8cmL8Ewmt+sXvdjlMH1UsNYVfAepyQGI=; b=m9i/Mg/VM6wUwuE3MbN+9CHhbVTP273CnJfVhSobZc+dW475sBX1bha7SRZskajZim BZFRHRsb6ToJKb4+ARvSgl3lrp00ZzLDOZOUx2t6a3AvcAN0L7/CDPmRAOx/HGzm+pPS YmLsdL9trr22E/xxSOIejz0bS1NSKxq1I1rDZZeqdLKoVy0U3q9JQ367zBM1g6Dnt4sy lgQjcxpUEnhfJzd3kDWulfBJNEL/dA3IhUwsW25+r07nRXG0ePoO8WjD0vX3qxOeMxUv 9S/ZkqXZraxn06cmmnm44hJVqNq+nSk3MfEiWKuNrHwIdyVewh5elRPt0slDqmydN9yE nP1g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DnKaB05e; 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-204585-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204585-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de208318f3si1393221a12.94.2024.06.06.08.47.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 08:47:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204585-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DnKaB05e; 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-204585-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204585-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 B34D928312C for ; Thu, 6 Jun 2024 15:36:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3FF40196C89; Thu, 6 Jun 2024 15:36:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DnKaB05e" Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (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 C6E1D194ADF for ; Thu, 6 Jun 2024 15:36:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717688172; cv=none; b=huUC9AhrhitCjPZqhJ6oCfiMyQFDkCTH1IYG45hSmbkFkgfJ7jYYzWM8mkZQEZ/UdHzqgM4xldJYxMZSeGGzB0jZtg3bC48HJmCueL1BgM+TOG7Ihc9pnu9AbbK2pPcbIe++cEazzJCVHuKHGkpcb6tJO8sm3G1DthoqOV+PJs8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717688172; c=relaxed/simple; bh=PeDlhjT8ut6E9aKG5RIVbh/fG7BR4qLOOB65IxE1J9A=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=JZ5mFd4dG0s7vCG9SQtW1Pwp5F67H9IC32drU2qMMdBwGaA7gNaTqTlDXip99wJ1cH4cWeL2nI59usIbpwwuVh/Q2x6T4f128ArQLv2SqnGz7wJkxaq3f1I+crYTMYpFNl/ilFO+oEWOzt5Oaho1kiwFnt5COIPym0iZaWv0rIc= 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=DnKaB05e; arc=none smtp.client-ip=209.85.167.41 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-f41.google.com with SMTP id 2adb3069b0e04-52961b77655so1309292e87.2 for ; Thu, 06 Jun 2024 08:36:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717688168; x=1718292968; 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=Pyiq1sRZOIKUcWY3fSoYAYeVrpMvl8oHpujcmV9B7v4=; b=DnKaB05eccfIAt/C4CYbAhTKKOwE/SMPwFgJpGjhS3woxmo2+CJypdIK6oaDN1YiW+ q73QrQ7YTour5BwWTqHVrERTBIChu2M9N+rZAd88Wk8OM7RkEzi8q2WzAxTtJapjoebU jA8rEbqlfblph4HScoqXsu3ja58Mu2TvHAxvs5eoiVvW9s64hiCL+sYLmz89uGo9ZKxf CTP4TR8R9YzHxI3H7K9HQnzjEmnj0Ib6R/YjRAZPUSjjx94T+YtfTkI1hRuXu1i1Es2f zXkv0c7rFajw1OExJANAXHBBXKGMmB8wPhNrw59p8E1C929Zgd5ElTiJeBSai9+3lNSH vaEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717688168; x=1718292968; 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=Pyiq1sRZOIKUcWY3fSoYAYeVrpMvl8oHpujcmV9B7v4=; b=Xqc80V6ogOlfBymzX/8CUrntPKfZOjMlLawDoQWa0XtnetTSRwnC65+ri8UsHpWlC3 cl7OQQzwAS65nzO8+rvqcU7pKAxxMZx6gG6xOrvuraqKEJ0f0Ny1KmsXa71AHlV5WVon zt3IlLiiiyTynXVXR4kDvXJNrxufaM3Zp5nvsGhU/foCSTsaRa78F3zP481C9Pra2QO6 hCJhn93Z4JIxwRlc8hfFzGgkr8h6hp4nkM2OWNUreNa59KNzHP5hx1lSRtuFUbEAhtim Ea76GYfmJMnyfEdnrGGp/j2f+obRWiYbIqAy357D1hJGHqB4ZmNsXYM+v+/BvAVS4Cnf MpwQ== X-Gm-Message-State: AOJu0Yzppboq0Azp+TRk5efetBwjnsxvaHpzph0WaNGGSiUt+AhD6Xi0 2bA50ZcGsJxXqRXrf0Yr7V/uXw8YQYEzWbCAPLvBf60tq19gfB12gQwEKM01N/NsjfFcW3ZOI8n YE21hh5FxMcajcBVXkdqKl6DbcA== X-Received: by 2002:ac2:5927:0:b0:520:36bb:a6e1 with SMTP id 2adb3069b0e04-52bab4e777fmr3309879e87.29.1717688167638; Thu, 06 Jun 2024 08:36:07 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240605083557.2051480-1-mingo@kernel.org> In-Reply-To: From: Brian Gerst Date: Thu, 6 Jun 2024 11:35:56 -0400 Message-ID: Subject: Re: [PATCH] x86/fpu: Introduce the x86_task_fpu() helper method To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Andy Lutomirski , Andrew Morton , Dave Hansen , Peter Zijlstra , Borislav Petkov , "H . Peter Anvin" , Linus Torvalds , Oleg Nesterov , Thomas Gleixner , Uros Bizjak Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jun 6, 2024 at 5:06=E2=80=AFAM Ingo Molnar wrote= : > > > * Brian Gerst wrote: > > > > 17 files changed, 104 insertions(+), 107 deletions(-) > > > > This series would be better if you added the x86_task_fpu() helper in > > an initial patch without any other changes. That would make the > > actual changes more visible with less code churn. > > Makes sense - I've split out the patch below and adjusted the rest of the > series. Is this what you had in mind? > > Note that I also robustified the macro a bit: > > -# define x86_task_fpu(task) ((struct fpu *)((void *)task + sizeof(*task= ))) > +# define x86_task_fpu(task) ((struct fpu *)((void *)(task) + sizeof(*(t= ask)))) > > Thanks, > > Ingo > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> > From: Ingo Molnar > Date: Thu, 6 Jun 2024 11:01:14 +0200 > Subject: [PATCH] x86/fpu: Introduce the x86_task_fpu() helper method > > The per-task FPU context/save area is allocated right > next to task_struct() - introduce the x86_task_fpu() > helper that calculates this explicitly from the > task pointer. > > Signed-off-by: Ingo Molnar > --- > arch/x86/include/asm/processor.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/proc= essor.h > index 920b0beebd11..fb6f030f0692 100644 > --- a/arch/x86/include/asm/processor.h > +++ b/arch/x86/include/asm/processor.h > @@ -507,6 +507,8 @@ struct thread_struct { > struct fpu *fpu; > }; > > +#define x86_task_fpu(task) ((struct fpu *)((void *)(task) + sizeof(*(tas= k)))) > + > /* > * X86 doesn't need any embedded-FPU-struct quirks: > */ Since this should be the first patch in the series, It would be: #define #define x86_task_fpu(task) (&(task)->thread.fpu) along with converting the existing accesses to task->thread.fpu in one patch with no other functional changes. Then you could change how the fpu struct is allocated without touching every access site again. Brian Gerst