From owner-svn-src-all@freebsd.org Mon Dec 30 04:48:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A2851D4F02; Mon, 30 Dec 2019 04:48:15 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47mQ0v3fHbz4Y3k; Mon, 30 Dec 2019 04:48:15 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x431.google.com with SMTP id q6so31579887wro.9; Sun, 29 Dec 2019 20:48:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gg/ZrELw0N1zChfsLdN75g4MLPSOTfzK8UMyBjc+wtA=; b=m2t9WUNdKy7ZyWTciGULHVArEAxD+LhQMEuYfWx/zr7obUBX8Y7QQ1NE6ATYLhT3V3 6iPDa0IhFEIn6ub4FX7WSxgcQeeSKFQdWvbvyMcMVX/mD3dmM6jSaUlddJr7Huxkmsqt gNTUr2/O4vqqRetV1R57rzd4RUew59BrSHZVyovkccWzZU/wkUsqKUl4rOx2g1kSMY6k z4Rqa0LxxuW8+C8AGHtEzfNEGsUAQMVbdaOzmBIdcFGn8GvkZdnYbnk3bo4RwnGjndKQ 5PWekKoY5s0q2YwUU7ncZd+n/stXF1r01yWzqY0u6GYCqVFbtyXWKDZd8SrRQIm7kw9g 350A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=gg/ZrELw0N1zChfsLdN75g4MLPSOTfzK8UMyBjc+wtA=; b=oXU44MGQcLXUtZiMaw3cIpMPzJok+Iy9ubLm/eT3l4823XePe3HzG3qPXqsXw5pnoZ HYP3zqkeoxclc7jBEx04Iv0uP14Us8mAVWTS6qGmaxhyoG4nc5jo+DyELEwIgkcjQko5 W3z0JrKtnBSLjukTJ/OWQfTI0CV84ESIpN+Oiv10lVeyuqFRlxbEakcxhXIvL3lJf3TA WbrxXFZhY5/rClOQAsaP2JO32QUkuduzN5w3LIZeqQVE6GRjJt0scgrLUSCzXMKQIdeg Xna142MyIdpmpwQKw/3+t3HVdKz4+tVVzTYy2QwewA2z7zFDUAB14h0D+b/BPY+/MqQd VV7A== X-Gm-Message-State: APjAAAXep/pl4leoOADscQdDpzx7U6UTV3ou7xWBuDSh35Mh9hnSkozT aD1rFguKuaZzZbe4ffgw9UlbNVR8WBdeIYi9Z2GSag== X-Google-Smtp-Source: APXvYqxZVPwpdvFYHEvnowfxccmuC0Uvb/se+Q+UqmsiTUs18obHTS7m2WOay+NELih7ofiqfzNH1Iitn+DlqqwZoWk= X-Received: by 2002:a5d:4f8e:: with SMTP id d14mr24940804wru.112.1577681293460; Sun, 29 Dec 2019 20:48:13 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:6b02:0:0:0:0:0 with HTTP; Sun, 29 Dec 2019 20:48:12 -0800 (PST) In-Reply-To: <201912300138.xBU1cJqR064429@repo.freebsd.org> References: <201912300138.xBU1cJqR064429@repo.freebsd.org> From: Mateusz Guzik Date: Mon, 30 Dec 2019 05:48:12 +0100 Message-ID: Subject: Re: svn commit: r356194 - head/sys/dev/random To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47mQ0v3fHbz4Y3k X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2019 04:48:15 -0000 On 12/30/19, Conrad Meyer wrote: > Author: cem > Date: Mon Dec 30 01:38:19 2019 > New Revision: 356194 > URL: https://svnweb.freebsd.org/changeset/base/356194 > > Log: > random(4): Make entropy source deregistration safe > > Allow loadable modules that provide random entropy source(s) to safely > unload. Prior to this change, no driver could ensure that their > random_source structure was not being used by random_harvestq.c for any > period of time after invoking random_source_deregister(). > > This change converts the source_list LIST to a ConcurrencyKit CK_LIST and > uses an epoch(9) to protect typical read accesses of the list. The > existing > HARVEST_LOCK spin mutex is used to safely add and remove list entries. > random_source_deregister() uses epoch_wait() to ensure no concurrent > source_list readers are accessing a random_source before freeing the list > item and returning to the caller. > > Callers can safely unload immediately after random_source_deregister() > returns. > What's the point of using epoch for this one instead of rmlocks? rmlocks have the upshot of being faster single-threaded for the case you want (no fences). epoch would make sense if the list was expected to change over time, -- Mateusz Guzik