Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3900254iob; Sat, 7 May 2022 19:41:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoFLrs3g0Yh2hFyQcOUSb/Djd/TQWVTz3g1E0YMl1zlOJ7nJfIozRKpBEQQeHb0b1FqDZQ X-Received: by 2002:a17:906:9f0c:b0:6f5:bed:d0a8 with SMTP id fy12-20020a1709069f0c00b006f50bedd0a8mr9107030ejc.94.1651977708084; Sat, 07 May 2022 19:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651977708; cv=none; d=google.com; s=arc-20160816; b=e4ruCAewA0cC0+6Z5ZXUapE0eZzS4qWUyHdvlP89FM+dEbwSYTo+MewXlGvmG+ukZp TWkMMfQ8QjgNwastZy2LEIMsDjQ/Uibbqltm/VBv2JNvtk5X2HkCMkAGmjCzjnyTl4mR pACBGq0CXb+lGtBURLevo05fFHNZvMJFPO6m+rqnovQMExLUF8r6Vp3hhNeMtNlAayMV AUagoxZ0Ie9doA9WgkCsFkGGjKpbVZotbfnR6POZQxQFXQbzW33PT/WX4tAojJ2zOmst Ul7jzQQpd9UmT3INZe00cH5bmMdI8he4xOPJOS6FhiqrOgKjN9UdUp5EaCuhv4K/eEpM nQww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=osqKn+xrusuXIosiFNbySqbKs7xoSop+F7bechXoiiQ=; b=zBfzQv8hkoHMjguwN8lpCYllSAq5qEC2GDRJrm0FkJtlxNuN2QhZ65qro2nDmQ+DSF WaTSXjv2g/gU3/+pNTLdEF9aLJzSmpI1pgq3YM4HTDs7uGBfh5fqrlOU4qO6Zi7+398/ eGpbB215BVvfBtAckN567b6QDko9/sZqUmzbvKb/y9K80woPpXPnApvTm7qXBAdYOHCR KQGdtCoOZkBoMO622M5DWGhqwqzA4PCkVmGN+ZwVT44hEe0LITlr6JcC6LHQqzmG3vhe P1lwF2DE3FIoOw8N4wl3eNtD6uW9ka5jRUrWxDdeZhoTq3qPrfzfNvfpBATuhCoP49BP ZTjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I1+oMP8u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr29-20020a1709073f9d00b006f3cea934edsi11047890ejc.917.2022.05.07.19.41.25; Sat, 07 May 2022 19:41:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I1+oMP8u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389231AbiEFFk0 (ORCPT + 99 others); Fri, 6 May 2022 01:40:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241031AbiEFFkZ (ORCPT ); Fri, 6 May 2022 01:40:25 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 243AF5E76E for ; Thu, 5 May 2022 22:36:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651815404; x=1683351404; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=7WUabhyWEk0L7SRCIeRBJvTnaBGJT01I1lM5YJHnXF8=; b=I1+oMP8uW81gtiV+Cja77FEA063QVbPXr+81v1ktL8HloNXxz4iL4GBQ Wb8H64tr7gAd+f+BloX2xpv0UmtFBE/NyO5wY+yQ+xuhX3ZzpwJGN5OWQ B2rUreI6uJq5ebmu7lUt1z8iWhSU7qNNZX2iD5DQzrnY5PGFE/ePsvFvz jjy43P7OmmGtCh/3bkq9KZWT3l1PikCihw3IrZ/lBYAxFdrACug0lzGWI iGo8gI55rRAvi7k+a0J+tqMJ1+gBjF6FTyz7smhy9mw9nMg32gxV830fK zezjxzLsK97/xhYInhmEdNulFvUzuVAhNZGC4+z0eLmvZr0SMYOFcEa+1 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10338"; a="267198191" X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="267198191" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 22:36:43 -0700 X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="735407780" Received: from sunyanwa-mobl1.ccr.corp.intel.com (HELO [10.255.31.183]) ([10.255.31.183]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 22:36:39 -0700 Message-ID: Date: Fri, 6 May 2022 13:36:37 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v4 05/11] iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit Content-Language: en-US To: Jean-Philippe Brucker Cc: Fenghua Yu , Dave Hansen , Tony Luck , Ashok Raj , Ravi V Shankar , Peter Zijlstra , robin.murphy@arm.com, Dave Hansen , x86 , linux-kernel , iommu , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Josh Poimboeuf , zhangfei.gao@linaro.org, Thomas Gleixner , will@kernel.org References: <8c044e49-74bb-df56-8a60-663013c0910e@intel.com> <63582490-a794-fd11-0380-44b27cc660b7@intel.com> <044595e6-e5d0-26c2-af8e-fc9d06906179@linux.intel.com> <3ea91623-97ea-f318-70db-55f08922d7ce@linux.intel.com> From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/5/3 15:49, Jean-Philippe Brucker wrote: > On Sat, Apr 30, 2022 at 03:33:17PM +0800, Baolu Lu wrote: >> Jean, another quick question about the iommu_sva_bind_device() >> >> /** >> * iommu_sva_bind_device() - Bind a process address space to a device >> * @dev: the device >> * @mm: the mm to bind, caller must hold a reference to it >> * @drvdata: opaque data pointer to pass to bind callback >> >> This interface requires the caller to take a reference to mm. Which >> reference should it take, mm->mm_count or mm->mm_users? It's better to >> make it explicit in this comment. > > Agreed, it's mm_users as required by mmu_notifier_register() Thanks! I will add this in my refactoring patch. Best regards, baolu