Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1281590rdg; Fri, 13 Oct 2023 17:03:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpU0yfDUiPuakZ8zlQS75wdIvOYLddspXMhRPrWGEtvtiIBneDgiffOCrXUSbjNm1DwHw4 X-Received: by 2002:a6b:4403:0:b0:790:fc73:6e3c with SMTP id r3-20020a6b4403000000b00790fc736e3cmr29701611ioa.8.1697241809471; Fri, 13 Oct 2023 17:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697241809; cv=none; d=google.com; s=arc-20160816; b=hCmrTqUavPds2ieQQsdwnDkyMM+XPAst7rPn1Lmnwzzwhop3TZKXWrMGhDkLQNf6w9 npy1aXq4Z+19SU2JUVw0iLMSY4kTFCs1Pkcd8r6ws8k6CDNVgRLB6Ev9LwBeBm8LQfuf mTeiWDA1AhY+teXbFEPt4gybcsatwrnaAsTt0Tm4EBqoHllxdD8/3nfDvoZENdcilcdr xDwvIInJrhwkAULw0lZ/jA13rLwcxehVYtSnNsrBw1ASPJDRVwq7jDM7ZwkaItHTq8Hm kqI5/QL7HiLbebWcBsMYbzMTQh/bQP+PDJws+mQqRbaaThhUIkS2cdYan1yqaW42mHl/ 3WAQ== 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:dkim-signature; bh=1pu4GPKVHdVAz2d7eDY4KT/eGDlYfuZ16MfTjdAOYmw=; fh=hPb+rWgXla7pe0H6R54QNBe+GJlduwSqZFwKapemP0U=; b=SVIprRd1QVppwhG7krcaas31fU8CfokqxcUzu9++BcMQsAWILBLbONLmua+sak2or3 Hx2gPbSfensx4GhBzZskhL4KfqrEzrqR8G8yLsI1GOmvxB8vZxRe8Vl/BjnVy94ufnlK clox0HXmafZ+lGWYqBeDWybGWXy8hFNFUja6V5OPrDe2MgBwhelAZgNm8lfovxkKsGKU 3pyJF5DRxsIEhd+sNL1IIRajYbgGCFQ+Re6ka7nRpG98lVeo2AzpoTxFDPkzxh9yykSn Ysbs9Ufzwkn/7HzL2Yr6dhkO19vGmWeoQQfxsxgsq2fnNhr0FtSvTjiZzC0CF3/hz7+/ BiZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=C4tk+3Zi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l62-20020a633e41000000b005b11e5a69f8si410039pga.531.2023.10.13.17.03.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 17:03:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=C4tk+3Zi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9288A82F3480; Fri, 13 Oct 2023 17:03:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229518AbjJNADZ (ORCPT + 99 others); Fri, 13 Oct 2023 20:03:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229830AbjJNADY (ORCPT ); Fri, 13 Oct 2023 20:03:24 -0400 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12B71AD for ; Fri, 13 Oct 2023 17:03:23 -0700 (PDT) Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-66d03491a1eso13922326d6.2 for ; Fri, 13 Oct 2023 17:03:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1697241802; x=1697846602; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=1pu4GPKVHdVAz2d7eDY4KT/eGDlYfuZ16MfTjdAOYmw=; b=C4tk+3Zii0YpapRtGo1cZgPTYyZud3uH9HR7h10Zvn7Obo+1zSxvuetQJXpfutG9r5 utFM0hyROaue+L6PTixZzZ/0j6PzZK2MZixaccysy08aTrTdEy7435rpOXIgX2jijKVK Jv9eBYprSBqygSwxp1oRwtR6RVtGIpsCcusTWdbe5VXju6h8KUeY8lB7jAd502JcRQPo mHEbtqQPGHV2UA6RMPXwsosFkHO/DjCdanQZyG+wvVrIAsLA2pPY0GE7CPFWCArGUvg/ UFB3R5qkuCC0q8dgBuLesj09NhWKrmsODiJzjUfZo5+9iExxeAUJQ2mJ5O179vy4CNy7 NLpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697241802; x=1697846602; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1pu4GPKVHdVAz2d7eDY4KT/eGDlYfuZ16MfTjdAOYmw=; b=UQ9XNqkwnT4GvLXhhfe2TYMHbCQUFSB3Qs9H4cdr5q9kvRZ2mpRBberD/Dg2pVNgAn 9OQcJfoMNQCsj+AOTUS9VX5EMrtii/2TCUV+waBKKVv8DnvDp6IzTZWvdEO4tGnLe6TZ 12xpbJ/1thUBI8f/52ZL76C7/28bQ03AzyucWebsgEdTjr5b/7jjnMffnGsuzMDp8KlM 4V2wtcZaYQ55LVqCjv1835hH2XjrTP3EOpsllFy8HfeJB/oaiH3FI79DvYmKiwNZ+o3f 1ck5tCqEvwzfj62pLB/jQwxXycG8EwmCBSI3L1bDnOxHa+wKNMFNUnFTy3jQ8NG5+Dnh /XUA== X-Gm-Message-State: AOJu0YytZ8eBR75QzblgXJRVLuET+V/BX25JOHLXd/9qfDAtUM2e5YuS pCGDH7DpMylYbd6zD9U9R/elxIcJHEf+qBOPadE= X-Received: by 2002:a05:6214:cae:b0:66d:1d92:c694 with SMTP id s14-20020a0562140cae00b0066d1d92c694mr6175065qvs.58.1697241802137; Fri, 13 Oct 2023 17:03:22 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-26-201.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.26.201]) by smtp.gmail.com with ESMTPSA id j28-20020a05620a001c00b007756d233fbdsm1058544qki.37.2023.10.13.17.03.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 17:03:21 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1qrS7k-001Xz2-S8; Fri, 13 Oct 2023 21:03:20 -0300 Date: Fri, 13 Oct 2023 21:03:20 -0300 From: Jason Gunthorpe To: "Zhang, Tina" Cc: "Tian, Kevin" , Lu Baolu , Michael Shavit , Vasant Hegde , Nicolin Chen , "linux-kernel@vger.kernel.org" , "iommu@lists.linux.dev" Subject: Re: [PATCH v7 4/5] iommu: Support mm PASID 1:n with sva domains Message-ID: <20231014000320.GC282036@ziepe.ca> References: <20231012030112.82270-1-tina.zhang@intel.com> <20231012030112.82270-5-tina.zhang@intel.com> <20231012134310.GI55194@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 13 Oct 2023 17:03:28 -0700 (PDT) On Fri, Oct 13, 2023 at 09:57:30AM +0000, Zhang, Tina wrote: > Hi, > > > -----Original Message----- > > From: Jason Gunthorpe > > Sent: Thursday, October 12, 2023 9:43 PM > > To: Zhang, Tina > > Cc: Tian, Kevin ; Lu Baolu ; > > Michael Shavit ; Vasant Hegde > > ; Nicolin Chen ^C-cc=iommu @ lists . linux . dev > > ; linux-kernel@vger.kernel.org > > Subject: Re: [PATCH v7 4/5] iommu: Support mm PASID 1:n with sva domains > > > > On Thu, Oct 12, 2023 at 11:01:11AM +0800, Tina Zhang wrote: > > > > > @@ -1188,15 +1193,26 @@ static inline bool > > > tegra_dev_iommu_get_stream_id(struct device *dev, u32 *stream #ifdef > > > CONFIG_IOMMU_SVA static inline void mm_pasid_init(struct mm_struct > > > *mm) { > > > - mm->pasid = IOMMU_PASID_INVALID; > > > + /* > > > + * During dup_mm(), a new mm will be memcpy'd from an old one > > and that makes > > > + * the new mm and the old one point to a same iommu_mm > > instance. When either > > > + * one of the two mms gets released, the iommu_mm instance is > > freed, leaving > > > + * the other mm running into a use-after-free/double-free problem. > > To avoid > > > + * the problem, zeroing the iommu_mm pointer of a new mm is > > needed here. > > > + */ > > > + mm->iommu_mm = NULL; > > > } > > > > newlines after all the }, between functions doesn't checkpatch complain? > Checked with checkpatch but didn't see any complaining. > > > > > IMHO this hunk should be moved to the prior patch. > In this patch, we switch to use mm->iommu_mm. That's why the iommu_mm initialization is put in this patch. > > I think I met some problem about my mailbox when I was sending this > new version. It didn't cc iommu@lists.linux.dev. Should I resend > this version again or reply to the patches with > iommu@lists.linux.dev cc'd? Tidy the nits and resend a v8 if addresses got missed Jason