Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp368633pxb; Fri, 15 Jan 2021 15:40:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCEobNsv+NOJ15dbHfgRpDMoMtueL/IadTeiV6DyFOTydh8uxS7At7VKxAL7doTBmSbksc X-Received: by 2002:a05:6402:5112:: with SMTP id m18mr11842560edd.129.1610754026635; Fri, 15 Jan 2021 15:40:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610754026; cv=none; d=google.com; s=arc-20160816; b=w3lidNLzVHJXNEAMx1TKUCVMihWvqlSBrBaV9LP90OS1mpiqkfL4Ud1Oi5tfat4/d9 tbxGrR24HcGnWNJPAMer33WUWSx8T1Vx6KczSZFE5xEDrBakj/yB4D+Jgcp9KFtLRYgp 8fpHesjTzFE+3AEzUz+PWfk3FMU7iuRycX3apWt/7jCCoDtMjaS+UudATVQhPms9agqQ iu3RQ/aC19XKCbH+C+Gg/HNvSBPZAslVPMaMFr9G9OOa9GZ4AXVRdTPOYemx0shkJrTh 0Ymnrh9/8u+Ysjnxi/7SIJerFcf/8ObmCUON6Hs8cQDvVTB1+HCRYgRmRcj8O+0VRoSt jbEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=f4lruco0oPKqZQoWQHySstTWv9/IZ9UW7zETLf13+EE=; b=Gh3TgFej2OyMpD97yqoA8PZadiFvE04NuS55GzfDyV0SNs01O2jmc1L38Z12KXM/ht QltDnxf4P+Phws7GAaYgElKL0x5hSoFnWNmxVLOaOiMBRp0MZHtdGhf5M7Q15/gsujmt WmifQZoZogC11Us7ToOd3/0+UfVOjqg4aaj3LSHtyG26zNwIbKhmV6GUhdLeU5QdpqQp 9eHm1Lz8ldgmniaEw5s6XMFrGw8Sx5CeseObS6khqXPppdLW0dRsYasIcbb/Q+pRZ9r9 eIYpI9PGv4ViJGaqQ3+6PthfbDIRVPXdwEaPaQPMwywTMLSPDsKK8B5EPfGFxSlk+tqJ SRug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gGtnqmHv; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n2si4325966eji.120.2021.01.15.15.39.58; Fri, 15 Jan 2021 15:40:26 -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=@redhat.com header.s=mimecast20190719 header.b=gGtnqmHv; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726650AbhAOXjO (ORCPT + 99 others); Fri, 15 Jan 2021 18:39:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40083 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726176AbhAOXjO (ORCPT ); Fri, 15 Jan 2021 18:39:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610753867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f4lruco0oPKqZQoWQHySstTWv9/IZ9UW7zETLf13+EE=; b=gGtnqmHvssvL6P4h9Ai5F4hbQAkcKnDKSGDcqjOVeqgWZucJsVCKtf+ACXSkzPVIPCkA1V El+TjFg9MMAuc1rNwHayVkbUYDMJHbqSgl/sAa5EzA8em+NFqyd68fJ4O2OlCsDVg6QEpo 57RNDoi+Ev78gcayGuGf+7qE6tcFPrI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-497-Pzajvn_WMai53lejIzHg9Q-1; Fri, 15 Jan 2021 18:37:43 -0500 X-MC-Unique: Pzajvn_WMai53lejIzHg9Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87CDCC2A7; Fri, 15 Jan 2021 23:37:40 +0000 (UTC) Received: from omen.home.shazbot.org (ovpn-112-255.phx2.redhat.com [10.3.112.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB31E61F49; Fri, 15 Jan 2021 23:37:38 +0000 (UTC) Date: Fri, 15 Jan 2021 16:37:38 -0700 From: Alex Williamson To: Keqian Zhu Cc: , , , , , Cornelia Huck , Will Deacon , "Marc Zyngier" , Catalin Marinas , Mark Rutland , James Morse , Robin Murphy , Joerg Roedel , "Daniel Lezcano" , Thomas Gleixner , Suzuki K Poulose , Julien Thierry , Andrew Morton , Alexios Zavras , , Subject: Re: [PATCH 4/6] vfio/iommu_type1: Drop parameter "pgsize" of vfio_dma_bitmap_alloc_all Message-ID: <20210115163738.112f0c34@omen.home.shazbot.org> In-Reply-To: <20210107044401.19828-5-zhukeqian1@huawei.com> References: <20210107044401.19828-1-zhukeqian1@huawei.com> <20210107044401.19828-5-zhukeqian1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 7 Jan 2021 12:43:59 +0800 Keqian Zhu wrote: > We always use the smallest supported page size of vfio_iommu as > pgsize. Remove parameter "pgsize" of vfio_dma_bitmap_alloc_all. > > Signed-off-by: Keqian Zhu > --- > drivers/vfio/vfio_iommu_type1.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c > index b596c482487b..080c05b129ee 100644 > --- a/drivers/vfio/vfio_iommu_type1.c > +++ b/drivers/vfio/vfio_iommu_type1.c > @@ -236,9 +236,10 @@ static void vfio_dma_populate_bitmap(struct vfio_dma *dma, size_t pgsize) > } > } > > -static int vfio_dma_bitmap_alloc_all(struct vfio_iommu *iommu, size_t pgsize) > +static int vfio_dma_bitmap_alloc_all(struct vfio_iommu *iommu) > { > struct rb_node *n; > + size_t pgsize = (size_t)1 << __ffs(iommu->pgsize_bitmap); > > for (n = rb_first(&iommu->dma_list); n; n = rb_next(n)) { > struct vfio_dma *dma = rb_entry(n, struct vfio_dma, node); > @@ -2761,12 +2762,9 @@ static int vfio_iommu_type1_dirty_pages(struct vfio_iommu *iommu, > return -EINVAL; > > if (dirty.flags & VFIO_IOMMU_DIRTY_PAGES_FLAG_START) { > - size_t pgsize; > - > mutex_lock(&iommu->lock); > - pgsize = 1 << __ffs(iommu->pgsize_bitmap); > if (!iommu->dirty_page_tracking) { > - ret = vfio_dma_bitmap_alloc_all(iommu, pgsize); > + ret = vfio_dma_bitmap_alloc_all(iommu); > if (!ret) > iommu->dirty_page_tracking = true; > } This just moves the same calculation from one place to another, what's the point? Thanks, Alex