Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6609495rwi; Mon, 24 Oct 2022 03:59:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4LiY7xeEJjpcMdg8+q1Xej7hEio7R/3SgK0DUkodPtbw1dqxvnitCjn4PfndOHsSUSQ8SM X-Received: by 2002:a17:906:8453:b0:78d:b65a:abf1 with SMTP id e19-20020a170906845300b0078db65aabf1mr26255892ejy.696.1666609151438; Mon, 24 Oct 2022 03:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666609151; cv=none; d=google.com; s=arc-20160816; b=m6UXCHMmZLFRtr64E+z9Tk7Y3iMviw7Sul/ZxxuQ7O/7j1JlfvkOlDwDHTFc0WWJXe Lhiv7LbO76BoGZocOQfsJE5YLJfW2em1inz6V6/x2GYuGAZ6dgAV6aBqZzXFVJ8s4kME umaGmgScWu9k0cGCY8XpqdTlbk9RhalzfpLDRDEl6exwoRv944QrlMgueFw93IwuSmKD RGS9rdtSyXU1FlNoaYxyzvObfNxgz/1l+mXPnB/973e8Ec5qY1D3IfvLIMwvuogKduK+ TVZKOvcMb98AT1Pjrd7MwE1OWaTfIuSfppiAKREoeVTWHHloMN03ZJ7s/aIgsTu6fsnx 238Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OO8ivmGitwcKDyAkmI+pQE3XfdhYBWotXa3wVqMIHE4=; b=xiUOg4afcfyv+0NoCp6sC+PgRhtoRuAm3W4l+P9fbNu/ey/tFjsoBJ2VVrIv2hbztz spnLuRaqIpEVFRGZ8norKEGi8+HnYkQHUpk1++l3OVmT4+AEQ+36kNgVI+91ikApKrKG 4HS1tcbg3zUhOxekKQZSVgOIqb7cs5glH0/q/p2GVkUrYh6JUNDMP1+xtwcegXGdq2ZH KlVUjcskWxlppdrpF1ZPCvv5hyR/I3OYW4z/O3y/479uCT3rxtBqn3CFdyvGy56iWkbA P2FhVPko62R8R5XEnal2HpR0H8Pm48yk76OsyJaBTaJxJ9TI18OBRPAPmmLAzY3kyOdB OSQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@monom.org header.s=dkim header.b=OVscYbQB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=monom.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm21-20020a170907949500b00787803711f9si29003388ejc.353.2022.10.24.03.58.46; Mon, 24 Oct 2022 03:59:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@monom.org header.s=dkim header.b=OVscYbQB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=monom.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229746AbiJXKzi (ORCPT + 99 others); Mon, 24 Oct 2022 06:55:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229912AbiJXKy6 (ORCPT ); Mon, 24 Oct 2022 06:54:58 -0400 Received: from mail.nearlyone.de (mail.nearlyone.de [46.163.114.145]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C8B613F34; Mon, 24 Oct 2022 03:54:38 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D116061D78; Mon, 24 Oct 2022 12:44:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monom.org; s=dkim; t=1666608269; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=OO8ivmGitwcKDyAkmI+pQE3XfdhYBWotXa3wVqMIHE4=; b=OVscYbQBs3+pgCis9WTsKntYC4FUwkJhmodaQtdp/Ujq7AL2cze7YucRBBlPBRyWtk39FW skrs6X8tG7lzd6HPwuRtF/V0O5BCnvhjxWgYyjxaFz+TmiysVlBpxA+bqG7qGsR0m4jjJT 5CYIS8ae1T1it1DBGHa2736TDV94gwjMjETQqpabaH8MtlliOGOtJxkiW6dGqbvFtGeqHI L7qpzbzQ1qgw5ME9vi7reGiE4u/Q76PdL6TbVJFDdLg/Xr0IfG2MhfsfLdk4VSdYVoTBgr CgJ8bpBvW8TsRRj3asXaJpZflnO7hByW+Axx8VnTGUwNlTUMhAHtgcgfL/tNPg== From: Daniel Wagner To: LKML , linux-rt-users , Steven Rostedt , Thomas Gleixner , Carsten Emde , John Kacur , Sebastian Andrzej Siewior , Tom Zanussi , Clark Williams , Pavel Machek Cc: Daniel Wagner Subject: [PATCH RT 1/9] Revert "random: Use local locks for crng context access" Date: Mon, 24 Oct 2022 12:44:17 +0200 Message-Id: <20221024104425.16423-2-wagi@monom.org> In-Reply-To: <20221024104425.16423-1-wagi@monom.org> References: <20221024104425.16423-1-wagi@monom.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org v4.19.255-rt114-rc1 stable review patch. If anyone has any objections, please let me know. ----------- This reverts commit af5469c6f4f85f60f3ecc9bd541adfb6bdbeaff2. --- drivers/char/random.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index c06705a32246..2be38780a7f7 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -235,7 +234,6 @@ struct crng { static DEFINE_PER_CPU(struct crng, crngs) = { .generation = ULONG_MAX }; -DEFINE_LOCAL_IRQ_LOCK(crngs_lock); /* Used by crng_reseed() and crng_make_state() to extract a new seed from the input pool. */ static void extract_entropy(void *buf, size_t len); @@ -364,7 +362,7 @@ static void crng_make_state(u32 chacha_state[CHACHA20_BLOCK_SIZE / sizeof(u32)], if (unlikely(crng_has_old_seed())) crng_reseed(); - local_lock_irqsave(crngs_lock, flags); + local_irq_save(flags); crng = raw_cpu_ptr(&crngs); /* @@ -389,7 +387,7 @@ static void crng_make_state(u32 chacha_state[CHACHA20_BLOCK_SIZE / sizeof(u32)], * should wind up here immediately. */ crng_fast_key_erasure(crng->key, chacha_state, random_data, random_data_len); - local_unlock_irqrestore(crngs_lock, flags); + local_irq_restore(flags); } static void _get_random_bytes(void *buf, size_t len) @@ -514,7 +512,6 @@ struct batch_ ##type { \ static DEFINE_PER_CPU(struct batch_ ##type, batched_entropy_ ##type) = { \ .position = UINT_MAX \ }; \ -static DEFINE_LOCAL_IRQ_LOCK(batched_entropy_lock_ ##type); \ \ type get_random_ ##type(void) \ { \ @@ -530,7 +527,7 @@ type get_random_ ##type(void) \ return ret; \ } \ \ - local_lock_irqsave(batched_entropy_lock_ ##type, flags); \ + local_irq_save(flags); \ batch = raw_cpu_ptr(&batched_entropy_##type); \ \ next_gen = READ_ONCE(base_crng.generation); \ @@ -544,7 +541,7 @@ type get_random_ ##type(void) \ ret = batch->entropy[batch->position]; \ batch->entropy[batch->position] = 0; \ ++batch->position; \ - local_unlock_irqrestore(batched_entropy_lock_ ##type, flags); \ + local_irq_restore(flags); \ return ret; \ } \ EXPORT_SYMBOL(get_random_ ##type); -- 2.38.0