From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92BD0C77B78 for ; Thu, 4 May 2023 05:11:05 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4QBhjg5YGbz3fJP for ; Thu, 4 May 2023 15:11:03 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=QFf8Ux0U; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4QBhhl1dsdz3bZj for ; Thu, 4 May 2023 15:10:15 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=QFf8Ux0U; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4QBhhk6sYyz4x3d; Thu, 4 May 2023 15:10:14 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1683177015; bh=rUwC7Lt3vFnAcTqaOV2gQ+KB+PNQj/IIiU5kKEIseWA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=QFf8Ux0UKKvtuDIAcGdEiliNexVuu+4LFw9XigpjLyj+1TgAGOoDhAaNGjVQABHDf dzQwxDK4oqbnnmQrUlIB7gsY1zoOaPuTMfQv5Wq87Dr5BdSTF63ICs2JTmx+9G5DAw A4KfIWPhWO2V3PJdWxeGJTBMid/WhhVu6l+2PZJ5grF2D9c4g3nLBvzzWhxInJ6K+4 21k1wgjhKDe9rTr/sV5GKBzxFM7ORlubTJEkY2yS24w9sXh2fMgpdSXE91zGo2eYjn /EzBD6EXlA+yaXRLY+PPQnPT7CACb53kTo/pc1hrd4XNYv8aVQq8PjmVa2pHkRFyBz 74C9z5XNa2rzw== From: Michael Ellerman To: Gaurav Batra Subject: Re: [PATCH v2] powerpc/iommu: DMA address offset is incorrectly calculated with 2MB TCEs In-Reply-To: <1ce16c05-b492-fed8-06af-0bbba9de9053@linux.vnet.ibm.com> References: <20230419152623.26439-1-gbatra@linux.vnet.ibm.com> <87leimfuk0.fsf@mail.concordia> <1ce16c05-b492-fed8-06af-0bbba9de9053@linux.vnet.ibm.com> Date: Thu, 04 May 2023 15:10:14 +1000 Message-ID: <87354c8yx5.fsf@mail.lhotse> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brian King , linuxppc-dev@lists.ozlabs.org, Greg Joyce Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Gaurav Batra writes: > Hello Michael, > > I was looking into the Bug: 199106 > (https://bugzilla.linux.ibm.com/show_bug.cgi?id=199106). > > In the Bug, Mellanox driver was timing out when enabling SRIOV device. > > I tested, Alexey's patch and it fixes the issue with Mellanox driver. > The down side > > to Alexey's fix is that even a small memory request by the driver will > be aligned up > > to 2MB. In my test, the Mellanox driver is issuing multiple requests of > 64K size. > > All these will get aligned up to 2MB, which is quite a waste of resources. OK. I guess we should use your patch then. It's not ideal as it means the device can potentially read/write to memory it shouldn't, but 2MB is a lot to waste for a 64K alloc. > In any case, both the patches work. Let me know which approach you > prefer. In case > > we decide to go with my patch, I just realized that I need to fix > nio_pages in > > iommu_free_coherent() as well. Can you send a v3 with that fixed please. cheers