Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp654998lqp; Wed, 12 Jun 2024 12:03:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVyZfHDSDzORCrPTSrfkVTUlUNh1CDXr/W6tn5s2uOImjaXQfLciAcAGX/i3EqhDRryTpBBb9cTqQ5jocs7MyPz0oX+Zcd4ppTNIyaB5A== X-Google-Smtp-Source: AGHT+IGWXdqIRnzAfaxML0Zl2ZA6mBy1gYjqWbDILKu4eyarLun4R7RDzV8ApZZ0C3MSPzoGa4SD X-Received: by 2002:a17:902:9886:b0:1f6:7ee8:8935 with SMTP id d9443c01a7336-1f83b7ddc80mr22182835ad.59.1718218997079; Wed, 12 Jun 2024 12:03:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718218997; cv=pass; d=google.com; s=arc-20160816; b=yqpETXV7pLkYj+kOMkNmyYCgFOnxhpfrdDC5p+394SakWVP1brFho4Bi7vL5DIv2ad Oxlrusfg9sq7DASSaVyPh+A9M+mI4efQ4KfUkWJARoKirUDQitazCSunFAa8ywLpJ3lG WeCN3VifSV1yOomA4sct7DO0ZW66qTE39qAc5s3rutByVRAJCNCRlYvLRw0SQTzLA7uC BxrbX8URac4Vv2PTa8X+ZtO9La2EtHoRUC4cYtlu/sQT6pmf2TRT7H/4e32Os8Tj8L9y fDBinO5DqxOjvFuC1+RXFXZxy5eD1u621G5VS28lUlunDM/eVYPNx8Nm32Sdr05rga5Q Gvxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=XSie2rDJ5lPJ+f0eDBkZKw9s3cyHlIqim7LR340IID4=; fh=i2KluTXb2i4Ks/BulgFim5fjxhCD2ysR8lneBGTVmTU=; b=cR5U6eTdgUxhBY0l1C1np9114ZKr4BSrLGMtBv6S1mIdyBKbQ0eKuqVXP5HUVYDosX Dt9P2ap9GOoF805jCuA/eLwkVL9KAxglmDxLwbozVqy7egWa3BjSucea+ALMetrVGGkH jyhvA4rwyuuik70F7eE30M8uyzRPzP4JiDbh5Raa9nN2/JeiV6KtePSx9qEugcaOPRco dmi6kL7jUa2FV2SFxm7g+jJSrcnWir8qQATaNzTKzBNVBdLWY+FHHu497Elp7dvM1RMg BgiCTDwjZ5OQEsat1H1U2IfSHjkQZxASmM/jxn86W+gdYPSh/9hMy1JKYUpmN1IzhiZl WW/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LctJ6ty3; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-212107-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212107-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f6f0e03acdsi84758425ad.427.2024.06.12.12.03.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 12:03:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212107-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=@redhat.com header.s=mimecast20190719 header.b=LctJ6ty3; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-212107-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212107-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 E942628CFE9 for ; Wed, 12 Jun 2024 18:43:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A0594DA13; Wed, 12 Jun 2024 18:43:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LctJ6ty3" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5DCB47F60 for ; Wed, 12 Jun 2024 18:43:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718217816; cv=none; b=aVdqu6BH2vhCiugP5cEr1RqWQvEEAsjGlNfPQAUyfJmLarJm5qpgmv9ZlMfVtElHeGCt8ONsLVBMkfqUY9bTZ8vSe6saxhwWfO5FAtTIrUWmkpv0GqaAogy34ItCFmkyEOCl2ejWaIixyRfkoEStDci2+vlkoktF5aAZKVwQPz8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718217816; c=relaxed/simple; bh=o7ns0CAimFMDnmRjVIVStSrzzCFJQjHy/Tp515miRY0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TgVOfQIMHhKsLsO0pFBlQeleDIC7PbV+NNAGnGF5ybZISN0d0RYeJvRPX0Y/OtNxCLIBVGvEMXnq9pws+hbuZwx4A7C6fi8flaGaO7cW8sYFJhqYSybd/rl/M8x6k3y4OIlI8JbCJOoj86H5mOptcrHXSUsYUywY3PkZFb7qNXM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LctJ6ty3; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718217813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XSie2rDJ5lPJ+f0eDBkZKw9s3cyHlIqim7LR340IID4=; b=LctJ6ty30DFZ75Mc1zzsgqYsBzAi2o/4jqo2zxAPyxkMVnq+mxkb9LfhcRWnksKqzkA/39 EpE1j4RBB7lH8oY8pCJWtdG55FUYhXM2YdgQBAzb5GFDLAMCPoFkLEqk1EoDBk7Pdh9ENi y5E3O4UHsaGvJpuI3pnzmfg4SkSRwwM= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-423-2pUjVqh4Mya6sBGXoAxjQQ-1; Wed, 12 Jun 2024 14:43:28 -0400 X-MC-Unique: 2pUjVqh4Mya6sBGXoAxjQQ-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 610E71956068; Wed, 12 Jun 2024 18:43:25 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.225.215]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 968DC1956050; Wed, 12 Jun 2024 18:43:20 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 12 Jun 2024 20:41:54 +0200 (CEST) Date: Wed, 12 Jun 2024 20:41:48 +0200 From: Oleg Nesterov To: Ingo Molnar Cc: Nathan Chancellor , linux-kernel@vger.kernel.org, Andy Lutomirski , Andrew Morton , Dave Hansen , Peter Zijlstra , Borislav Petkov , Brian Gerst , "H . Peter Anvin" , Linus Torvalds , Thomas Gleixner , Uros Bizjak Subject: Re: [PATCH 3/9] x86/fpu: Make task_struct::thread constant size Message-ID: <20240612184148.GB23973@redhat.com> References: <20240608073134.264210-1-mingo@kernel.org> <20240608073134.264210-4-mingo@kernel.org> <20240610211350.GA1613053@thelio-3990X> <20240611124145.GA26798@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 The patch below seems to fix the problem. Again, the changes in fpu__init_system_early_generic() are not strictly needed to fix it, but I believe make sense anyway. Oleg. diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c index 4e8d37b5a90b..848ea79886ba 100644 --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c @@ -71,16 +71,14 @@ static bool __init fpu__probe_without_cpuid(void) return fsw == 0 && (fcw & 0x103f) == 0x003f; } -static struct fpu x86_init_fpu __read_mostly; +static struct fpu x86_init_fpu __attribute__ ((aligned (64))) __read_mostly; static void __init fpu__init_system_early_generic(void) { - int this_cpu = smp_processor_id(); - fpstate_reset(&x86_init_fpu); current->thread.fpu = &x86_init_fpu; - per_cpu(fpu_fpregs_owner_ctx, this_cpu) = &x86_init_fpu; - x86_init_fpu.last_cpu = this_cpu; + set_thread_flag(TIF_NEED_FPU_LOAD); + x86_init_fpu.last_cpu = -1; if (!boot_cpu_has(X86_FEATURE_CPUID) && !test_bit(X86_FEATURE_FPU, (unsigned long *)cpu_caps_cleared)) { diff --git a/include/linux/sched.h b/include/linux/sched.h index 215a7380e41c..ec22b9bf27f5 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1562,7 +1562,7 @@ struct task_struct { * they are included in the randomized portion of task_struct. */ randomized_struct_fields_end -}; +} __attribute__ ((aligned (64))); #define TASK_REPORT_IDLE (TASK_REPORT + 1) #define TASK_REPORT_MAX (TASK_REPORT_IDLE << 1)