Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp17542ybm; Mon, 20 May 2019 11:04:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrqWDavSbMe1Tuk/WVrntoi6rWIvvVWgiJz1GegZMOihlE9ZfOgrMSnwfZeS1hxGM3RDFh X-Received: by 2002:a17:902:e9:: with SMTP id a96mr50764864pla.37.1558375476217; Mon, 20 May 2019 11:04:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558375476; cv=none; d=google.com; s=arc-20160816; b=BrxujWmEC9hzmux4oIjGhz96YqmylEvZZcLWfQxXbkwQFy3KiDYqC8AmN0pFstTSKq 2zSVR+d91o/LnJK45fc0kt+Yj21KfR5FEcvZ4zyv6t7dj7B3a+z5HJt45wu8BkBXUkKp /grCJDcNDLZHnE1t+gZK/HuwcDBi1TUAvkWAjn80ZF/0zRg2rHYW3Adlu96dyUeikTvW H3B8CkQwPTT2mv7siMlT9+MPTO+K3KBZt0QdDSo92p4/MTAaQgjCRSU8CgCPPVBB0QKg 4HVa9MOvTy7H69MkRS5ohOmaCMiSP16iDuBuOirBl3R5YSX2NycDFDkDKwpeS2JTh4eV /dbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=pV+l/gGBqFqSEsa2A3Ab1eSkjx1rUiCqjcb4PLSMcfw=; b=uqmR5QjzpB9yHO5FC0X6p9x9iJMViDyCIDgHYznbeKeSKpk6yYq8wsabqYqbrqPIRP mSTKJ3NMAoMbFvMxDD5AsMpaq83u9fYO8Z3NG7pFb43H2m0N+VG54oV5eGVKiahoSOZa 9r3vYf2P5psZ2Vl4Kpn8gmFGvJHTmRiCAXcUMFKcf821SM6Lefd2du5xdV9pqUqt67Jk 5pfT12sd+Ij6YzcyFL7iv6MtUXaBQf6pZ1sPQ7UkgFZQfSAPUIlqG4/33uHt7K+pR7y9 xSiWDz8YgxFcw8T6emrarUAvPH3g80RQfPVtExovJM316DKjfipsf/ga12xQPbofNbZp 0RQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s20si19703937pgj.63.2019.05.20.11.04.21; Mon, 20 May 2019 11:04:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389319AbfETNnL (ORCPT + 99 others); Mon, 20 May 2019 09:43:11 -0400 Received: from mga07.intel.com ([134.134.136.100]:25194 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388106AbfETNnL (ORCPT ); Mon, 20 May 2019 09:43:11 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 May 2019 06:43:11 -0700 X-ExtLoop1: 1 Received: from gklab-127-091.igk.intel.com (HELO gklab-125-020.igk.intel.com) ([10.91.125.20]) by orsmga004.jf.intel.com with ESMTP; 20 May 2019 06:43:09 -0700 From: Lukasz Odzioba To: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org Cc: dwmw2@infradead.org, joro@8bytes.org, lukasz.odzioba@intel.com, grzegorz.andrejczuk@intel.com Subject: [PATCH 1/1] iommu/vt-d: Remove unnecessary rcu_read_locks Date: Mon, 20 May 2019 15:41:28 +0200 Message-Id: <1558359688-21804-1-git-send-email-lukasz.odzioba@intel.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We use RCU's for rarely updated lists like iommus, rmrr, atsr units. I'm not sure why domain_remove_dev_info() in domain_exit() was surrounded by rcu_read_lock. Lock was present before refactoring in d160aca527, but it was related to rcu list, not domain_remove_dev_info function. dmar_remove_one_dev_info() doesn't touch any of those lists, so it doesn't require a lock. In fact it is called 6 times without it anyway. Fixes: d160aca5276d ("iommu/vt-d: Unify domain->iommu attach/detachment") Signed-off-by: Lukasz Odzioba --- drivers/iommu/intel-iommu.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index a209199..1b7ad80 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -1911,9 +1911,7 @@ static void domain_exit(struct dmar_domain *domain) struct page *freelist; /* Remove associated devices and clear attached or cached domains */ - rcu_read_lock(); domain_remove_dev_info(domain); - rcu_read_unlock(); /* destroy iovas */ put_iova_domain(&domain->iovad); @@ -5254,9 +5252,7 @@ static int intel_iommu_attach_device(struct iommu_domain *domain, old_domain = find_domain(dev); if (old_domain) { - rcu_read_lock(); dmar_remove_one_dev_info(dev); - rcu_read_unlock(); if (!domain_type_is_vm_or_si(old_domain) && list_empty(&old_domain->devices)) -- 1.8.3.1