Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1504977lqt; Sat, 8 Jun 2024 00:32:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV+4P82ycg+b1qeg/+VMc8I5mN4ycCp9gAzAtOoJujnPqk2NNacjTBieNLHbdalTOy+h7nEFPXcfntL6Klikqe39+PLKqzUM68AkhlBSQ== X-Google-Smtp-Source: AGHT+IFPwfm5M9icLOwV83hjhR2tj0JKkg0rVfCCzWxlFspgkyn1MIPyBrWBPML/qEJd3B8x/aUG X-Received: by 2002:a05:6214:534a:b0:6a0:c903:7226 with SMTP id 6a1803df08f44-6b059cf893amr50991736d6.34.1717831945804; Sat, 08 Jun 2024 00:32:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717831945; cv=pass; d=google.com; s=arc-20160816; b=iN6RYKk0dUyzW6w28ytNA95dwM5kMoSQvUxb9dk0S2p1K3tOBeyMeSVTQ8BPz5AyKr XZiMYWF2i5HJI5mkzMeL8J3JXRhPi8Oa8t5Enjv3lXFAJHkqQzVGGZeQtRomH81RpaUV +mxR3+smYNgjGyaAWFEZyrbFHST25ztFcYBuwFtgVlXEmixfxkBW9dNahnOXJR2equrM Xf8NlcGRZqlJPxIeqJYZzpMWKXY4BZd7Q4pKOSEtm3pNomzL4Jh6Qy8u14G6Fzkke4Vp w45mgJtxMsUTr9pnVw8cVfCE5VhaOL1PLpb0jwkCFFeI778si+hwwk3eKUWF5iaozdNk JJQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:sender:dkim-signature; bh=cqNcSIg+6dYdCCgXrXKU0UnjWVh0bWICssUxVg3vCx4=; fh=ZrHbDSiANSBCmvivbV48JgZ35KGtehFV6ZNj4vR8U9I=; b=d/dLfT8mK2++XKvhgzBJ1yckw6ADTfPZ5y2DakRczxOvIAlzb+xssFQ+VZfLOpCSyX n9hcu5xlYLs3NW/c660YPE1bZr5v7GOSNHbypwfO/dV4UaSmgogrkZm/fN+xV80nUTzf 9tqx3cop6vCePL6dNtOIPKjMuhKK3+7iUMU9dbhQtfPLhEqkgQAGcxk5Ghm9S7tMhs8L /PuMyRyUTqVyhzUTMh+nOzUGvVlVzPrk/YdM66KKletPMbWJe1B0KJ38rxKu9267qX+8 ng9JyNoY1qs9cYU6HA/y5xl+ePfX4qxiEORbiN85hQHnuyoTqWagJv5r9lGFMXstGFn+ qz3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=juoPaTWB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-206923-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206923-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b04fa28bb4si56307656d6.504.2024.06.08.00.32.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 00:32:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206923-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=juoPaTWB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-206923-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206923-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 831BB1C219DD for ; Sat, 8 Jun 2024 07:32:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D7884176238; Sat, 8 Jun 2024 07:32:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="juoPaTWB" Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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 4125C8495 for ; Sat, 8 Jun 2024 07:32:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717831939; cv=none; b=p2hfeALJXy+baF+rC6KwOEN2oWSQAwhMkT1qHXbSxFMdzm/85j/61A2bcgorD/lGy/DSqJ4J0W+B74VBRP8nUWk4UElPs5JVwcApkeczhBCH/tTVZhjbSGJCZK4QxS3gAS9J5CSPpjiieqXRl5MEymb/wRkjBnAKZWjhmVIjZIo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717831939; c=relaxed/simple; bh=AZKBFN90tKnMMc/N26fS8u6OF7W3eyf/sCjLniLMvoM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KPujPDpVFWm0Jd1quRPtkXJCXCmlWREQXI3TyPxCeMr5YlpA5MXHzYFimkVUqdYJS4c4FeVrQEax7jSjX0TnspOTeIP5fKQ1EBiAbS/jFijNwdbC2iZdq3HaBKotJKW5xK7L2zqf8InakiGKb32A/ChXqYHzJSKp1xbyYmBtgEQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=juoPaTWB; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-57a1fe63947so3591520a12.1 for ; Sat, 08 Jun 2024 00:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717831935; x=1718436735; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=cqNcSIg+6dYdCCgXrXKU0UnjWVh0bWICssUxVg3vCx4=; b=juoPaTWBeNExpcr6KR72EpSj0a5J+JbzEnaVX54J+fZ0y4xu4/yv9SPMc6JYKHWzuZ kp1Ny2Cxy9LmPLgxNLYqRJaaX7XrcrcBQxYnprhJB8+1jmf6W30JLoiylpx1zNTvnsEV UPh3c+TBLszDtIias33mv0CuG+GM1KkN2SMBpSsYPxjZlRuQXK6Y+eHY31SsvlAEYUWi GdogKHnjzauq4NHf4eqb4SgLzHYNpWi8TeadgpAytqNXlpHcZ05KY1JZUJdKVaDzdSmk 6k8Dk8FMyGYEM+WnLxgVxSHydeyLeeU8ZoqmTtrHRF0LRQgdXBjk54I86aRtSzCapgTZ pepA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717831935; x=1718436735; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cqNcSIg+6dYdCCgXrXKU0UnjWVh0bWICssUxVg3vCx4=; b=VJAB8o3rw+tSTZkqSQLEJYM23uvt235OoWEy/mzC0U7++GWKWdhV39mHKT8goBinKG dEZnoELtujBmruxgCIUPWgihSYvXBbMoIrGHlygSVKgq60rH/BNyrEUZ0ED6JKaxHnGN WgkPeHC8/elD3uV6LDCcgOKx5laDQhK3lXUBgk/Xhyx1gf4xX8khpankqAZtNZzewhdV JVhDv4703m55khsIQT5yAdOKmYFFTvCnaM68RPUzw4k7CuOoeaJ63vaYvItrZKiYCmle nAMx54Lx9BPRAWlg5I3kyJMlJK7mjLoZ0g4cYwzIyQ6wMIBWu351W4BnXQgRjwIJoxTf kgmw== X-Gm-Message-State: AOJu0YyejE2nZZ0v/gzAU2rPHBQOC1rhHFMGo88B2Wz/daXvbkE3Lu+/ kRHNFTAq4TNGH8X1qExNsy3kgbGVWHrXfeIvOsPBYo3+8YJYti0j/d6K+2D+ X-Received: by 2002:a17:906:7705:b0:a6e:b1f:5e17 with SMTP id a640c23a62f3a-a6e0b1f5e6bmr195540066b.54.1717831935042; Sat, 08 Jun 2024 00:32:15 -0700 (PDT) Received: from kepler.. (1F2EF20A.nat.pool.telekom.hu. [31.46.242.10]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6efe5262cdsm61350466b.117.2024.06.08.00.32.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 00:32:14 -0700 (PDT) Sender: Ingo Molnar From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Andy Lutomirski , Andrew Morton , Dave Hansen , Peter Zijlstra , Borislav Petkov , Brian Gerst , "H . Peter Anvin" , Linus Torvalds , Oleg Nesterov , Thomas Gleixner , Uros Bizjak Subject: [PATCH 00/10, -v4] x86/fpu: Remove thread::fpu Date: Sat, 8 Jun 2024 09:31:25 +0200 Message-ID: <20240608073134.264210-1-mingo@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series is one of the dependencies of the fast-headers work, which aims to reduce header complexity by removing from the dependency chain, which headers are headers are fat enough already even if we do not combine them. To achieve that decoupling, one of the key steps is to not embedd any C types from into task_struct. The only architecture that relies on that in a serious fashion is x86, via the 'struct thread::fpu' variable size structure. The series below attempts to resolve it by using a calculated fpu context area address value via the x86_task_fpu() helper. The allocation layout of task_struct + fpu-save-area doesn't change. Changes in -v3: - Restructure the series to be easier to review - Extend the debug checks to all PF_KTHREAD tasks - A few cleanups on top The Git tree can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/fpu Thanks, Ingo ======================> Ingo Molnar (9): x86/fpu: Introduce the x86_task_fpu() helper method x86/fpu: Convert task_struct::thread.fpu accesses to use x86_task_fpu() x86/fpu: Make task_struct::thread constant size x86/fpu: Remove the thread::fpu pointer x86/fpu: Push 'fpu' pointer calculation into the fpu__drop() call x86/fpu: Make sure x86_task_fpu() doesn't get called for PF_KTHREAD tasks during exit x86/fpu: Remove init_task FPU state dependencies, add debugging warning for PF_KTHREAD tasks x86/fpu: Use 'fpstate' variable names consistently x86/fpu: Fix stale comment in ex_handler_fprestore() arch/x86/include/asm/fpu/api.h | 2 +- arch/x86/include/asm/fpu/sched.h | 4 +- arch/x86/include/asm/processor.h | 23 ++++++------ arch/x86/kernel/fpu/context.h | 4 +- arch/x86/kernel/fpu/core.c | 80 +++++++++++++++++++++++----------------- arch/x86/kernel/fpu/init.c | 23 +++++++----- arch/x86/kernel/fpu/regset.c | 22 +++++------ arch/x86/kernel/fpu/signal.c | 18 ++++----- arch/x86/kernel/fpu/xstate.c | 27 ++++++-------- arch/x86/kernel/fpu/xstate.h | 6 +-- arch/x86/kernel/process.c | 7 +--- arch/x86/kernel/signal.c | 6 +-- arch/x86/kernel/traps.c | 2 +- arch/x86/math-emu/fpu_aux.c | 2 +- arch/x86/math-emu/fpu_entry.c | 4 +- arch/x86/math-emu/fpu_system.h | 2 +- arch/x86/mm/extable.c | 2 +- include/linux/sched.h | 13 ++----- 18 files changed, 126 insertions(+), 121 deletions(-)