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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D31F5C433E6 for ; Thu, 25 Feb 2021 22:24:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80A9A64F51 for ; Thu, 25 Feb 2021 22:24:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232631AbhBYWXv (ORCPT ); Thu, 25 Feb 2021 17:23:51 -0500 Received: from mga03.intel.com ([134.134.136.65]:3567 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233455AbhBYWSE (ORCPT ); Thu, 25 Feb 2021 17:18:04 -0500 IronPort-SDR: edwX2uxP8Nqr+3PbHjpS/LjIi/TUOZ5uMxRuNhDF/OAb0wQvPXL+fIsqWvlraCzmw20gIIgHy7 fL1IMyMWQe6w== X-IronPort-AV: E=McAfee;i="6000,8403,9906"; a="185749632" X-IronPort-AV: E=Sophos;i="5.81,207,1610438400"; d="scan'208";a="185749632" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2021 14:17:18 -0800 IronPort-SDR: HBKSHiLe0MtfvnRN4zT3jI0f0Rqf5KuNeB1ORFZDVA8T397xDurDMDhDQchjk4a8veYMxlqzmu CNop4lCWAW1w== X-IronPort-AV: E=Sophos;i="5.81,207,1610438400"; d="scan'208";a="404589780" Received: from otcwcpicx3.sc.intel.com ([172.25.55.73]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2021 14:17:18 -0800 Date: Thu, 25 Feb 2021 22:17:11 +0000 From: Fenghua Yu To: Jean-Philippe Brucker Cc: Joerg Roedel , Lu Baolu , Ashok Raj , Jacob Jun Pan , linux-kernel , iommu@lists.linux-foundation.org, zhangfei.gao@foxmail.com, linux-mm@kvack.org Subject: Re: [PATCH v6 08/12] fork: Clear PASID for new mm Message-ID: References: <1594684087-61184-1-git-send-email-fenghua.yu@intel.com> <1594684087-61184-9-git-send-email-fenghua.yu@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, Jean, On Wed, Feb 24, 2021 at 11:19:27AM +0100, Jean-Philippe Brucker wrote: > Hi Fenghua, > > [Trimmed the Cc list] > > On Mon, Jul 13, 2020 at 04:48:03PM -0700, Fenghua Yu wrote: > > When a new mm is created, its PASID should be cleared, i.e. the PASID is > > initialized to its init state 0 on both ARM and X86. > > I just noticed this patch was dropped in v7, and am wondering whether we > could still upstream it. Does x86 need a child with a new address space > (!CLONE_VM) to inherit the PASID of the parent? That doesn't make much > sense with regard to IOMMU structures - same PASID indexing multiple PGDs? You are right: x86 should clear mm->pasid when a new mm is created. This patch somehow is losted:( > > Currently iommu_sva_alloc_pasid() assumes mm->pasid is always initialized > to 0 and fails on forked tasks. I'm trying to figure out how to fix this. > Could we clear the pasid on fork or does it break the x86 model? x86 calls ioasid_alloc() instead of iommu_sva_alloc_pasid(). So functionality is not a problem without this patch on x86. But I think we do need to have this patch in the kernel because PASID is per addr space and two addr spaces shouldn't have the same PASID. Who will accept this patch? Thanks. -Fenghua