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 E39CEA034F for ; Wed, 10 Nov 2021 07:55:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D1A1F40142; Wed, 10 Nov 2021 07:55:57 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2069.outbound.protection.outlook.com [40.107.223.69]) by mails.dpdk.org (Postfix) with ESMTP id 619C640142 for ; Wed, 10 Nov 2021 07:55:56 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WRDbjRwYhJhwrDjEIl/YENwDygsYgG/ooug3xYInIkG8BRa4J95EseGXTofdyvkl9DCZuiQYjEKrILDo7xHSqFsxDNfUYqrBEVFdKDdmBteQ/SRMFujybia869e+s6B23sA8wBFUW0KyYJ1aMK5b5hTcaqTBG12r2dVUZ9k57TrDMGK1jzSxbrEAaxUhx6W3cLdLQsxyfMuCHSe7Dz4BG0jGnuW8VHHa3gGtB1TjMXJtdBsKqjCgTwuN6Wf3OPqqU9DsRmS8wC0Vwy6hGekd63MVuPNse40vRev3slezhS5H6nblO0Hcv30Ei+6ma8pZP3gm0scR0rkYwsfx9JKxZQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=enutSJrBZtdalv4G8o+Yz7j1o8Z1FxAwq1uVdJlWbH4=; b=LqtrWZm3WfJSu+0BgT7eEACDqTC3Js9XzSN6h+oOh5ShlZU1L6k8RNOr55k4S0AWzBG7H0+VNbs9hP+bQlShNnt/dO54INsfdABD+eBBhVI5WXcFk2/hzAZBwGO8BgEB/q+fh02tb3eJjU0+BpFH3GrXXaoWFnFrseHZ51Vvhzy2geNbA7tKanIl0aNwEiB11zYgkHo0fO0JIkCX2aLRoZ3sSG+C/FqF26AV3C1sWCsAVeWcaHUyXnCcRd6DkcBLq0/G4/k275GVWB5y0jjC7c8BndwQiFSQv6PqxAWocKr1GPXVMQ/RMH9KbXxhop63emtmhONXeKlJXHD5Gc+E+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=enutSJrBZtdalv4G8o+Yz7j1o8Z1FxAwq1uVdJlWbH4=; b=lTwHAGK9GjIra9CNh2f7tAoKQ62RejWs4efQ+nRDXhV3r9He8G1ruHJimCkq+pwjG15xeI3uXrzx47HP9SvSGNlNxsJaKXZ1VrxdRt64O+NNd0et0pE5/V1aph/ouPu88I7B55BfxZ6yM08mzjo3PxbabwPqo+RoE4f54TeVNiHz65UuvZP0D/lwtSJt7P0rm9S5To075Ab9P1SWXBHpWRznPnNN9vDtGgP8v7WqcCrFV6ETruboTKQ87D4gZNspR9QHf9ryy48RNyTgLcAisFtNnWBn6mE9tp0sXosGN5fV73nOUC8YHH+WWMe+izFplFbur5yo/hDfp9Ye0DRmow== Received: from DS7PR03CA0256.namprd03.prod.outlook.com (2603:10b6:5:3b3::21) by DM6PR12MB4842.namprd12.prod.outlook.com (2603:10b6:5:1fe::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13; Wed, 10 Nov 2021 06:55:54 +0000 Received: from DM6NAM11FT063.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b3:cafe::13) by DS7PR03CA0256.outlook.office365.com (2603:10b6:5:3b3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.16 via Frontend Transport; Wed, 10 Nov 2021 06:55:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.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 DM6NAM11FT063.mail.protection.outlook.com (10.13.172.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Wed, 10 Nov 2021 06:55:54 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov 2021 06:55:51 +0000 From: Xueming Li To: Olivier Matz CC: Luca Boccassi , Maxime Coquelin , David Marchand , dpdk stable Date: Wed, 10 Nov 2021 14:31:34 +0800 Message-ID: <20211110063216.2744012-211-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110063216.2744012-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ea5546f3-cfd0-453b-08d3-08d9a41723dc X-MS-TrafficTypeDiagnostic: DM6PR12MB4842: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bUknAMwT1GIgz8igUZNAhBS+L6KDUMx1HOLTCoJcS7OfaoQazRw+cK5hz4HH5mGRE0kvOhcNsHp0yVhVAOO4etbl15UJs6Hbr2mZowQXp7ZKvux6Cx5c+habzo4afUkNdVcBm3kT1WpmttKDxeZMSu219IChvkI5ZQcszE92kbYtbhQgFzjYE+lAZZsNFiPbAhoxB6sU/g8PYD0j0h6AjxyIRYWDUnqw5CycC0St8KYaUTLXLalekTkhgYPUQIZD8SZYmjWzQRdufgRlUIRiZ5/Mil351R+hf29zkvhR+CjGMHvhFnMObVTzJwfQHun0/O6jptpQeWJgZqiPvz3R8Oza47dZuup86ZTWq2jagkt4g+Gddag0/xOoszfRU2K5XaohUlGSrAuVPW0XzzD7rm26/2rpxQ6+lTE1uZ4YDgU1I7YxSIa6D9GTsoOLvaUpmme2p5EzhNIMxOLXz4iHn6EGBgand4vuUOfL203acaaAMi44pE8VNJ+qSQlLLJzIDErr27wDvkS3JLciILL+9wpqQcYbcIvywMfi5HkyXKC3FmvEvhfrGzMqXe9fW2HOLtWCwkiAARNBu5OKExnJcuZwKkXsRKVkCXkuSRj3kBmgYiaygTAIVEZKTI+XfO6Rag3l9MIZI5Q9sFzCm3DiCI1Tf9W/WgQrbWMn50RbUy7DM4wJOyL0x5tFwcSO9mbVagbop5pP7ZHMcLO+nP4K527igFvzAnZbiEsYN+Nyookc2DApdLJLPF74+6nJQDDMsePXru0VQrbBm7JtM5AkWIBUelZXJBI6JR8ibqv1cTmTdMuXGj8Vk29WPf4wz+bIYRk1oLGYayBAz+ETjD026Q== 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)(36840700001)(46966006)(966005)(2616005)(54906003)(8936002)(86362001)(7696005)(26005)(186003)(316002)(36860700001)(36756003)(53546011)(508600001)(336012)(4326008)(83380400001)(70206006)(4001150100001)(426003)(6666004)(70586007)(1076003)(6916009)(16526019)(47076005)(55016002)(356005)(2906002)(7636003)(8676002)(6286002)(5660300002)(82310400003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:55:54.1402 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea5546f3-cfd0-453b-08d3-08d9a41723dc 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: DM6NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4842 Subject: [dpdk-stable] patch 'mem: fix dynamic hugepage mapping in container' has been queued to stable release 20.11.4 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.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/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/94d2d9eefada4056cc3f3ccf51f7391f4e8f014b Thanks. Xueming Li --- >From 94d2d9eefada4056cc3f3ccf51f7391f4e8f014b Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Fri, 29 Oct 2021 11:53:10 +0200 Subject: [PATCH] mem: fix dynamic hugepage mapping in container Cc: Xueming Li [ upstream commit 9bffc92850e8524474eebe2d559d09bdf3f0b96b ] Since its introduction in 2018, the SIGBUS handler was never registered, and all related functions were unused. A SIGBUS can be received by the application when accessing to hugepages even if mmap() was successful, This happens especially when running inside containers when there is not enough hugepages. In this case, we need to recover. A similar scheme can be found in eal_memory.c. Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime") Signed-off-by: Olivier Matz Reviewed-by: Maxime Coquelin Acked-by: David Marchand --- lib/librte_eal/linux/eal_memalloc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/linux/eal_memalloc.c b/lib/librte_eal/linux/eal_memalloc.c index c590d60430..fa73468285 100644 --- a/lib/librte_eal/linux/eal_memalloc.c +++ b/lib/librte_eal/linux/eal_memalloc.c @@ -107,7 +107,7 @@ static struct rte_memseg_list local_memsegs[RTE_MAX_MEMSEG_LISTS]; static sigjmp_buf huge_jmpenv; -static void __rte_unused huge_sigbus_handler(int signo __rte_unused) +static void huge_sigbus_handler(int signo __rte_unused) { siglongjmp(huge_jmpenv, 1); } @@ -116,7 +116,7 @@ static void __rte_unused huge_sigbus_handler(int signo __rte_unused) * non-static local variable in the stack frame calling sigsetjmp might be * clobbered by a call to longjmp. */ -static int __rte_unused huge_wrap_sigsetjmp(void) +static int huge_wrap_sigsetjmp(void) { return sigsetjmp(huge_jmpenv, 1); } @@ -124,7 +124,7 @@ static int __rte_unused huge_wrap_sigsetjmp(void) static struct sigaction huge_action_old; static int huge_need_recover; -static void __rte_unused +static void huge_register_sigbus(void) { sigset_t mask; @@ -139,7 +139,7 @@ huge_register_sigbus(void) huge_need_recover = !sigaction(SIGBUS, &action, &huge_action_old); } -static void __rte_unused +static void huge_recover_sigbus(void) { if (huge_need_recover) { @@ -576,6 +576,8 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, mmap_flags = MAP_SHARED | MAP_POPULATE | MAP_FIXED; } + huge_register_sigbus(); + /* * map the segment, and populate page tables, the kernel fills * this segment with zeros if it's a new page. @@ -651,6 +653,8 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, __func__); #endif + huge_recover_sigbus(); + ms->addr = addr; ms->hugepage_sz = alloc_sz; ms->len = alloc_sz; @@ -664,6 +668,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, mapped: munmap(addr, alloc_sz); unmapped: + huge_recover_sigbus(); flags = EAL_RESERVE_FORCE_ADDRESS; new_addr = eal_get_virtual_area(addr, &alloc_sz, alloc_sz, 0, flags); if (new_addr != addr) { -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:11.186584202 +0800 +++ 0210-mem-fix-dynamic-hugepage-mapping-in-container.patch 2021-11-10 14:17:02.020744864 +0800 @@ -1 +1 @@ -From 9bffc92850e8524474eebe2d559d09bdf3f0b96b Mon Sep 17 00:00:00 2001 +From 94d2d9eefada4056cc3f3ccf51f7391f4e8f014b Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 9bffc92850e8524474eebe2d559d09bdf3f0b96b ] @@ -15 +17,0 @@ -Cc: stable@dpdk.org @@ -21 +23 @@ - lib/eal/linux/eal_memalloc.c | 13 +++++++++---- + lib/librte_eal/linux/eal_memalloc.c | 13 +++++++++---- @@ -24,4 +26,4 @@ -diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c -index 0ec8542283..337f2bc739 100644 ---- a/lib/eal/linux/eal_memalloc.c -+++ b/lib/eal/linux/eal_memalloc.c +diff --git a/lib/librte_eal/linux/eal_memalloc.c b/lib/librte_eal/linux/eal_memalloc.c +index c590d60430..fa73468285 100644 +--- a/lib/librte_eal/linux/eal_memalloc.c ++++ b/lib/librte_eal/linux/eal_memalloc.c