From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758148AbcGKJZf (ORCPT ); Mon, 11 Jul 2016 05:25:35 -0400 Received: from mr213139.mail.yeah.net ([223.252.213.139]:19909 "EHLO mr213139.mail.yeah.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751424AbcGKJZe (ORCPT ); Mon, 11 Jul 2016 05:25:34 -0400 X-Greylist: delayed 78275 seconds by postgrey-1.27 at vger.kernel.org; Mon, 11 Jul 2016 05:25:33 EDT Subject: Re: [PATCH] iommu/amd: Fix unity mapping initialization race To: Joerg Roedel References: <1467820838-5059-1-git-send-email-joro@8bytes.org> <57823445.1020808@iommu.org> <20160711071959.GB12639@8bytes.org> Cc: iommu@lists.linux-foundation.org, Joerg Roedel , linux-kernel@vger.kernel.org, stable@vger.kernel.org From: Wan Zongshun Message-ID: <57836609.5060406@iommu.org> Date: Mon, 11 Jul 2016 17:25:29 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <20160711071959.GB12639@8bytes.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1koWUFPN1dZCBgUCR5ZQVZIVU1NSUJCQkNNQ0hCSUJPT0hXWQkOFx4IWU FZKCs9JDU0NT4kMjUkMz46Pz4pQUtVS0A2IyQiPigkMjUkMz46Pz4pQUtVS0ArLykkNTQkMjUkMz 46Pz4pQUtVS0A4NC41LykiJDg1QUtVS0ApPjwyNDUkOigyOkFLVUtAKyk0LTI1OD4kKDM6NTwzOj JBS1VLQD8iNTo2MjgkMiskNTQkMjUkMz46Pz4pQUtVS0A2LjcvMiQpOCsvJD8yPT0#KT41LyQyNS QzPjo*PilBSVVLQDIrJEhLJDYyNS4vPiQ4NS8kSyROS0FLVUtAMiskSiQ2MjUuLz4kODUvJEskSk tBS1VLQDIrJC80PzoiJDg1LyRLJEpLS0FLVUtAMiskTiQ2MjUuLz4kODUvJEskSktBS1VLQDIrJE okMzQuKSQ4NS8kSyRKS0tBS1VLQCguOTE#OC8kLzQ*OiIkODUvJEskSktLQUtVS0AoLjkxPjgvJE 4kNjI1Li8#JDg1LyRLJEpLQUtVS0AoLjkxPjgvJEokMzQuKSQ4NS8kSyRKS0tBS1VLQCg5MSQ3Pj UkT0skI0FLVUtLSktALz4jLyQ3PjUkSklDSyQjQUtVS0tKS0A4NS8kMy82NyQ3PjUkSjAkTjBBS1 VLS0pLQCk#OD4yLT4pJDg1LyRKJE5BS1VLS0pLQCM2OjI3PikkNS43N0FLVUtLSktAPz43Mi0#KS Q3PjUkS0FLVUtLSktANzo1PCQ#NUFLVUtLSktAPSskKT4kPSwkMzcxJEtDS0hLTUFWTFVOQD01JC guOSQ#NSw0KT8oJDM3MSRKS0tJS0pBS1VJQ0AoLjkkPkFKVU5OQD01JDY6IiRPSkIkMzcxJEkkS0 NLSEtPQUtVS1kG X-HM-Sender-Digest: e1kSHx4VD1lBWUc6PAw6Txw4IjosEDIYAToiPwIBERkKCh9VSlVKT01D SUlCSkhLSEpMVTMWGhIXVQ0MOxIUFhYOVRQJHEVZV1kMHhlZQR0aFwgeV1kIAVlBSUNLTjdXWRIL WUFZSUpLVUpIVUJMVUpNQ1kG X-HM-Tid: 0a55d94697917d8bd7c891c263e Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016年07月11日 15:19, Joerg Roedel wrote: > On Sun, Jul 10, 2016 at 07:40:53PM +0800, Wan Zongshun wrote: >> Do you mean we need enable the V and TV bits to DTE entry after all >> DTEs tables were initialized completely? > > Yes, this is what my patch does and what fixes the bug that was > reported on machines which have unity-mapping entries. Okay, this patch should also better to general case not only unity-mapping. How about the interrupt remap function? Do we need same considering for IV bit enable for interrupt remap? > >> I checked this function 'init_device_table_dma', and find it just set >> V and TV bit, to set translation info valid and DTE bits127:1 valid. > > Right, if no other bits are set this blocks all DMA from the gives > device-id. Sorry, why you still say this 'init_device_table_dma' can block DMA? I just think this function will enable DMA transfer, since we set the V and TV bits, right? or I misunderstand what "block DMA" mean? > >> So I just think all things it should to do are to allow DMA access, >> GPA-to-SPA translation should be active, why you add function >> comments below is to not allow DMA access and suppress all page >> faults? >> >> /* >> * Init the device table to not allow DMA access for devices and >> * suppress all page faults >> */ > > Yeah, that comment needs to be updated. Not all DMA is blocked and > page-faults are not suppressed at all. Thanks for noticing. > > > > Joerg > >