From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2423C433EF for ; Wed, 29 Sep 2021 01:16:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A7ACF613D2 for ; Wed, 29 Sep 2021 01:16:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243623AbhI2BRw (ORCPT ); Tue, 28 Sep 2021 21:17:52 -0400 Received: from mga11.intel.com ([192.55.52.93]:50798 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242636AbhI2BRt (ORCPT ); Tue, 28 Sep 2021 21:17:49 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10121"; a="221632191" X-IronPort-AV: E=Sophos;i="5.85,330,1624345200"; d="scan'208";a="221632191" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 18:16:09 -0700 X-IronPort-AV: E=Sophos;i="5.85,330,1624345200"; d="scan'208";a="562791541" Received: from otcwcpicx3.sc.intel.com ([172.25.55.73]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 18:16:09 -0700 Date: Wed, 29 Sep 2021 01:16:08 +0000 From: Fenghua Yu To: "Luck, Tony" Cc: "Hansen, Dave" , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "Peter Zijlstra (Intel)" , 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 4/8] x86/traps: Demand-populate PASID MSR via #GP Message-ID: References: <035290e6-d914-a113-ea6c-e845d71069cf@intel.com> <3f97b77e-a609-997b-3be7-f44ff7312b0d@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Tony, On Tue, Sep 28, 2021 at 06:06:52PM -0700, Luck, Tony wrote: > >> fpregs_lock(); > > > > I'm afraid we may hit the same locking issue when we send IPI to notify another task to modify its > > PASID state. Here the API is called to modify another running task's PASID state as well without a right lock. > > fpregs_lock() is not enough to deal with this, I'm afraid. > > We don't send IPI any more to change PASID state. The only place that the > current patch series touches the PASID MSR is in the #GP fault handler. It's safe for the helpers to handle the PASID case (modifying the current task's PASID state in #GP). But the helpers seem to be generic. They take "task" as a parameter and handle the task as non-current case. So the helpers are not for PASID only. They may be used by others to modify a running task's FPU state. But It's not safe to do so. At least need some comments/restriction for the helpers to be used on a running task? Thanks. -Fenghua From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF803C433EF for ; Wed, 29 Sep 2021 01:16:18 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A3DE613DA for ; Wed, 29 Sep 2021 01:16:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4A3DE613DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 13B2E60683; Wed, 29 Sep 2021 01:16:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qnyk2WRHjese; Wed, 29 Sep 2021 01:16:17 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id ED85360662; Wed, 29 Sep 2021 01:16:16 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BB665C000F; Wed, 29 Sep 2021 01:16:16 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 87451C000D for ; Wed, 29 Sep 2021 01:16:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 62EBF60681 for ; Wed, 29 Sep 2021 01:16:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kFS7kqPHcMdq for ; Wed, 29 Sep 2021 01:16:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by smtp3.osuosl.org (Postfix) with ESMTPS id D069460662 for ; Wed, 29 Sep 2021 01:16:14 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10121"; a="224876125" X-IronPort-AV: E=Sophos;i="5.85,330,1624345200"; d="scan'208";a="224876125" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 18:16:10 -0700 X-IronPort-AV: E=Sophos;i="5.85,330,1624345200"; d="scan'208";a="562791541" Received: from otcwcpicx3.sc.intel.com ([172.25.55.73]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 18:16:09 -0700 Date: Wed, 29 Sep 2021 01:16:08 +0000 From: Fenghua Yu To: "Luck, Tony" Subject: Re: [PATCH 4/8] x86/traps: Demand-populate PASID MSR via #GP Message-ID: References: <035290e6-d914-a113-ea6c-e845d71069cf@intel.com> <3f97b77e-a609-997b-3be7-f44ff7312b0d@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Cc: "Shankar, Ravi V" , "Jiang, Dave" , "Raj, Ashok" , "Peter Zijlstra \(Intel\)" , the arch/x86 maintainers , Linux Kernel Mailing List , "Hansen, Dave" , "iommu@lists.linux-foundation.org" , Ingo Molnar , Borislav Petkov , "Pan, Jacob jun" , Andy Lutomirski , Josh Poimboeuf , Thomas Gleixner X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" Hi, Tony, On Tue, Sep 28, 2021 at 06:06:52PM -0700, Luck, Tony wrote: > >> fpregs_lock(); > > > > I'm afraid we may hit the same locking issue when we send IPI to notify another task to modify its > > PASID state. Here the API is called to modify another running task's PASID state as well without a right lock. > > fpregs_lock() is not enough to deal with this, I'm afraid. > > We don't send IPI any more to change PASID state. The only place that the > current patch series touches the PASID MSR is in the #GP fault handler. It's safe for the helpers to handle the PASID case (modifying the current task's PASID state in #GP). But the helpers seem to be generic. They take "task" as a parameter and handle the task as non-current case. So the helpers are not for PASID only. They may be used by others to modify a running task's FPU state. But It's not safe to do so. At least need some comments/restriction for the helpers to be used on a running task? Thanks. -Fenghua _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu