Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp951918lqt; Fri, 7 Jun 2024 03:57:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXGSpV3QOTQMmU5zZjDmn9qI7Vu8pk2oWXMK6DbscTrk25FW+ZWIV0mqCRMTGLs9WH3DaiJVNncnescB3Go5oNyIEWHR2/tDG6yzayIxg== X-Google-Smtp-Source: AGHT+IHyV4IV5kvsJg54hZGBtX3r/j6WeD2iVWgww5kSxj+0Kc5f1rcCSt1gH5gUURtpvfFoqj1y X-Received: by 2002:ac8:7dca:0:b0:43a:a8ad:7954 with SMTP id d75a77b69052e-44041c65b22mr28422891cf.28.1717757822433; Fri, 07 Jun 2024 03:57:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717757822; cv=pass; d=google.com; s=arc-20160816; b=TE8pcqyaeK9fLT1ii+G4nDi6KVvH2/cIFfeLqpW137tSSN0JjxsPac9zPluf4Y9NPb k4TLF6bL0XQL75AxlAD55sCX2m/L0O6BRPG9qPaLQZo2qRpvRjdZMQt3/NmcOMnjYAdQ DXuAS1I9D9wa6W1dtXjqSi6jdysyhArRWYceHq67SpUO6bei/dQZxbecnisGYdz6sOVD +6xkkWQ2ZF3gR7HSVFI1nESIeaZXu9yTS36lRzI3zFj1WbpXidj88C0+CE8y/FajEYPN bUh1MWSv2vUCJ+j6THs+pG4BRvJuLRvkF7p8p6PGDzpAbPZBpisCdWNZjXsDVlCGGg9B 3kUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=VJ/zPWu64aSX8lW8Me3yRm5L5VkYOhKfhalZeis3Aps=; fh=VdKyOZaRcgthOMHK25PhewRS8ojeUL+tPzAx5olM1bk=; b=tTD1T15jJsiwmtJefvRAH8n97iNjKKYVWRVfBFHEn6JyaAYp4Akn3i9e0AEtESFgbI l0RgkjWx6HPUstCVd97dagjdBaunMycAkVolylYLfG680aS/G3AR7jxaKlHO8xxMhs2u 7YA5D2zdDt5yVqY4fZC1SSZs08sLTKEfke6NUwDr4HTMwYCt1tCUm5jBvOz2eJ3bTiI2 qFjVDqajqcHAZd1popqbUQBD41mKvLWDtI1iMpW5jlbA+gQgFWKyLFYmvPj+S2Ewxr4e hu59Gu4cBg74PjHKLqXJvS4CXfFCsxV2oMdLKkjXywfuEgzBHJdXb3IW2roDX1ie5Kd9 rQ5g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UamXqT+D; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-205853-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205853-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 d75a77b69052e-44038a85f09si942791cf.168.2024.06.07.03.57.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 03:57:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205853-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=UamXqT+D; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-205853-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205853-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 2A6E91C233AF for ; Fri, 7 Jun 2024 10:57:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E1284186293; Fri, 7 Jun 2024 10:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UamXqT+D" Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 68B5461FCE for ; Fri, 7 Jun 2024 10:56:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717757816; cv=none; b=MqmW15lnt5XqY/DIqAN9d77uBfI1mgB+dpLa8VHBPfvqD5fikUZyw/8cMNi0Az29r+TLv2GlrNqt1Ean4bqq2AwT4l0pf07gSIEtocq15MRJOWjDqWSmvC/ZPXGea2nP5T4qVCNIHtDum6baXKdAnhvdGF9SzH0HoFMSfuaLZB8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717757816; c=relaxed/simple; bh=/+d7Wn/qMudLa2zAxLbxLZiAOTzrsS9FyyESoHVhefk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hjrQeN1RDeCkcnKm7WPULG9O3wGyVoQYgrdvDzXIhCajMSHp1b+db2ciQFDLJRHFCikuECLGfN5FT0r8qJA9ldiGTqh2rgqdWKqb+TOBk6I+iNNatPCmQaYVYgvfs9ptm6NFKT0Ji9lTW7NmI4hBTomeuCrr0+F9xW5Srw4w+Sw= 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=UamXqT+D; arc=none smtp.client-ip=209.85.221.51 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-wr1-f51.google.com with SMTP id ffacd0b85a97d-35dce6102f4so1643909f8f.3 for ; Fri, 07 Jun 2024 03:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717757813; x=1718362613; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=VJ/zPWu64aSX8lW8Me3yRm5L5VkYOhKfhalZeis3Aps=; b=UamXqT+DYlCiLsZlguhSckzVB1gPrCfxQ4sNLNHrHo237OC4+3GtjSb1phkQED0h72 //CFMbXTTdsocAn2S3k/d/6EXHQc2m0BC2+/H/aXvwGl/OnyxEo3ZnxVuISxmJgBXSz8 B+0EatsgTQTOcNx9Bup/CS57+l1VYkbQwVDRXF9yzikf2rs+hFPywecag+lQuqTTNwIJ APwicOkkHJyX+Ynzdn5Ho0YPs/s+EtXZJpHlDGolxO5MjGeaOLvlCi9XNajjcazQwERi BjeOsNiI8Vj0Rlgc669SOCsg7OC3/V8ymDiYR1g5wU7ADi4t1lqVazWNFwNAEZ9BKpu+ OPrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717757813; x=1718362613; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VJ/zPWu64aSX8lW8Me3yRm5L5VkYOhKfhalZeis3Aps=; b=t/4A2V1UMiLL0m5aJ0fTQv4YZGRB/ejazPQhqg1UitISzyaRMXZJpbaYrKJ0t6n2e+ ajnso3u48wSdo0ULWccgLOMlIXv8eH9p8eeqVNFCzdLm/AbR8f1bRX9XP+WOj8XrO8bY u2yARJ6lAVeZ84KBZwGD6OR92FXFAni53PHiLSYVB95fMJhYxtyGdxTj60sAFD0H4Da6 R2vkLVTp1snAFtg8N7s6dpm5vXnxgSqQpYjMRniFGJFJydub9lGtDa/ewYd09AhmhBE+ 8kjk5xFs0GLnnECe2DS9AO0PMFxSc0lrKnrO2AqIx+Ns7b7DBvkjyj+RsvG2U/FeIiU0 ebMg== X-Forwarded-Encrypted: i=1; AJvYcCXh8VnQ6MF4wrr6+JOCwLmLxZQVpKvW//kYPa4Gdh674z9a32JkOuwrhO0WUn+B7ZHnN/Ey4+X7m+WY6QdQzzFRs2rAWHEUawCHUcN5 X-Gm-Message-State: AOJu0YyRs0V275285HRe8VLE2j3mdMaVil3pVSmu+9U7Jmr1UU3v+0ON WFlsXU33mDhWylRjXTmSvq2Ur9D0i/78UxtzR96aWQ6v2mKLOFC0 X-Received: by 2002:a5d:5686:0:b0:354:fb1d:694e with SMTP id ffacd0b85a97d-35efed64b39mr1767775f8f.29.1717757812279; Fri, 07 Jun 2024 03:56:52 -0700 (PDT) Received: from gmail.com (1F2EF20A.nat.pool.telekom.hu. [31.46.242.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35ef5d2e73dsm3808103f8f.16.2024.06.07.03.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 03:56:51 -0700 (PDT) Sender: Ingo Molnar Date: Fri, 7 Jun 2024 12:56:49 +0200 From: Ingo Molnar To: Oleg Nesterov 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: References: <20240605083557.2051480-1-mingo@kernel.org> <20240605083557.2051480-4-mingo@kernel.org> <20240605141733.GC25006@redhat.com> <20240605162610.GF25006@redhat.com> <20240606120038.GB22450@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: <20240606120038.GB22450@redhat.com> * Oleg Nesterov wrote: > 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? Ubuntu does: kepler:~/tip> grep X86_DEBUG_FPU /boot/config-6.* /boot/config-6.8.0-35-generic:CONFIG_X86_DEBUG_FPU=y Fedora doesn't: kepler:~/s/tmp> grep X86_DEBUG_FPU ./lib/modules/6.9.0-64.fc41.x86_64/config # CONFIG_X86_DEBUG_FPU is not set So it's a bit of a hit and miss, but at least one major distribution does, which is all that we need really. > [...] 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. I think Ubuntu ought to add enough debug coverage - and this check isn't exactly cheap, given how it replaces a simple build time structure offset with a full-blown function call ... > 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. Sounds useful, would you be interested in cooking up a series on top of tip:master (or tip:WIP.x86/fpu), if you are interested and have the time? I'll send out one last iteration of this series today, otherwise the changes seem close to final for an upstream merge via the tip:x86/fpu tree. Thanks, Ingo