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 5F665A0A0E for ; Mon, 10 May 2021 18:23:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 59BD24003E; Mon, 10 May 2021 18:23:04 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2060.outbound.protection.outlook.com [40.107.94.60]) by mails.dpdk.org (Postfix) with ESMTP id 0187D40F35 for ; Mon, 10 May 2021 18:23:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HbcPUUMuSvigRN36lyckyZu2HvDCWSXHg8JmrtjAjsupSwKwQHw4eeAfvtK4MGk+g9PdlHWlw7CpMtok/hKfD05vLMWiAb30yFrESvQqlPGqExjHzesRiOg88XN+4jvFWq9VLECEjIu2bQ2D9eeN0KZiyWty//DYL+ubkU6hDAV6Cvz6O4Sfm8qsw+gYIUoFjphUysUYiTek1Z2UuMbZEqoqdJ+tQ2HJmRPXW3DF2n/A0VkwXaYMqgUqz//1R92O0GA2KibIyNsntyLiLkxR9FeYi72typRmhm8x89+Fxmrx2i43A3xdB+UCnk6/JSQNUi0G/8f4917Lj6pJKhBAuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hWUhvD4HQlxJkYDZRfe3QOKxu/046b7IkjYtczXFwog=; b=CTu/0Pr1mqXpsjMgVSRp46HgUv88l3TTvckmkdn9d7AztoGNkMc23QLelkLTm3ER9Ufj1TCKjVmaW/ktNGLBMfjPZQkPBAPTY2Dij8dvLwobCAam46HeOcFhcDHO0f3Zup7sfEC78tkWFdVL7iHCCSeuTIswIVDTQLUmMAYWeMzEVLnnLfOnm9XuEUQXd8wH/jQUbzqG2+bccMryBtCLRTK6I5ItGt6lkLJLHmHG+inG4HO75iaT69z8YE5r6ddZ42xJQ7nIUExmiCwLYDyuKlQPKjHuLu+Dstb6CO36B1cZ1Tg+I0XOZvkXLfU7sL9AbWsdxLYN3MivRqZqNNOIQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hWUhvD4HQlxJkYDZRfe3QOKxu/046b7IkjYtczXFwog=; b=d5uubhn9tzQizljjQosHWgsVtbyRHYhM6n/qMXBF1ui6e1u+8IvZ5I2YarMb029RQlOqOUUM2SQSNZkuex0PbjV5On8tjHtYlXOkTRMEmGUYhbKms2nmN5M8iq19SVYbf3lHuWXjtCZK0bULDrelyrtHvAuWRW8Y07GH1/xK6wIp9qE+5V92sBjGQ4g01JoeZr8dZqN6KI6BF0peX59NNBLO4vD8nyBXW4S5ZIuvsVq87y/82XnbM8cvjeRBZelk6BQwWCL3dpFFS3aOdhvSjYOzwY0qaCL41oF+0OpW4FTQXqCRH+EltE22FtH1+p2/ssViaWfy6RNIlQE1gIDyDA== Received: from BN7PR02CA0008.namprd02.prod.outlook.com (2603:10b6:408:20::21) by DM5PR12MB1484.namprd12.prod.outlook.com (2603:10b6:4:11::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.28; Mon, 10 May 2021 16:23:01 +0000 Received: from BN8NAM11FT013.eop-nam11.prod.protection.outlook.com (2603:10b6:408:20:cafe::2b) by BN7PR02CA0008.outlook.office365.com (2603:10b6:408:20::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24 via Frontend Transport; Mon, 10 May 2021 16:23:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT013.mail.protection.outlook.com (10.13.176.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:23:00 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 16:22:58 +0000 From: Xueming Li To: Yunjian Wang CC: Luca Boccassi , Kevin Traynor , Anatoly Burakov , dpdk stable Date: Tue, 11 May 2021 00:02:29 +0800 Message-ID: <20210510160258.30982-200-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210510160258.30982-1-xuemingl@nvidia.com> References: <20210510160258.30982-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c716f25c-8a1f-478c-f152-08d913cfe14f X-MS-TrafficTypeDiagnostic: DM5PR12MB1484: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RaZ1XalFycENhQ1Twz77Z+2bOSX0geIogA8RWxFJb5EmV4EQ4a6k144Ab6FpaylDvb7dJLbO2ATtshAsH3w/U5zvpqXTShA4AybydvbL8uc+1mXtHh2i6OUoFTUc/BH6FlsujUtAdkaB7pi8M7iWqf31uGwXz1egXfsQojBBHjWnf892+D7SviRRcvaK25b1qJUOl2ShSq6wwUzt0wK4gXD6o7TjuYAh1fZF8tK4woDpgKR6GLCdYYDQA07fWfe5IZcf4vEpWHEGJGdUskpHshosAr7zJlzvAy52FttecsJgkea56dFlvBdXa9sHJbTvxMJzu7y6NobMbTRWuwuIivCf9dXZ4B5JCX5uFUGayQXUXOxJGaGfVK0Q8KtDGXXCDZSynBxAZ5DVeXIQz82NDVlva49aXaTk+uugWIV8dZQmw9atsxwSn6YoKR2nQ7k6o1+1YlIGpnJHBxJS/7vNhyXGDOBcXOTm/cryOuqUH8ZjsW60A8F9t5Ph0nEL9s4WiE3L6lw0QnGnbMurSoKxLthBbH6xsW57thh9oFnx3zCMwSHJK84JjdI2ao/ZFZ2KPlBBMhweoyBUhuOwpn1je7dNSYnFs3MRiztsjO+7AE4I2Q1io5j+koEKhSgPMS7dBKG4PRBNSkZUnZuIlzElHI0VhX2qBWwBUc4txqrZIrWNqSF5b6O6IxfLRPbsmb/7u9lHOY7R3PNFypfK+hmt4cXybmo6+K7jGcCLoxXluwQnTFzvt1zsDxDhjA/M2ec37wLP7c4OUvI0Q8qL5zfVEA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(346002)(136003)(396003)(376002)(46966006)(36840700001)(2616005)(47076005)(26005)(6916009)(82310400003)(356005)(4326008)(426003)(7636003)(5660300002)(316002)(53546011)(86362001)(6286002)(2906002)(82740400003)(55016002)(36906005)(7696005)(16526019)(54906003)(6666004)(336012)(966005)(186003)(70586007)(36756003)(8936002)(36860700001)(70206006)(8676002)(1076003)(83380400001)(478600001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2021 16:23:00.7147 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c716f25c-8a1f-478c-f152-08d913cfe14f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT013.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1484 Subject: [dpdk-stable] patch 'vfio: fix duplicated user mem map' has been queued to stable release 20.11.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/12/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/6b76e06108341de9413374698ae4505a984fb470 Thanks. Xueming Li --- >From 6b76e06108341de9413374698ae4505a984fb470 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Sat, 10 Apr 2021 17:37:57 +0800 Subject: [PATCH] vfio: fix duplicated user mem map Cc: Luca Boccassi [ upstream commit 22677b0eef49ec30ef0facadee44b0084fc091ac ] Currently, new user mem maps are checked if they are adjacent to an existing mem map and if so, the mem map entries are merged. It didn't check for duplicate mem maps, so if the API is called with the same mem map multiple times, they will occupy multiple mem map entries. This will reduce the amount of entries available for unique mem maps. So check for duplicate mem maps and merge them into one mem map entry if any found. Fixes: 0cbce3a167f1 ("vfio: skip DMA map failure if already mapped") Suggested-by: Kevin Traynor Signed-off-by: Yunjian Wang Acked-by: Anatoly Burakov --- lib/librte_eal/linux/eal_vfio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/librte_eal/linux/eal_vfio.c b/lib/librte_eal/linux/eal_vfio.c index b15b75882b..c80777bc21 100644 --- a/lib/librte_eal/linux/eal_vfio.c +++ b/lib/librte_eal/linux/eal_vfio.c @@ -171,6 +171,10 @@ adjust_map(struct user_mem_map *src, struct user_mem_map *end, static int merge_map(struct user_mem_map *left, struct user_mem_map *right) { + /* merge the same maps into one */ + if (memcmp(left, right, sizeof(struct user_mem_map)) == 0) + goto out; + if (left->addr + left->len != right->addr) return 0; if (left->iova + left->len != right->iova) @@ -178,6 +182,7 @@ merge_map(struct user_mem_map *left, struct user_mem_map *right) left->len += right->len; +out: memset(right, 0, sizeof(*right)); return 1; -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-10 23:59:31.756170100 +0800 +++ 0201-vfio-fix-duplicated-user-mem-map.patch 2021-05-10 23:59:26.660000000 +0800 @@ -1 +1 @@ -From 22677b0eef49ec30ef0facadee44b0084fc091ac Mon Sep 17 00:00:00 2001 +From 6b76e06108341de9413374698ae4505a984fb470 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit 22677b0eef49ec30ef0facadee44b0084fc091ac ] @@ -18 +20,0 @@ -Cc: stable@dpdk.org @@ -28 +30 @@ -index fe25719991..25add2fa5d 100644 +index b15b75882b..c80777bc21 100644