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 79167A0588; Thu, 16 Apr 2020 16:04:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 572E61DA83; Thu, 16 Apr 2020 16:04:42 +0200 (CEST) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id C24A81D9C7; Thu, 16 Apr 2020 16:04:40 +0200 (CEST) Received: by mail-pg1-f195.google.com with SMTP id e12so315849pgj.6; Thu, 16 Apr 2020 07:04:40 -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; bh=HKW+7PpL+Wj6PwwWTbPV1CuCQbnnNxwA3abjeqrDp1s=; b=HWMkLxGiGTwXdO2qDFq74E5UDOTqN4NpfaLcbuFxT/9lsDK1kAJOaGe4tpvVhRhHY+ dTCO0dudIXiP+GVsjWBp2zf8rKIXRMniEQvJfeRI3+UKYcBykv8UaNCYDx8jH5P9fMEA 6LZujPjxbk1ybXMVjaHcKdDuDxd7O56VfpNur6OETaKjEYZEEZ9A7JTHLz+hw2iRQ2Fx 9vwehdho/NGhTB3j4mUC6rEswKkXaWAQc5T6aqD4TEKJ9pHdrTGMWEOVla0F2R0px6Gy n3ViEhSqjJCOFsdWKBpHnZnJSki0xrcQkTdSQneMct94LLqREQcRGkR5BC4IzmrdxiE+ cxbA== 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; bh=HKW+7PpL+Wj6PwwWTbPV1CuCQbnnNxwA3abjeqrDp1s=; b=WX3OZ+/zTFh3Eq1nWOL8t4crlfqnl5zSgANtlxx3gEU8Zcrf/fcQN0ceua6h6B2hi4 VLuSrz0T7e9vWxu7oGp42n72g7pRl46jYSc9jTCoL9g8tBZxYncrUfBVc6xYFNie2AHr 84QB9vkPqL2A8ZCKwN61q7hTl7VE/+T38nS1YnaaJvuMU38XxLPlYOiWNn0+lgOgBHId iwTT4nqR9ECDy7kwcrB1Xi6ntj1TbwBIJu3B24U8pwb7wnRd9/Z6/W7tLsgHepmEku2+ uBz2qC6rM2qnOUzVshW7XnkBRImki+IKq3XZtdTKEPw7Jqxk6cPtA31KQXINVNaq/5E+ Zv6w== X-Gm-Message-State: AGi0PuYwhK6jSFfN8kMuoZYOPbMu/FCX7gp4doE111rdoyN/mvP0TnSf eMZlP9a7fLFCi1t+RRLDMqXdevcOnkk= X-Google-Smtp-Source: APiQypIEnu7UyliDZ6JrO5cDGemMIfKKjqc3e0mUm4rIwS7HfGL8JZux6CbNoiCsEwWBq06O8fAQYg== X-Received: by 2002:a63:8149:: with SMTP id t70mr11962033pgd.205.1587045879894; Thu, 16 Apr 2020 07:04:39 -0700 (PDT) Received: from local.opencloud.tech.localdomain ([115.171.63.184]) by smtp.gmail.com with ESMTPSA id nu13sm2905085pjb.22.2020.04.16.07.04.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Apr 2020 07:04:38 -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: Wed, 15 Apr 2020 15:43:35 +0800 Message-Id: <1586936615-35033-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> Subject: [dpdk-dev] [PATCH v2] eal: fix crash when the random init X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" 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 which invoked rte_get_hpet_cycles while *eal_hpet is not available. To fix that, use rte_get_tsc_cycles instread 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 Reported-by: Ravi Kerur Signed-off-by: Tonghao Zhang --- v2: * use rte_get_tsc_cycles instread 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