From patchwork Wed Feb 3 09:01:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Matz X-Patchwork-Id: 87672 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4CAE8A0A0E; Wed, 3 Feb 2021 10:01:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C4E0724048A; Wed, 3 Feb 2021 10:01:52 +0100 (CET) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mails.dpdk.org (Postfix) with ESMTP id AF90A240474 for ; Wed, 3 Feb 2021 10:01:51 +0100 (CET) Received: by mail-wr1-f43.google.com with SMTP id v15so23277768wrx.4 for ; Wed, 03 Feb 2021 01:01:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=A0nQKAFA3eGDnG0hwMMhZ8AE0Z4U0UD5dW8xwQoq5Uk=; b=PovVwIl9EmaMe6Erq3Y6AWyQWsjSyhCWHBmshJhqkFqjGrD84DTtCxjsRWgn/P3FL7 C6bzI+TpPOGyONlWp5c+5A+flKPsJMwT1/vzRZybHuPKrPewqm9CQ0NqJQlu9uwT6TdB 3OlC34SlxbSw2ceDUwurU2Os8lMyq81RlYHBrzQurQcnlLUhox4jc2XOU4Z+bLHlNJWQ 35eQSFl+Oe5TgPzAMKUuKgjmmpIP81zz5cmdWVTI3d2TeVuCQbRmusCQrf55DKaT3gyc 0BYW7tTv/c3+0GHyXB1K+T/2yrGBliabsMpidVztkFe6SlWwBbCe0SabVgiplqe85jX8 E9+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=A0nQKAFA3eGDnG0hwMMhZ8AE0Z4U0UD5dW8xwQoq5Uk=; b=tEoG+IyGiyFf15aSx5mLNHRE7UqIEt1xIds7B+SvcSRToq/6HoRznQPi9YkiUMBSE+ tq7v2F/KtOFWXKQ5vtqHQ78kB7IwUUhKEY00PNd1cmUx2zApoMRunBc8/C9dC+IJP0si rivmeZC5XKw+VKkA4dxMNFnjLP0CJQeDoUNFjLYGf1jmKkRWWBKOZye7hRi5T0vZ1GIp OKEDQJ1coJ19AODIq9tIvW2o26KcN/GQp0m8CVSJGg2IuK1gqa6FCH/wNXJ/IlCtj+gZ r+8vi8vv/ZZyTrFQNHov8eGJFmTVLhRmElFH7qblEPvtbOeDIsTke6ubGkxGgjtBUXqT X2QA== X-Gm-Message-State: AOAM531H9iw+n430xZQRqIPmRMPckVmeWBxTjUiptrW00VCGlRUK9sYm ZC7W4qK+zRg4yAYzbS/dqHlw7o20kn3H2Q== X-Google-Smtp-Source: ABdhPJx0fIUxSD+u8sk6hRhDNtK3Op/5eut7B4YQFJ/mCoM4KIxjMCairtXbqX5Omy42b807bZH74Q== X-Received: by 2002:a05:6000:1105:: with SMTP id z5mr2258552wrw.15.1612342911425; Wed, 03 Feb 2021 01:01:51 -0800 (PST) Received: from gojira.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id q63sm1859244wma.43.2021.02.03.01.01.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 01:01:50 -0800 (PST) From: Olivier Matz To: dev@dpdk.org Cc: Andrew Rybchenko , stable@dpdk.org Date: Wed, 3 Feb 2021 10:01:01 +0100 Message-Id: <20210203090101.5669-1-olivier.matz@6wind.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] mempool: fix invalid panic on dump or audit 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" When doing a mempool dump or an audit, the application can panic because the length of the cache is greater than the flush threshold, which is seen as a fatal error. But this can temporarily happen when the mempool is in use. Fix the panic condition to abort only when the cache length is greater than the array. Fixes: ea5dd2744b90 ("mempool: cache optimisations") Cc: stable@dpdk.org Signed-off-by: Olivier Matz Acked-by: Andrew Rybchenko --- lib/librte_mempool/rte_mempool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index b9f3fbd614..afb1239c8d 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -1167,7 +1167,7 @@ mempool_audit_cache(const struct rte_mempool *mp) for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { const struct rte_mempool_cache *cache; cache = &mp->local_cache[lcore_id]; - if (cache->len > cache->flushthresh) { + if (cache->len > RTE_DIM(cache->objs)) { RTE_LOG(CRIT, MEMPOOL, "badness on cache[%u]\n", lcore_id); rte_panic("MEMPOOL: invalid cache len\n");