From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EFA04A0547; Thu, 21 Oct 2021 11:51:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7023141204; Thu, 21 Oct 2021 11:50:47 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 41815411F0 for ; Thu, 21 Oct 2021 11:50:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634809843; 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=TRqYx+EJ4pqKJKzXPxLnMllcX+/kZS9h4UFRp3zMin4=; b=MKJOQsXltLBT3SMqifHuj3xH3es11sozWHu2x041qH+Y8sHpKzhgvS0ATuQGGIBqFcwJYZ M9tUMTBx3wA6jFrvhiXXA5tkWq39dKH+2xfv8rAHEjWSPLN9ATE4xULaLAfYRDH4TrgLO4 RdNoiFL3nY/B2ogsns+TPa84rDGmuL0= 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-145-09yp30GMN6y-F9nmUyIjjg-1; Thu, 21 Oct 2021 05:50:40 -0400 X-MC-Unique: 09yp30GMN6y-F9nmUyIjjg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA1A3100CCC0; Thu, 21 Oct 2021 09:50:38 +0000 (UTC) Received: from [10.39.208.27] (unknown [10.39.208.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 789AA5BAE3; Thu, 21 Oct 2021 09:50:36 +0000 (UTC) Message-ID: <27df0085-0252-06a9-f57a-a36a08ce7c5d@redhat.com> Date: Thu, 21 Oct 2021 11:50:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 To: Xuan Ding , dev@dpdk.org, anatoly.burakov@intel.com, chenbo.xia@intel.com Cc: jiayu.hu@intel.com, cheng1.jiang@intel.com, bruce.richardson@intel.com, sunil.pai.g@intel.com, yinan.wang@intel.com, yvonnex.yang@intel.com References: <20210901053044.109901-1-xuan.ding@intel.com> <20211011075942.38180-1-xuan.ding@intel.com> <20211011075942.38180-2-xuan.ding@intel.com> From: Maxime Coquelin In-Reply-To: <20211011075942.38180-2-xuan.ding@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v7 1/2] vfio: allow partially unmapping adjacent memory X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 10/11/21 09:59, Xuan Ding wrote: > Currently, if we map a memory area A, then map a separate memory area B > that by coincidence happens to be adjacent to A, current implementation > will merge these two segments into one, and if partial unmapping is not > supported, these segments will then be only allowed to be unmapped in > one go. In other words, given segments A and B that are adjacent, it > is currently not possible to map A, then map B, then unmap A. > > Fix this by adding a notion of "chunk size", which will allow > subdividing segments into equally sized segments whenever we are dealing > with an IOMMU that does not support partial unmapping. With this change, > we will still be able to merge adjacent segments, but only if they are > of the same size. If we keep with our above example, adjacent segments A > and B will be stored as separate segments if they are of different > sizes. > > Signed-off-by: Anatoly Burakov > Signed-off-by: Xuan Ding > --- > lib/eal/linux/eal_vfio.c | 338 ++++++++++++++++++++++++++------------- > 1 file changed, 228 insertions(+), 110 deletions(-) > Reviewed-by: Maxime Coquelin Thanks, Maxime