From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4FCB8A058B for ; Fri, 17 Apr 2020 13:37:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 23EB81E4B9; Fri, 17 Apr 2020 13:37:04 +0200 (CEST) Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by dpdk.org (Postfix) with ESMTP id 50BB91DBB1; Fri, 17 Apr 2020 13:37:01 +0200 (CEST) Received: by mail-pj1-f68.google.com with SMTP id 7so2104583pjo.0; Fri, 17 Apr 2020 04:37:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9LVZ2rdpYYSVeuuA0UXbA2f7zwOR3HScUVH7d4qfeRI=; b=RfT2seUxPh54aZvvUYVr2H9cSyKH+YkmEYlkyHtPntRWLYERGlDzQT3sKJkIXoE1Gp wXov/aFPE8GZGZViRbyrhc94K53+tZpkVNIhN5yMzH0XfvjVvXv1gNmUmdaz4c2WdWoN La2k0NSN0niB+0Pz0n+ASlkfTDLT8AH0PfN+ZYsAYuCxISBj42f2YwUuCvkLbkIbc/87 JVl0I2sUZWzvHq64Z2NalWwr7EhN9WRhhFM1kXlec8wWCZDgPq8pUB+CINZ/QCZkw2cj Qz9w180PX1DOqj0CF8J/1zkPP5CalczoR70Wcb9fuQsMTOSMZ4mzOZAkdojsvIFbVj3J rqMQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=9LVZ2rdpYYSVeuuA0UXbA2f7zwOR3HScUVH7d4qfeRI=; b=DgwLGQvcdznTKmGL1kAgiTk7oB/XF30US6AORc9+FqqQFwTfwrLm0JwWBtj5LOgQUk LSxHe9pZo/CzorRBvY9QlkdXZ/UgDIojl3IOiRkp/ZeIBJNP0CKkz9u5QZknPlGILOMZ 1kOdlcn4tpyUeEqRymPI5UYxI3eKsBlle5NBnmizMBvvHDYOdeFECp6nOHoB8mmZMkfH 56UpXNJDPnwPjEsYa6nH8A3OlShIkGkJb/u4pA62AzWteJHqcqIs/QbeGuMjpvivtmip xHN+FxuHT51I3ZEYzElZmfMc1+1t+f6Oq8l2npm5O+uQuQpMAKDCifr5xj0W5RAOFcqm 12eA== X-Gm-Message-State: AGi0PuaRWjvEeMxSMuJm3pOa8ctw+rPRJNvJrwaW6g+PnRijWQyo2bns 9HCZIi5YazqfB1Qj5IqErEA= X-Google-Smtp-Source: APiQypK1VhZfM0JZTML/rTa5kK+el60Qzjpe7MoL/urF2HI17Jhe+uj2iDhPVlmEw9nuDWZEpe1vhw== X-Received: by 2002:a17:90a:d703:: with SMTP id y3mr4114792pju.75.1587123420409; Fri, 17 Apr 2020 04:37:00 -0700 (PDT) Received: from local.opencloud.tech.localdomain ([115.171.63.184]) by smtp.gmail.com with ESMTPSA id w129sm3953016pfw.0.2020.04.17.04.36.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2020 04:36:59 -0700 (PDT) From: xiangxia.m.yue@gmail.com To: mattias.ronnblom@ericsson.com, david.marchand@redhat.com Cc: dev@dpdk.org, Tonghao Zhang , stable@dpdk.org Date: Thu, 16 Apr 2020 01:41:06 +0800 Message-Id: <1586972466-40703-1-git-send-email-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <586680073-11075-1-git-send-email-xiangxia.m.yue@gmail.com> References: <586680073-11075-1-git-send-email-xiangxia.m.yue@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v3] eal: fix crash when the random init X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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" From: Tonghao Zhang When rte_rand_init is invoked, and the kernel running dpdk does't support *getentropy, at the same time, the cpu does't support rdseed, then rte_rand_init invoked rte_get_timer_cycles. If HPET was enabled in the DPDK build (CONFIG_RTE_LIBEAL_USE_HPET=y). rte_get_timer_cycles will invoke rte_get_hpet_cycles while *eal_hpet is not available. To fix that, use rte_get_tsc_cycles instead of rte_get_timer_cycles. Fixes: faf8fd252785 ("eal: improve entropy for initial PRNG seed") Fixes: 3f002f069612 ("eal: replace libc-based random generation with LFSR") Cc: stable@dpdk.org Signed-off-by: Tonghao Zhang Acked-by: Mattias Rönnblom --- v3: * add more info in commit log and fix a typo v2: * use rte_get_tsc_cycles instead of rte_get_timer_cycles --- lib/librte_eal/common/rte_random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/common/rte_random.c b/lib/librte_eal/common/rte_random.c index 57ec8fb2b3dd..b7a089ac4fe0 100644 --- a/lib/librte_eal/common/rte_random.c +++ b/lib/librte_eal/common/rte_random.c @@ -198,7 +198,7 @@ struct rte_rand_state *__rte_rand_get_state(void) return (uint64_t)rdseed_low | ((uint64_t)rdseed_high << 32); #endif /* second fallback: seed using rdtsc */ - return rte_get_timer_cycles(); + return rte_get_tsc_cycles(); } RTE_INIT(rte_rand_init) -- 1.8.3.1