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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04574C433F5 for ; Tue, 12 Apr 2022 14:39:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356682AbiDLOl1 (ORCPT ); Tue, 12 Apr 2022 10:41:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354554AbiDLOlX (ORCPT ); Tue, 12 Apr 2022 10:41:23 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7467E51 for ; Tue, 12 Apr 2022 07:39:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649774345; x=1681310345; h=message-id:date:mime-version:to:cc:references:from: subject:in-reply-to:content-transfer-encoding; bh=GZj64pjcWXoZ+UWhUertM7DeZpkX/WIgVteyu9EF33A=; b=IDSUsTAlQ9zt0b59jP0LV/+kgzTpNpUVrcv4R4vwjuWWqkLvIUWN6qWP 0X9Xst9cA+3JzUBxiV7xW+e8YTSz/je7YsVi3RE/KvcGa8dDLZ3M+jGip GxfuQqAp49x+N/L0iASjUVLK+OIynSP3cvmCJ6kbiJzbV+qk0RK8IhdTr FCsgRq221UNAaspkkLundKvDYQ7GCx9UO7424jbX28NRNrb3+CPBUDuP3 yuNJmtmESZU2UmE0hUd3tA51ty1e31xnJGkN7qhZOGlMVyz1LuWqiiWk5 S45mql+/HkpC5q6YIlTZIFJBtY4EyAtt5lWDtgccpkdpPlhYg9Hn1NtYJ A==; X-IronPort-AV: E=McAfee;i="6400,9594,10315"; a="348826558" X-IronPort-AV: E=Sophos;i="5.90,254,1643702400"; d="scan'208";a="348826558" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2022 07:39:05 -0700 X-IronPort-AV: E=Sophos;i="5.90,254,1643702400"; d="scan'208";a="551735814" Received: from vtelkarx-mobl.amr.corp.intel.com (HELO [10.209.191.73]) ([10.209.191.73]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2022 07:39:04 -0700 Message-ID: <2cd3132b-2c24-610e-1a96-591f2803404c@intel.com> Date: Tue, 12 Apr 2022 07:39:10 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US To: Fenghua Yu , "zhangfei.gao@foxmail.com" Cc: Joerg Roedel , jean-philippe , Ravi V Shankar , Tony Luck , Ashok Raj , Peter Zijlstra , Dave Hansen , x86 , linux-kernel , iommu , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Josh Poimboeuf , Thomas Gleixner References: <20220207230254.3342514-1-fenghua.yu@intel.com> <20220207230254.3342514-6-fenghua.yu@intel.com> <56ed509d-a7cf-1fde-676c-a28eb204989b@intel.com> From: Dave Hansen Subject: Re: [PATCH v4 05/11] iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/12/22 06:41, Fenghua Yu wrote: >> master process quit, mmput ->  mm_pasid_drop->ioasid_free >> But this ignore driver's iommu_sva_unbind_device function, >> iommu_sva_bind_device and iommu_sva_unbind_device are not pair,  So driver >> does not know ioasid is freed. >> >> Any suggestion? > ioasid is per process or per mm. A daemon process shouldn't share the same > ioasid with any other process with even its parent process. Its parent gets > an ioasid and frees it on exit. The ioasid is gone and shouldn't be used > by its child process. > > Each daemon process should call driver -> iommu_sva_bind_device -> ioasid_alloc > to get its own ioasid/PASID. On daemon quit, the ioasid is freed. > > That means nqnix needs to be changed. Fenghua, please step back for a second and look at what you are saying. Your patch caused userspace to break. Now, you're telling someone that they need to go change that userspace to work around something that your patch. How, exactly, are you suggesting that nginx could change to fix this? What, specifically, was it doing with *fork()* that was wrong? It sounds to me like you're saying that it's OK to break userspace. 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BD0A1C433F5 for ; Tue, 12 Apr 2022 14:39:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6D79360F2D; Tue, 12 Apr 2022 14:39:13 +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 Oslc40UK1y_P; Tue, 12 Apr 2022 14:39:12 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 5A59960E46; Tue, 12 Apr 2022 14:39:12 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 33667C0033; Tue, 12 Apr 2022 14:39:12 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id F0F95C002C for ; Tue, 12 Apr 2022 14:39:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id DF12F60F2D for ; Tue, 12 Apr 2022 14:39:11 +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 HWDeBVbvWDhe for ; Tue, 12 Apr 2022 14:39:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by smtp3.osuosl.org (Postfix) with ESMTPS id 4203560E46 for ; Tue, 12 Apr 2022 14:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649774351; x=1681310351; h=message-id:date:mime-version:to:cc:references:from: subject:in-reply-to:content-transfer-encoding; bh=GZj64pjcWXoZ+UWhUertM7DeZpkX/WIgVteyu9EF33A=; b=S22hoy+U/9g0wh8aAr/1BuGepJjIiqy369mPiubrDyqehu+W5LPumlo9 VHVDVldfFERs1h4ODTWLK9xUGNp4sOhwQQN5nj7KwtJ6sOf/UcLo5KC8r AnpzBVsSPA94JDcDbqP60zJGgB2vznQAaHxpMOLT6CiMap4Pp+3ejJO8C MdVxpafQI7eTRhFie9OMOPP+pHljuhRbvR29UIMGaPwehMBin2UNkudxJ c71JL87gX29vuxz/FlNuSK6AaXwr1UfoIXJHTZS7cvBk4GBOdUO+xW8AB +L9g9UotrNN9r3sT/6mdGiM7snxdXi6gN4YPqnq6gC3E8N/0ukT+0GBOD w==; X-IronPort-AV: E=McAfee;i="6400,9594,10315"; a="262569444" X-IronPort-AV: E=Sophos;i="5.90,254,1643702400"; d="scan'208";a="262569444" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2022 07:39:05 -0700 X-IronPort-AV: E=Sophos;i="5.90,254,1643702400"; d="scan'208";a="551735814" Received: from vtelkarx-mobl.amr.corp.intel.com (HELO [10.209.191.73]) ([10.209.191.73]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2022 07:39:04 -0700 Message-ID: <2cd3132b-2c24-610e-1a96-591f2803404c@intel.com> Date: Tue, 12 Apr 2022 07:39:10 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US To: Fenghua Yu , "zhangfei.gao@foxmail.com" References: <20220207230254.3342514-1-fenghua.yu@intel.com> <20220207230254.3342514-6-fenghua.yu@intel.com> <56ed509d-a7cf-1fde-676c-a28eb204989b@intel.com> From: Dave Hansen Subject: Re: [PATCH v4 05/11] iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit In-Reply-To: Cc: jean-philippe , Tony Luck , Ashok Raj , Ravi V Shankar , Peter Zijlstra , Dave Hansen , x86 , linux-kernel , iommu , Ingo Molnar , Borislav Petkov , 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="utf-8" Content-Transfer-Encoding: base64 Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" T24gNC8xMi8yMiAwNjo0MSwgRmVuZ2h1YSBZdSB3cm90ZToKPj4gbWFzdGVyIHByb2Nlc3MgcXVp dCwgbW1wdXQgLT7CoCBtbV9wYXNpZF9kcm9wLT5pb2FzaWRfZnJlZQo+PiBCdXQgdGhpcyBpZ25v cmUgZHJpdmVyJ3MgaW9tbXVfc3ZhX3VuYmluZF9kZXZpY2UgZnVuY3Rpb24sCj4+IGlvbW11X3N2 YV9iaW5kX2RldmljZSBhbmQgaW9tbXVfc3ZhX3V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