Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp917787pxb; Wed, 29 Sep 2021 12:28:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYTVE5L42z8cCefkKn2srVW9SGhj7aH+wWcCsDCInBXhdUhzmuFI5IyTXIrdxCUF0pVuDm X-Received: by 2002:a05:6402:1344:: with SMTP id y4mr1965761edw.261.1632943702702; Wed, 29 Sep 2021 12:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632943702; cv=none; d=google.com; s=arc-20160816; b=MJFRQAnVQ1EkU7ZUeZ7r0Qb2SbHLLbk8BXNWTDR2KlKGk0UVJVniIh65eImm1EJhFe aIFN+o891hXejC9s0k/LAdTgFzaN4Go029p4gT2MoPlC5PoxXiNYK9qO8FD1mqSt2cMO m8fmW8kw13v2Bf1Bgq16EI++MKoIeYy1J81xiQ/caLjbsX+k3plLicFWQbw1eVlsWDtC oYTu9C+sjD98VwcE5enMfShdS/Q1/sjul5yGbqzBlt4quw8K4LfQjY+sFZhEswD/PpXz 5RNM3h3AeOvLjocXIXHnLzrB440zFmcEebnpOO3pN2DLcFFG+ji1SKpgXL5tuixVWDTY O1/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=sbqITEoQDLk/eB3KOH9BvQEW7+TV2uSIQeRBzjpgA2Q=; b=I11qoe7t8ylrz8AoBtRFJFs9SRxLfFISj4cQk6AdSbe8mF3mOXMb8EAKF2vGszzq5a NGjatSZKrfmfjWEzmxdXNLhf5/lb5899g5aNAUUy4v3cHSYHBS9OeLrIoWujfBkB2/yJ /C7yUlPNPzUT8uYhKz7mZqTAUILDLWh7DYFarL8G++QWBUoolD9WZ//hBUbZ9RJ+M83w m7+OjNlfXVE9Kncnlek4TOl35ur6rjN2QgZf1tvxlOE16Q7FV9Dg3fo4o9I6ERokXU2d CE5vozMCUdBH90RkQ06dRMsJ7h2swGG14puDl1JqHfGR8XhkEA5FqZA+fez4szoO/Oyi d6kQ== 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x10si974029edj.155.2021.09.29.12.27.56; Wed, 29 Sep 2021 12:28:22 -0700 (PDT) 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345217AbhI2RN3 (ORCPT + 99 others); Wed, 29 Sep 2021 13:13:29 -0400 Received: from mga07.intel.com ([134.134.136.100]:34194 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343872AbhI2RN2 (ORCPT ); Wed, 29 Sep 2021 13:13:28 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10122"; a="288650541" X-IronPort-AV: E=Sophos;i="5.85,332,1624345200"; d="scan'208";a="288650541" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2021 10:07:55 -0700 X-IronPort-AV: E=Sophos;i="5.85,332,1624345200"; d="scan'208";a="563435641" Received: from otcwcpicx3.sc.intel.com ([172.25.55.73]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2021 10:07:54 -0700 Date: Wed, 29 Sep 2021 17:07:48 +0000 From: Fenghua Yu To: "Luck, Tony" Cc: Thomas Gleixner , Peter Zijlstra , Andy Lutomirski , Ingo Molnar , Borislav Petkov , "Hansen, Dave" , Lu Baolu , Joerg Roedel , Josh Poimboeuf , "Jiang, Dave" , "Pan, Jacob jun" , "Raj, Ashok" , "Shankar, Ravi V" , "iommu@lists.linux-foundation.org" , the arch/x86 maintainers , Linux Kernel Mailing List Subject: Re: [PATCH 5/8] x86/mmu: Add mm-based PASID refcounting Message-ID: References: <20210920192349.2602141-6-fenghua.yu@intel.com> <87y27nfjel.ffs@tglx> <87o88jfajo.ffs@tglx> <87k0j6dsdn.ffs@tglx> <87r1d78t2e.ffs@tglx> <57d0e4efcf2d4e9abb91801520a3f386@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57d0e4efcf2d4e9abb91801520a3f386@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Thomas, On Wed, Sep 29, 2021 at 09:51:15AM -0700, Luck, Tony wrote: > > There is zero requirement to look at TIF_NEED_FPU_LOAD or > > fpregs_state_valid() simply because the #GP comes straight from user > > space which means the FPU registers contain the current tasks user space > > state. > > Just to double confirm ... there is no point in the #GP handler up to this point > where pre-emption can occur? Same question here. The fixup function is called after cond_local_irq_enable(). If an interrupt comes before fixup_pasid_exception(), the interrupt may use FPU and call kernel_fpu_begin_mask()->set(TIF_NEED_FPU_LOAD)-> __cpu_invalidate_fpregs_state(). Then writing to the IA32_PASID MSR. When exiting to user, the FPU states will be restored to the FPU regs including the IA32_PASID MSR. So the MSR could be different from the value written in fixup_pasid_execption(). Is it possible? Or should fixup_pasid_exception() be called before cond_local_irq_enable()? Thanks. -Fenghua