Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4224836pxb; Tue, 17 Nov 2020 15:02:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBo+Qf62/OiC9+/gmm/KoLls5rdpZ0b4gXeuy+tv3X2CKkrYwMYtvTgkDO+9q1CSQlKk+J X-Received: by 2002:a17:906:fcc2:: with SMTP id qx2mr22217034ejb.549.1605654128136; Tue, 17 Nov 2020 15:02:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605654128; cv=none; d=google.com; s=arc-20160816; b=B3r+csFGXzqTZP7txmZVVg90nub3Nm+4AQmr2UcH1wQmiDZXR8cuR5ZcdHj+nTcxAO up9x10wcUU5JdiA3V5DKSrNTleLaramgx4b5f3tOfxjyO3LxrEFc6RzT7qNPHaNSliuG SoLyZ+9DgZe1wLdLH6V6sVTo+Oil+pDeThem619AMMKZl7bcMz43izAWkQ2JBRpC9aG2 1WLnRWAuMgUxSrIpy5Q5P3rVG3s5gvwm4gCPBmIleymG+Eq31rBRvqI7pPxf91oLwzY7 PQk10Lon+jPKCcGSmxgDKbiab6yjH5kgL24gyl1Q/iSIzr9313k+9hb04jt9QqBwYkB/ EqSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=KgP6kIuW2/56O4LdccOpIcXq+RuiisQme+VZtaE2LFk=; b=QTYt+CDbTU3G733nX/FJoc7toXlghhDEvR73tnGkVf/Pag+kj0OFt+o/SLlM4JwOni f+aH5/eiZAma6PKR/JVoZiIs3rVgUQ6dz1gMixkuFz1O2CxYMLrb0yLcugix86VB98cB 10m7Tz404GcOAzNq+4xIV1FdkAuiYVHEed1ltLMbZIJu9WdXZyE3OlOxxJvMFuAjiGEh jSGc1ensYBjXE9Q6sXOfZoDTe2XWI4bJXCT49adWJ599cz/oxxOMZOZxaXb2ibvyH6so awjIN/dQL+3Iqs5n9892dly7Y7tei+5kzitrfW0KFxZQEam37O0wlRILQzkrPhNj6ex7 Y81A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D73w5s+6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si14993180edv.372.2020.11.17.15.01.45; Tue, 17 Nov 2020 15:02:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D73w5s+6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729444AbgKQW5W (ORCPT + 99 others); Tue, 17 Nov 2020 17:57:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:48516 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728521AbgKQW5W (ORCPT ); Tue, 17 Nov 2020 17:57:22 -0500 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BC03522202; Tue, 17 Nov 2020 22:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605653841; bh=KgP6kIuW2/56O4LdccOpIcXq+RuiisQme+VZtaE2LFk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=D73w5s+6pbC0lfIN6P0E9PzWBfZfNHkLIspBx7xGiSb9StntWhr6b+6rRYzmOTmmC SlPll7ltr48r+vg3hewCLk0famlOjGYTs1XdwidEEC0KWezG0bnkr/X10ifPYFzy2n +sa/U5hVGNMnYarhrP3GfLUORm9edCExp+AOfs30= Date: Tue, 17 Nov 2020 22:57:17 +0000 From: Will Deacon To: Suravee Suthikulpanit Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, joro@8bytes.org, Jon.Grimm@amd.com, brijesh.singh@amd.com Subject: Re: [PATCH] iommu/amd: Enforce 4k mapping for certain IOMMU data structures Message-ID: <20201117225717.GF524@willie-the-truck> References: <20201028231824.56504-1-suravee.suthikulpanit@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201028231824.56504-1-suravee.suthikulpanit@amd.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 28, 2020 at 11:18:24PM +0000, Suravee Suthikulpanit wrote: > AMD IOMMU requires 4k-aligned pages for the event log, the PPR log, > and the completion wait write-back regions. However, when allocating > the pages, they could be part of large mapping (e.g. 2M) page. > This causes #PF due to the SNP RMP hardware enforces the check based > on the page level for these data structures. Please could you include an example backtrace here? > So, fix by calling set_memory_4k() on the allocated pages. I think I'm missing something here. set_memory_4k() will break the kernel linear mapping up into page granular mappings, but the IOMMU isn't using that mapping, right? It's just using the physical address returned by iommu_virt_to_phys(), so why does it matter? Just be nice to capture some of this rationale in the log, especially as I'm not familiar with this device. > Fixes: commit c69d89aff393 ("iommu/amd: Use 4K page for completion wait write-back semaphore") I couldn't figure out how that commit could cause this problem. Please can you explain that to me? Cheers, Will