From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751583AbdH3NbQ (ORCPT ); Wed, 30 Aug 2017 09:31:16 -0400 Received: from 8bytes.org ([81.169.241.247]:43100 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751388AbdH3NbO (ORCPT ); Wed, 30 Aug 2017 09:31:14 -0400 Date: Wed, 30 Aug 2017 15:31:12 +0200 From: Joerg Roedel To: Filippo Sironi Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, David Woodhouse , David Woodhouse Subject: Re: [PATCH] intel-iommu: Don't be too aggressive when clearing one context entry Message-ID: <20170830133112.btbsmgbm2clz4767@8bytes.org> References: <1503929789-26698-1-git-send-email-sironi@amazon.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1503929789-26698-1-git-send-email-sironi@amazon.de> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Filippo, please change the subject to: iommu/vt-d: Don't be too aggressive when clearing one context entry to follow the convention used in the iommu-tree. Another comment below. On Mon, Aug 28, 2017 at 04:16:29PM +0200, Filippo Sironi wrote: > static void domain_context_clear_one(struct intel_iommu *iommu, u8 bus, u8 devfn) > { > + unsigned long flags; > + struct context_entry *context; > + u16 did_old; > + > if (!iommu) > return; > > + spin_lock_irqsave(&iommu->lock, flags); > + context = iommu_context_addr(iommu, bus, devfn, 0); > + if (!context) { > + spin_unlock_irqrestore(&iommu->lock, flags); > + return; > + } > + did_old = context_domain_id(context); > + spin_unlock_irqrestore(&iommu->lock, flags); > clear_context_table(iommu, bus, devfn); This function is the only caller of clear_context_table(), which does similar things (like fetching the context-entry) as you are adding above. So you can either make clear_context_table() return the old domain-id so that you don't need to do it here, or you get rid of the function entirely and add the context_clear_entry() and __iommu_flush_cache() calls into this code-path. Regards, Joerg