From patchwork Mon Oct 24 10:44:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 8331 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp376407wru; Mon, 24 Oct 2022 03:58:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5rTyJYwc8HSS3xVfPMG4KYx7WJ637gVIXizzJ+uc5xrf2QbVMM/GonVQJ0NkqM4iPhva7N X-Received: by 2002:a05:6402:4150:b0:44a:ec16:def4 with SMTP id x16-20020a056402415000b0044aec16def4mr30611106eda.21.1666609100882; Mon, 24 Oct 2022 03:58:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666609100; cv=none; d=google.com; s=arc-20160816; b=vddaCCIG8PzIlDEoS1fbvOSEofrsA623atSOb76g7tBmORFjcj9JhJ6Ot9J3G20FYn 5mJAM+uc21OwdEIutWMsf3EDH9P6HJg+VZw8XNXZbwAzGQMu210+nW4zpqYrp2elDHNV VpJhDyn2mHempGZAQ9EXZSV6/nNXdkq0ZDgBixrTMmuSzCoMsHKsE6em0FSWOYe7mnKe cmDuAhASNOm6kt62dU+DaA2mxGgA3CjPl9/9U7aRuTJGAZhRUuNpEg3kKXRTI2G2AAEY LrM3PN+ZyO6GeJSIPfRezCki0fRAuGXWFInXz1x+ukqaVno13FeYNCyvyL0GvjX2znXI Xq6w== 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 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.57.57; Mon, 24 Oct 2022 03:58:20 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747566304565031916?= X-GMAIL-MSGID: =?utf-8?q?1747566304565031916?= 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);