From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753210AbbCWM3R (ORCPT ); Mon, 23 Mar 2015 08:29:17 -0400 Received: from 8bytes.org ([81.169.241.247]:33957 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752552AbbCWM3M (ORCPT ); Mon, 23 Mar 2015 08:29:12 -0400 Date: Mon, 23 Mar 2015 13:29:10 +0100 From: Joerg Roedel To: Tomasz Figa Cc: iommu@lists.linux-foundation.org, "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "open list:ARM/Rockchip SoC..." , Heiko Stuebner , Daniel Kurtz Subject: Re: [PATCH] CHROMIUM: iommu: rockchip: Make sure that page table state is coherent Message-ID: <20150323122910.GO4441@8bytes.org> References: <1423480761-33453-1-git-send-email-tfiga@chromium.org> <20150303133659.GD10502@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Tomasz, On Mon, Mar 23, 2015 at 05:38:45PM +0900, Tomasz Figa wrote: > While unmapping, the driver zaps all iovas belonging to the mapping, > so the page tables not used by any mapping won't be cached. Now when > the driver creates a mapping it might end up occupying several page > tables. However, since the mapping area is virtually contiguous, only > the first and last page table can be shared with different mappings. > This means that only first and last iovas can be already cached. In > fact, we could detect if first and last page tables are shared and do > not zap at all, but this wouldn't really optimize too much. Why > invalidating one iova is enough to invalidate the whole page table is > unclear to me as well, but it seems to be the correct way on this > hardware. > > As for the race, it's also kind of explained by the above. The already > running hardware can trigger page table look-ups in the IOMMU and so > caching of the page table between our zapping and updating its > contents. With this patch zapping is performed after updating the page > table so the race is gone. Okay, this makes sense. Can you add this information to the patch changelog and resend please? Thanks, Joerg