Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1865551pxu; Tue, 24 Nov 2020 10:40:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzEhdrLUY4AFeQbYl2j+JMj4BRhS5PvsH73gS04Cu4czBlGY2B4n2a8KTjjGw+AjuYCGLwY X-Received: by 2002:a17:906:c086:: with SMTP id f6mr5339591ejz.38.1606243220287; Tue, 24 Nov 2020 10:40:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606243220; cv=none; d=google.com; s=arc-20160816; b=wXTe0Qgxnnvt1+BlyThiCm12leJI25JUaV0O7pb2s5H9l425OBuh/ys1i9xpVd7Bdp inbu1GbHvouwBFnFlgiB8HHu2BwHi3Pa7z24hijwNd0U4m+79eDiLUN9CV58QNLefuGT /vBKSz6ST2WYpDsrMC2xM1+PMhywWvohIZhx4JVjLwsIKXsvy56rza7n7zj9RtGQPkkI AoNAEQBQyDtnfMauFzgmd6302uogt7QyUKBQjFlqapUNmrLGAz8uL9X2tG6Xms453qxT kAsuzrbXkhOSPcv/IMHZlc7mNBLuPr6cP/bat6a/NTjcOAEt10n5vsMu5CQvS6BSg2Be tvpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=02zyVIZESHQBccfGArgKEYjRejMAdJsOe44mFAYJcQU=; b=g4ahU/hHU+auuHLLNN7l+n3SyyzSM3lL32qX1GxIoXkSBtsbczwsORF1Kw0U1h4Iqt zoPB7sZfQl6EKp0oV6q1RVQ0Iw0qWOwAVYS6fY5RExlSblJFFT4/dbuxo77UEOLoQ1EC nvWiy5NkOTZBmRF6DDnqWLSwNaFBkmHPW9yCAgIzuXorZOJ0bQSTJ/gulEyQbxDAj+uJ 0b0PBtYuAZsreZ+UFCxg2sGi6DsTIe16ZVpiLzVaBZ4FwVXPkSnzcDVKC7qoBajYpCaa /yscSmBfSvqadCodyVrj6L7LsybTpG6gLqFj/pCCKx/egKo/bS2nwUZYyEG7W7Seyf9q S8Lg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g24si9134731edj.168.2020.11.24.10.39.57; Tue, 24 Nov 2020 10:40:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404265AbgKXSfV (ORCPT + 99 others); Tue, 24 Nov 2020 13:35:21 -0500 Received: from mail-ej1-f65.google.com ([209.85.218.65]:44471 "EHLO mail-ej1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390718AbgKXSfT (ORCPT ); Tue, 24 Nov 2020 13:35:19 -0500 Received: by mail-ej1-f65.google.com with SMTP id k9so15125819ejc.11 for ; Tue, 24 Nov 2020 10:35:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=02zyVIZESHQBccfGArgKEYjRejMAdJsOe44mFAYJcQU=; b=A3tOceFvUr7GL88O5JpLkj9VvF2nHIwp9JBf+L/LAaKK3fJPPA3VYN6S+BnaAhzrLc nTH1lI1fJAu+12TUwjmNew0O+Gr71TgC6ofS/CZFx/Wc6fmSbFS6TN3a39HpGKdnpr1m HpuepVqSQ+Vn6YrhqStYz9h37TSqQoQAxB2BxlpQ8WkqQPTAhiSCCug4PPrQjGuxaO8C 4oQq3Ytelxw2nloEa6g5co7uIdy8THghWhGIRGJjeqATKAUHtELtJNtN+AKD8uq+G7An iadWSrMakO4RSpgEtowYwOvFSleX00CuR5BfK+/ZAadScre4NhXuuWXhcKv6CwMegb6u CD0Q== X-Gm-Message-State: AOAM533fUmlbUcstQ/QuT11cGFb4AEraWEM7QgtytWdCNkVueTpBjmyf 8ZMv7nF0cSAIuP81Dw63RFEIGja6nqdKRm3utbU= X-Received: by 2002:a17:906:578b:: with SMTP id k11mr5466043ejq.330.1606242918760; Tue, 24 Nov 2020 10:35:18 -0800 (PST) MIME-Version: 1.0 References: <20201119233257.2939-1-chang.seok.bae@intel.com> <20201119233257.2939-15-chang.seok.bae@intel.com> In-Reply-To: From: Len Brown Date: Tue, 24 Nov 2020 13:35:07 -0500 Message-ID: Subject: Re: [PATCH v2 14/22] x86/fpu/xstate: Inherit dynamic user state when used in the parent To: Andy Lutomirski Cc: "Chang S. Bae" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , X86 ML , Len Brown , Dave Hansen , "Liu, Jing2" , "Ravi V. Shankar" , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 20, 2020 at 12:08 AM Andy Lutomirski wrote: > > On Thu, Nov 19, 2020 at 3:37 PM Chang S. Bae wrote: > > > > When a new task is created, the kernel copies all the states from the > > parent. If the parent already has any dynamic user state in use, the new > > task has to expand the XSAVE buffer to save them. Also, disable the > > associated first-use fault. > > This seems like a mistake. If init uses AMX for some misguided > reason, ever task on the whole system will end up with AMX state > allocated. Andy, you are right -- the child can (and should) start with the un-expanded context switch buffer, and as a result XFD should be armed to fire on the child's first access to TMM hardware. TMM registers are scratchpad, they will never be used to pass globals, say, from parent to child thread. Further, they are volatile and caller saved. The callee can assume they are empty -- so even by virtue of being in a fork system call, that state is already gone. thanks, Len Brown, Intel Open Source Technology Center