From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 6570BA034E;
	Thu,  7 Nov 2019 16:35:55 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 415751BF9D;
	Thu,  7 Nov 2019 16:35:55 +0100 (CET)
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com
 [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 598811BF9C
 for <dev@dpdk.org>; Thu,  7 Nov 2019 16:35:54 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1573140953;
 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=DL3CBP6tOf4i8zffDvfLPV8Azdj4SuBX4p4ILpgLLSw=;
 b=V8ID7LcYuufhjyrQzmkV8hu5PFxFdDUZ1Qw/i30dQBw8fI55EMO6uJUAnNNONISyKrpRGm
 VLT4GWUF4S4ocTeNlpzYCA684B85wi2wdPjvQm3P6TKBFCvXeNXr+QLQRNJLph31pp0C/0
 3cbWL6Wz32QPkB9zDS8HtR5DF3ss5BM=
Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com
 [209.85.217.70]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-403-G4CMit8DP46UNHpMrCaVAQ-1; Thu, 07 Nov 2019 10:35:50 -0500
Received: by mail-vs1-f70.google.com with SMTP id e127so648973vsc.16
 for <dev@dpdk.org>; Thu, 07 Nov 2019 07:35:50 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=B4oEEDb3lqCCKVx390D6loK6YCs2FvL69XcZiUnStOE=;
 b=ppcQKZBgx8xJucE7+Qs3w2S5dpo6ScK1tnnx1e0/9mn4DNnMbXV5zzymZlHHFOhnIX
 ePg6iIeqr8qejavKfD5KCcKcVoiiVw7ovjbVql1angOnaKBaG9eaLvPUu+Un73wxHj0U
 0aC5OoG/i3GJJtvyCjMVgA09owKO975nOKiK7klFpD84lQsJGVOayar9F28SpQOGAuLy
 w6PaG4IqTuwslioHQrxbtg6+81B+YoVHhVEgw1cYSIucKNuySUhjFJYLzEfTIyhRzQe+
 Brf2pwj7Igj8hpnEPd2BhnBlpYa3Wu+Ne3kIbPv6BfrnGj57CxKUKRBMd7UzXi/n6siy
 BEYg==
X-Gm-Message-State: APjAAAWkRUD5iOTa8vLkRSZr2yAHE6tv19M7jeLsie69ujgNqvXs0gZN
 L5DoEhmG4XJ7qvhR015WOcW/Sp96MXhLmc+OYyDZ9UFwCsFCd3eq0tObNCikUa/dkzxqImlqi77
 7sCW7dbjehJ75LSrnvao=
X-Received: by 2002:a67:fa99:: with SMTP id f25mr3340765vsq.141.1573140950060; 
 Thu, 07 Nov 2019 07:35:50 -0800 (PST)
X-Google-Smtp-Source: APXvYqzNT3yEvS0yU7SlT1EYj3yxQYVEVE8qN5RR+06XSdMqyHdM6wOfh1phIyV98h7JVy62fTC1CJCdRpI4/4xIXNk=
X-Received: by 2002:a67:fa99:: with SMTP id f25mr3340723vsq.141.1573140949713; 
 Thu, 07 Nov 2019 07:35:49 -0800 (PST)
MIME-Version: 1.0
References: <5dd669557fc499df5e345a14c9252c095eff6c07.1572966906.git.anatoly.burakov@intel.com>
In-Reply-To: <5dd669557fc499df5e345a14c9252c095eff6c07.1572966906.git.anatoly.burakov@intel.com>
From: David Marchand <david.marchand@redhat.com>
Date: Thu, 7 Nov 2019 16:35:38 +0100
Message-ID: <CAJFAV8w7EPpQJVJp2qVo=5NoY+v-1zjJ7YXQjMr0wk8mbywaCQ@mail.gmail.com>
To: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: dev <dev@dpdk.org>, Bruce Richardson <bruce.richardson@intel.com>, 
 Rajesh Ravi <rajesh.ravi@broadcom.com>,
 Ajit Khaparde <ajit.khaparde@broadcom.com>, 
 Jonathan Richardson <jonathan.richardson@broadcom.com>, 
 Scott Branden <scott.branden@broadcom.com>, 
 Vikram Mysore Prakash <vikram.prakash@broadcom.com>,
 Srinath Mannam <srinath.mannam@broadcom.com>, 
 Thomas Monjalon <thomas@monjalon.net>, dpdk stable <stable@dpdk.org>
X-MC-Unique: G4CMit8DP46UNHpMrCaVAQ-1
X-Mimecast-Spam-Score: 0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Subject: Re: [dpdk-dev] [PATCH 19.11] vfio: fix DMA mapping of externally
	allocated heaps
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Tue, Nov 5, 2019 at 4:15 PM Anatoly Burakov
<anatoly.burakov@intel.com> wrote:
>
> Currently, externally created heaps are supposed to be automatically
> mapped for VFIO DMA by EAL, however they only do so if, at the time of
> heap creation, VFIO is initialized and has at least one device
> available. If no devices are available at the time of heap creation (or
> if devices were available, but were since hot-unplugged, thus dropping
> all VFIO container mappings), then VFIO mapping code would have skipped
> over externally allocated heaps.
>
> The fix is two-fold. First, we allow externally allocated memory
> segments to be marked as "heap" segments. This allows us to distinguish
> between external memory segments that were created via heap API, from
> those that were created via rte_extmem_register() API.
>
> Then, we fix the VFIO code to only skip non-heap external segments.
> Also, since external heaps are not guaranteed to have valid IOVA
> addresses, we will skip those which have invalid IOVA addresses as well.
>
> Fixes: 0f526d674f8e ("malloc: separate creating memseg list and malloc he=
ap")
Cc: stable@dpdk.org

>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Rajesh Ravi <rajesh.ravi@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>

> ---
>
> Notes:
>     This cannot be backported to older releases as it breaks the
>     API and ABI. A separate fix is in the works for stable.
>

Applied, thanks.


--
David Marchand