Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp385093lqg; Thu, 11 Apr 2024 06:13:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVtuyqXwZFBND5TvaD9TTvbqxEpX3KHpPp6c3rbwSZpv0VhXJ69y0511PlDTopZ3fai0w/dcSb5PirWVMZsWnMAAp04o54dKSz3957TLA== X-Google-Smtp-Source: AGHT+IHJYgh0KgGMqlpjVGURTPpwNp3ZeOEbvwm5tC+6WOM1ML43qIdxUQNYSdLUHznQ6H5eyd6e X-Received: by 2002:ac2:5dca:0:b0:515:d2d2:b114 with SMTP id x10-20020ac25dca000000b00515d2d2b114mr4085200lfq.15.1712841213377; Thu, 11 Apr 2024 06:13:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712841213; cv=pass; d=google.com; s=arc-20160816; b=G7YTihgdD5yBwhY/u/SHLH4hHsxxpHrXDYCxseA0JrWu88oSYKACb5LouAFs5ZXJ9q yD7zpwuxyPgf/B+fUj+NisnwT9iigXqJu1TQMfyHo8f22Un2sxsBo0q0C5s016CpztA8 VK1Mcpl5BbDfMo8+Rtgqf/JHA09BO3dk9KS7W308gDh265LyyREcRzId3i9j/N/F9kaa RlWLkQFcJmHOhcpUtqOHfe/WieVje0nnlf6Euo2WUhjolMhjcAMWnfWEUHQ3r36PN7oL EXzpZjPMoPnpBi+tiqWJDpaqWPLzOqSAZSvp35ZCWPrE5mJkzIVjPKulqy2dm2KLNxVQ GF1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:cc:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=A4tQECs/Axfklt5hXpIShT0gsJVoGY3C4bW8o02pkuE=; fh=BeEDaLHsuoWSEbT0zS8NFbrQKm15nyNNc9drLfBH0o0=; b=T+sPkakzFEn26pkjBLls1uEQGIXk3lYIw+VHYC0chimpZikZUfqP+rvjPF5BGhQ4uX hz9ujV0THPY3DUAeBJ3O9RBmapiTyyXe+hLC+ZffZeY/t6lpcPBpV873IapXPqOaONUg ud2QH3A19uqKUghgsHmpDJEdZCIM1vidNRPphJKYIW0lCljJNlRjinXQED2V89ryWwvi 8TPwxwVhVce/Yzb9M97z1zvPsAZ42A6GL39cX6h8/M1yR+kjPjQv5oR3/HBJsWKFNx20 APxuB9vfaHvyl4AelYqqwZ19O57ucXvA+EXw0G/vpb8oaN+mFFHe+2bE/shjU4Du97Cw xNKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XrTQIeY3; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-140486-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140486-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id go11-20020a1709070d8b00b00a520f9550a7si805336ejc.795.2024.04.11.06.13.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 06:13:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140486-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XrTQIeY3; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-140486-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140486-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1D2D41F223A7 for ; Thu, 11 Apr 2024 13:13:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46AF414C5A0; Thu, 11 Apr 2024 13:13:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XrTQIeY3" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBEE128FD for ; Thu, 11 Apr 2024 13:13:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712841204; cv=none; b=d+j+dxIJRHBfLt3vzBzDTbhh2pD8lm1Ir0HmulCNQw8h0Fn1HxOr4brdk4vWwDwPtcZQWcCAeKmaVvCQLVwXxR0OQBwIraCno1AoH9XPrc7l49005wb0Xn2ShJjY/na2P8LQT3bw6bBsJMQ62tPW+Q0UZGToSxVMYuQYacikHNk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712841204; c=relaxed/simple; bh=Qc0t+cqqeoMdgUIn/T47SwdSm2G2cSbQh1SlaJhaCXc=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=R2QEYG+YfEzijbuVx+S7gOGXns85XaX8p+R1cFike+diu10DC9uvsyVZXITXEXZmu7lzb5Re0aHjOYFp66nzRJhFBUxwpG4fVdUTpeRwpPP4AsJU2zKd+lJ7c2pBb8atE7HeAmIQgXTEpCQ5Kx65nPQDYrxfryQMwhLhT4cu7Q4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XrTQIeY3; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712841203; x=1744377203; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=Qc0t+cqqeoMdgUIn/T47SwdSm2G2cSbQh1SlaJhaCXc=; b=XrTQIeY3R949q19BxD60BtD/fNpTSiHoTWTfJ5/RXjXw+FHeA9Ev/YvA VCNenCufrRG2xsNrYBwzGQiUt+3HvK/6NzkRDgYf9Jab8LdvFqkkNST3D s1/R8RgZ+kFupKXPlgeuBeJ3kb3pDWH5gPbTxCMF2Nev2eblMbGWmTByT Kl/zdwWFMV9kvGgTszREoUBvPgujT0Qi9AHez17LIxT8SMYYkeuGj5fkd u2aFyQh67fZGjE/VnskWQmbrDuIEOU5LyFzR4G+iYUYDD029v0S9hZJ+9 ilEVKtkdhiPkfDGe+B4t3oRoltKB4VOS7V7DR5WgYMriQOfKJUcpdME5k w==; X-CSE-ConnectionGUID: HcUKcSMTTu+qi5kz634NgQ== X-CSE-MsgGUID: 8Y9oBlNYRu6ytz4BMVZZgA== X-IronPort-AV: E=McAfee;i="6600,9927,11041"; a="8808910" X-IronPort-AV: E=Sophos;i="6.07,193,1708416000"; d="scan'208";a="8808910" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2024 06:13:22 -0700 X-CSE-ConnectionGUID: BS9oqWvmRAGAwxMO9xlh1w== X-CSE-MsgGUID: tJcYxFp1SZKyrviBDzrgMg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,193,1708416000"; d="scan'208";a="20857588" Received: from blu2-mobl.ccr.corp.intel.com (HELO [10.124.237.86]) ([10.124.237.86]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2024 06:13:20 -0700 Message-ID: <83c02530-230a-4ae0-8853-5da95c0ee814@linux.intel.com> Date: Thu, 11 Apr 2024 21:13:17 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: baolu.lu@linux.intel.com, Joerg Roedel , Will Deacon , Robin Murphy , Kevin Tian , Tina Zhang , Yi Liu , iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 12/12] iommu/vt-d: Retire struct intel_svm To: Jason Gunthorpe References: <20240410020844.253535-1-baolu.lu@linux.intel.com> <20240410020844.253535-13-baolu.lu@linux.intel.com> <20240410154951.GH223006@ziepe.ca> <20240411130759.GJ223006@ziepe.ca> Content-Language: en-US From: Baolu Lu In-Reply-To: <20240411130759.GJ223006@ziepe.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/4/11 21:07, Jason Gunthorpe wrote: >> +static void intel_mm_free_notifier(struct mmu_notifier *mn) >> +{ >> + kfree(container_of(mn, struct dmar_domain, notifier)); >> +} >> + >> static const struct mmu_notifier_ops intel_mmuops = { >> .release = intel_mm_release, >> .arch_invalidate_secondary_tlbs = >> intel_arch_invalidate_secondary_tlbs, >> + .free_notifier = intel_mm_free_notifier, >> }; >> >> static int intel_svm_set_dev_pasid(struct iommu_domain *domain, >> @@ -598,10 +604,8 @@ static void intel_svm_domain_free(struct iommu_domain >> *domain) >> { >> struct dmar_domain *dmar_domain = to_dmar_domain(domain); >> >> - if (dmar_domain->notifier.ops) >> - mmu_notifier_unregister(&dmar_domain->notifier, domain->mm); >> - >> - kfree(dmar_domain); >> + /* dmar_domain free is defered to the mmu free_notifier callback. */ >> + mmu_notifier_put(&dmar_domain->notifier); >> } > Yeah, that is better. > > Also you need to have mmu notifier call on module unload when using > this scheme. The Intel IOMMU driver doesn't support being a module. It's always built-in. Best regards, baolu