From mboxrd@z Thu Jan 1 00:00:00 1970 From: Will Deacon Subject: Re: [PATCH] iommu/arm-smmu-v3: avoid over allocating for l2 stream tables Date: Tue, 20 Dec 2016 10:22:09 +0000 Message-ID: <20161220102209.GC10132@arm.com> References: <1482179200-4264-1-git-send-email-nwatters@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1482179200-4264-1-git-send-email-nwatters-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Nate Watterson Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: iommu@lists.linux-foundation.org Hi Nate, On Mon, Dec 19, 2016 at 03:26:40PM -0500, Nate Watterson wrote: > Currently, all l2 stream tables are being allocated with space for > (1< physically supports. To avoid allocating memory for inaccessible > stes, this patch limits the span of an l2 table to be no larger > than the sid size of the smmu to which it belongs. > > Signed-off-by: Nate Watterson > --- > drivers/iommu/arm-smmu-v3.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) I can't help but think you'd be better off using a linear stream table in this scenario. If we hack the feature check for ARM_SMMU_FEAT_2_LVL_STRTAB so that it doesn't report support for 2 level tables if the number of sids is less than that covered by a single l2 entry, would that solve your problem? Will From mboxrd@z Thu Jan 1 00:00:00 1970 From: will.deacon@arm.com (Will Deacon) Date: Tue, 20 Dec 2016 10:22:09 +0000 Subject: [PATCH] iommu/arm-smmu-v3: avoid over allocating for l2 stream tables In-Reply-To: <1482179200-4264-1-git-send-email-nwatters@codeaurora.org> References: <1482179200-4264-1-git-send-email-nwatters@codeaurora.org> Message-ID: <20161220102209.GC10132@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Nate, On Mon, Dec 19, 2016 at 03:26:40PM -0500, Nate Watterson wrote: > Currently, all l2 stream tables are being allocated with space for > (1< physically supports. To avoid allocating memory for inaccessible > stes, this patch limits the span of an l2 table to be no larger > than the sid size of the smmu to which it belongs. > > Signed-off-by: Nate Watterson > --- > drivers/iommu/arm-smmu-v3.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) I can't help but think you'd be better off using a linear stream table in this scenario. If we hack the feature check for ARM_SMMU_FEAT_2_LVL_STRTAB so that it doesn't report support for 2 level tables if the number of sids is less than that covered by a single l2 entry, would that solve your problem? Will From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934704AbcLTKWF (ORCPT ); Tue, 20 Dec 2016 05:22:05 -0500 Received: from foss.arm.com ([217.140.101.70]:38774 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933423AbcLTKWF (ORCPT ); Tue, 20 Dec 2016 05:22:05 -0500 Date: Tue, 20 Dec 2016 10:22:09 +0000 From: Will Deacon To: Nate Watterson Cc: Robin Murphy , Joerg Roedel , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iommu/arm-smmu-v3: avoid over allocating for l2 stream tables Message-ID: <20161220102209.GC10132@arm.com> References: <1482179200-4264-1-git-send-email-nwatters@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1482179200-4264-1-git-send-email-nwatters@codeaurora.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nate, On Mon, Dec 19, 2016 at 03:26:40PM -0500, Nate Watterson wrote: > Currently, all l2 stream tables are being allocated with space for > (1< physically supports. To avoid allocating memory for inaccessible > stes, this patch limits the span of an l2 table to be no larger > than the sid size of the smmu to which it belongs. > > Signed-off-by: Nate Watterson > --- > drivers/iommu/arm-smmu-v3.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) I can't help but think you'd be better off using a linear stream table in this scenario. If we hack the feature check for ARM_SMMU_FEAT_2_LVL_STRTAB so that it doesn't report support for 2 level tables if the number of sids is less than that covered by a single l2 entry, would that solve your problem? Will