Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp324119lqt; Thu, 6 Jun 2024 05:02:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUUxu4ly0PRtFgkbejEQ3WeXHY5JJiAaAM4j/3gaxOVIj8QJC5Ri4MavJ19SYAexFFe/pxYqsswLpU3OoABcGjOghwbAPuAYz9GkeFuWg== X-Google-Smtp-Source: AGHT+IGfiOBb7Yd85O01qkzbrb80izL7bGgU10twzNqV9TRqCfXPKAyWN+gXczLOThsionXcietO X-Received: by 2002:a05:622a:5c7:b0:440:25f2:4af3 with SMTP id d75a77b69052e-4402b65345bmr59110051cf.45.1717675345296; Thu, 06 Jun 2024 05:02:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717675345; cv=pass; d=google.com; s=arc-20160816; b=00tUKEsGJOdn1LxWFgE3/yZxBV2H6DttFupbDr7Z2pTfHrKn9xutoJuv5peiscvUqV bUuylMKg9Mg2e/kx6SAOem915QJzSdsW6oL/C0fPrZ7Uq+MynrwaP75ONTR1rE5DpSt9 w3HGpdQ1fZZiPosq/C8Rv379Js0zEzA+e0h8Bxb1s0Q//KWsVYUe4aLQnvrbxPyj5M1C KhSG8AlxuUJ6x2wjFaLHbmCn7RzGOnMx0+BjDwJSjjR4KOSErybJEDN4HBcULFR5/Ik6 WN0zWYmowJ2L92tjWds9FmQHM/BZAqqi3WaGHn/lf9+8RQfx78uk12B7P03NprBXNEmK en1A== 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=XWWTK5qhVcanDQ3qGq7g2oah+h7PvOaUzbsjJCySE6U=; fh=o7WCP8wbCO4eQOhc6eHvbuj4nHGRjNwzauKZK40Zf1g=; b=trlTo9EhT/dZeqyPhlza18UduwctH8P+oRkuqmaovlAAHaMcSODlh1aI8/UZjfU3N5 WlCbSbj8EdtYuxYXLmcwEj9OQUSC780ejYdOTpgUgV3rtslWZQtJ3mMl/Af6ySOTVgI5 YmyU/pJpp+Jni2/jLrqTUyCOzDl4YEWP+1ntqUWPe4JBJj24x1dTs1+BKwA6BBHaQrfT 4FOvUwM5kxN4lXQRolW3bDpS1ngkNHKTY1b8llHQ0dbp07ooyNmUsTOjNYummm5kRIYu 7kzhLCTaXkrgeW6GivgzCBTUEkDqzZhcW+qOdQ04n3l3dN7gSEU49hzwCOu92c4QUGRN Fi9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=djxxwVVI; 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-204223-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204223-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-44038b16ca9si14133241cf.378.2024.06.06.05.02.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 05:02:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204223-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=djxxwVVI; 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-204223-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204223-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 226FB1C25F87 for ; Thu, 6 Jun 2024 12:02:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BBD0D195967; Thu, 6 Jun 2024 12:02:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="djxxwVVI" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 A0C7A1953B5 for ; Thu, 6 Jun 2024 12:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717675339; cv=none; b=l8V34g75fY6e7vBkz3uWgDly0xwsbQQJi9svhc5IAMNQ7zOWCeq1K2hFwWAnqjauQCAE0xvWHY8H3xl7w9XIOAKfzsAgizRmdMpzWAavzy+A4X+UuHgMgFslYpuVobNMkGb0NNw0+q5QaYxxHmxQzJX6+iAmMZdhLKtOZWAsdmY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717675339; c=relaxed/simple; bh=4bUJYb2nU/Uqt7KYEGDi/qFb4SSmyf/7m+E23emU67Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gbe7v0pKVHLMcHZEXAV/93GxPdIqAbUfz+c5galIa9o2VQJ+MgfhyDiR+djCTQXH526VZI0XpPufXv8/BJoCMC+4iMIpeLcgwQVGW8l4B4zKMEX+Rq0MXc+J5xOc0LbC8XPnp+29aEMtnETl7gZ5Az0t1uTdEYb7+XYVHxlxns8= 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=djxxwVVI; arc=none smtp.client-ip=170.10.133.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=1717675336; 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=XWWTK5qhVcanDQ3qGq7g2oah+h7PvOaUzbsjJCySE6U=; b=djxxwVVIa78SaPeREWZMX4uCQq4nnr7NuXCVmPDsjI0GIVvl+BpLH70fYrQoiTKoOZPgKW 5Py2Oqt1/YtUBkQzbJN9XA8hgVyhN1nuMdPbrVcAUouYTPRmMIeKs3xdDocnKffwm+Aiyy MTD0S2Th+5hZBn+xGZHtsBjiqZEwFLI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-452-0yHxYiYcN1akpk4CRgImlw-1; Thu, 06 Jun 2024 08:02:11 -0400 X-MC-Unique: 0yHxYiYcN1akpk4CRgImlw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7F13F811E8E; Thu, 6 Jun 2024 12:02:10 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.226.3]) by smtp.corp.redhat.com (Postfix) with SMTP id B61B91C0005E; Thu, 6 Jun 2024 12:02:07 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 6 Jun 2024 14:00:41 +0200 (CEST) Date: Thu, 6 Jun 2024 14:00:38 +0200 From: Oleg Nesterov To: Ingo Molnar Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Andy Lutomirski , Andrew Morton , Dave Hansen , Peter Zijlstra , Borislav Petkov , "H . Peter Anvin" , Thomas Gleixner , Uros Bizjak Subject: Re: [PATCH 3/3, v4] x86/fpu: Remove init_task FPU state dependencies, add debugging warning for PF_KTHREAD tasks Message-ID: <20240606120038.GB22450@redhat.com> References: <20240605083557.2051480-1-mingo@kernel.org> <20240605083557.2051480-4-mingo@kernel.org> <20240605141733.GC25006@redhat.com> <20240605162610.GF25006@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.4.1 on 10.11.54.7 On 06/06, Ingo Molnar wrote: > > I changed the debug check to test for PF_KTHREAD, and to return NULL: > > +#ifdef CONFIG_X86_DEBUG_FPU > +struct fpu *x86_task_fpu(struct task_struct *task) > +{ > + if (WARN_ON_ONCE(task->flags & PF_KTHREAD)) > + return NULL; > + > + return (void *)task + sizeof(*task); > +} > +#endif How many users enable CONFIG_X86_DEBUG_FPU? Perhaps it makes sense to check PF_KTHREAD unconditionally for the start, them add if (IS_ENABLED(X86_DEBUG_FPU)). But I won't insist. For the record, I think we can later change this code to check task->flags & (PF_KTHREAD | PF_USER_WORKER) but I guess this needs some (simple) changes in the ptrace/coredump paths. Oleg.