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 A4B144254B; Fri, 8 Sep 2023 22:56:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B4A24028A; Fri, 8 Sep 2023 22:56:07 +0200 (CEST) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id CCD2940285 for ; Fri, 8 Sep 2023 22:56:05 +0200 (CEST) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1bee82fad0fso21496915ad.2 for ; Fri, 08 Sep 2023 13:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1694206565; x=1694811365; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=34nlY9VLUMHxwh73TKiU+A3v4LHeS2OYiOKTTynCI30=; b=FfdYqyZ1dGlc92tAI/GK/hah4jfeP+ra4XtEzlLvVZ9OVBlOV9Z735z3m717Wurn/B Icuta8pPNR8UmIFsrFQXRKzkya29/KpGH5ktZjuoUZqfjlYuIs7CWFDF7mix6X+ss8Ed BXkJj/muRD5I/9dX5e8RSVTIWJTTgkcqGZXYZsFOWKWlv7rDADLonvAoz1Q4LBk0BABn hp/K5VuIS55BYm2kzBlTOremKZnQTtkTTX1WwVx5gJEje2qv2ljpuYcCSAW5FEEpC1II lAsXDmSJJaCuwrT5KFN6EK+0tvQ3KznsO+MCO6V0MoTkDMAbC3rvW0GrL2nMsCHBNj4L JH8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694206565; x=1694811365; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=34nlY9VLUMHxwh73TKiU+A3v4LHeS2OYiOKTTynCI30=; b=bXgZkLExCaYG9tCITZUQXnOMhzWRdjFn6po/zcBQS5Hs34+ShCKt5xZZvtzm3fEyoJ bTV1/dT8C7L9RuIt2WYlUp/zORLRTpxFryBhIQIwJtPRToautQfld6GncJX8IPVuQB8W U6UMBCp1O/Bmas6aum1sov/dXis3w5MNlvgZa+mufz8ZQCTUleRU7qYqn87qKo42Lx5+ 12d7BzpB1s5PoxBJBna0FxCgwRXklSH2ZtFa/i9Kxb+vspBbjgD4gVd/LvLMbTGbcgLu K3uRBbMkVTAdaZU+PaNvhWXweR9UMgC2eqie2YmP3ncXvHQqE8k/w2OtwyjInYhk6XnR 4QaA== X-Gm-Message-State: AOJu0YzT36PIIMM0jRN4qatxjXVmHX0j/ZmcqgFKxZ6ud00pDLisQ1kQ kYmNBxcGaJLCjBjxMnBj7H0YKA== X-Google-Smtp-Source: AGHT+IFddd0mmBkXYDppdVKePker5V6rf1hl/Udt9Tfhr26P67ZuIDocb9efo8ylzWxRunDJ/3IDmQ== X-Received: by 2002:a17:90b:3a8f:b0:26d:4312:17e5 with SMTP id om15-20020a17090b3a8f00b0026d431217e5mr3475988pjb.6.1694206564788; Fri, 08 Sep 2023 13:56:04 -0700 (PDT) Received: from hermes.local (204-195-112-131.wavecable.com. [204.195.112.131]) by smtp.gmail.com with ESMTPSA id gd12-20020a17090b0fcc00b00268188ea4b9sm1693469pjb.19.2023.09.08.13.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Sep 2023 13:56:04 -0700 (PDT) Date: Fri, 8 Sep 2023 13:56:02 -0700 From: Stephen Hemminger To: Mattias =?UTF-8?B?UsO2bm5ibG9t?= Cc: dev@dpdk.org, Mattias =?UTF-8?B?UsO2bm5ibG9t?= , Bruce Richardson Subject: Re: [PATCH v2 2/2] random: make rte_rand() thread safe for non-EAL threads Message-ID: <20230908135602.4a9026c0@hermes.local> In-Reply-To: <136fb174-ca02-577e-e690-f770a0328f10@lysator.liu.se> References: <20230906155302.82749-1-stephen@networkplumber.org> <20230907152456.20570-1-stephen@networkplumber.org> <20230907152456.20570-3-stephen@networkplumber.org> <136fb174-ca02-577e-e690-f770a0328f10@lysator.liu.se> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 On Fri, 8 Sep 2023 22:48:54 +0200 Mattias R=C3=B6nnblom wrote: > On 2023-09-07 17:24, Stephen Hemminger wrote: > > Add missing locking so that if two non-EAL threads call rte_rand() > > they will not corrupt the per-thread state. > >=20 > > Fixes: 3f002f069612 ("eal: replace libc-based random generation with LF= SR") =20 >=20 > The API documentation clearly states that no MT safety guarantees are=20 > given for unregistered non-EAL threads. So this patch doesn't fix anythin= g. >=20 > rte_rand() is MT safe for *registered* non-EAL threads. Reading the documentation, it only guarantees safety if registered. We should add an otherwise clause rather than leaving case as undefined.