Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3789585rwb; Fri, 30 Sep 2022 08:20:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5zokF+B91k00YVIdBGiB/cGpSZS9a6VNxNstn+eZvLeZjVDM/pt38WfWIqhPgAHbHaAJQX X-Received: by 2002:a17:906:db02:b0:780:24e:cf9 with SMTP id xj2-20020a170906db0200b00780024e0cf9mr6830465ejb.460.1664551217207; Fri, 30 Sep 2022 08:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664551217; cv=none; d=google.com; s=arc-20160816; b=o3rtaJH+fCxRm5NFGN0105+5FQPq7NsPV6mQLjjCRKK33PNhKXqxd4AfpXaX/gbFbP Bzu/qFJM7yaf+MmdlDNbs2x8Pz2kwyy8CuCuKJTL2LdtUdxHT+IZrvwSoxCgSmhhBw9i rnbc99XPKG1TLcsHJnaDrwsd+2SOQ6BbiohZK5pxIWyS4Q09IzdfCUsM9zR/iVwuPIgg Wxx07tisIAm0YOpZsaTJmTR6zNlKCAU00DB0htsevNtf5QPJDSGWrRlZQHFIztPvMMwb tmmolyScR776wqbypveV8UXP4PKjvXTSgXt/xN3riBL0BybgCMHlobNcMcOCCVWQNXrO hqdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=a+spfYMCZZ1hiMsyKYMRyJJWw3SbhydAe67QIBjklrI=; b=FadJfDxzogW5CLJb85KDiwlGXI7Mwrvw0LQKWOzy3uoDLIpKoGQd0LzSPPZkkTQKu7 dqzFFisLd5/QUzNZVaUO3eNKUNZ+aH7S9O2be8LO0eJNU8q2kyxnumRXlRv3g5YgM8ko FDdv3sHiy+pVYG6sE/nRJujXvn157ieVd+/t+Mv8qJ3JqGE9QMQSnicJdw9vLl+13+Uf 9SJl2jjWk/eR9t2drdjHl19y/RAtb0Ar7mgthpKWeNmicNEfIg5T6Hy1uqAt30oUHs+p Se1x+/goSYz+xT9o9D4Qxja/A3j2TSVCdlJSkurgri74KdwPeUCsPvNiDVTc65CZLY40 sYiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=UwQW8Ez+; dkim=neutral (no key) header.i=@linutronix.de; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y7-20020a50eb07000000b004532dbfc916si2071086edp.615.2022.09.30.08.19.50; Fri, 30 Sep 2022 08:20:17 -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=@linutronix.de header.s=2020 header.b=UwQW8Ez+; dkim=neutral (no key) header.i=@linutronix.de; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231788AbiI3PBJ (ORCPT + 99 others); Fri, 30 Sep 2022 11:01:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231718AbiI3PAf (ORCPT ); Fri, 30 Sep 2022 11:00:35 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4DC2C1EB7; Fri, 30 Sep 2022 07:58:45 -0700 (PDT) Date: Fri, 30 Sep 2022 16:58:41 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1664549923; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=a+spfYMCZZ1hiMsyKYMRyJJWw3SbhydAe67QIBjklrI=; b=UwQW8Ez+JlwCgQWm8ahL5evfpnXszfMqY8BYqTeELuVOPeRXxLQ61z3gEazZjg8WcaMDht /SAoOhYq+MwW+3WRnMSPXa79scUTtgjDodhoEuIzyGMkBxZPdzh3E4dXKO7HmJ31FVoXY6 Sc13a/wxo1C3vM9AMcKe9vyH0W4wT0hO9k817z1XqQ+PR7H3WD9gwpF9F4XJqUOkJAGbFO +H30nRvYNGRTenFlsd3yHDOFvkZPi/zpEHQWMLKs2lB9wnkeFCtkMVebNuHJi9z1sdqHFp bmq6nOEMtuWQ6RR6jnhDq7L926WEwhAJX1JBIrT3z1TlBtoy3YlS07Qh0lcGsA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1664549923; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=a+spfYMCZZ1hiMsyKYMRyJJWw3SbhydAe67QIBjklrI=; b=QqNy0wkxgzQjkkMp5aI8qz6QB0OO1+QZGMscurUMslt9nboZdp/vDsRKf+3sASYWEP6IWt W72sjcPR6dRdGqBg== From: Sebastian Andrzej Siewior To: Mark Gross Cc: LKML , linux-rt-users , Steven Rostedt , Thomas Gleixner , Carsten Emde , John Kacur , Danie l Wagner , Tom Zanussi , Clark Williams , Junxiao Chang Subject: Re: [ANNOUNCE] 4.9.327-rt197 Message-ID: References: <165222469651.210737.17409564443317121708@T470> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 On 2022-09-23 13:09:41 [-0700], Mark Gross wrote: > > As this was a tricky one I request people to give a good look over. You did good. I not so much. If you could please add the following patch on top, then it will compile also on !RT. Thank you for work. ------->8---------- From: Sebastian Andrzej Siewior Date: Fri, 30 Sep 2022 16:55:34 +0200 Subject: [PATCH] local_lock: Provide INIT_LOCAL_LOCK(). The original code was using INIT_LOCAL_LOCK() and I tried to sneak around it and forgot that this code also needs to compile on !RT platforms. Provide INIT_LOCAL_LOCK() to initialize properly on RT and do nothing on !RT. Let random.c use which is the only user so far and oes not compile on !RT otherwise. Signed-off-by: Sebastian Andrzej Siewior --- drivers/char/random.c | 4 ++-- include/linux/locallock.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index daea466812fed..86c475f70343d 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -236,7 +236,7 @@ struct crng { static DEFINE_PER_CPU(struct crng, crngs) = { .generation = ULONG_MAX, - .lock.lock = __SPIN_LOCK_UNLOCKED(crngs.lock.lock), + .lock = INIT_LOCAL_LOCK(crngs.lock), }; /* Used by crng_reseed() and crng_make_state() to extract a new seed from the input pool. */ @@ -515,7 +515,7 @@ struct batch_ ##type { \ }; \ \ static DEFINE_PER_CPU(struct batch_ ##type, batched_entropy_ ##type) = { \ - .lock.lock = __SPIN_LOCK_UNLOCKED(batched_entropy_ ##type.lock.lock), \ + .lock = INIT_LOCAL_LOCK(batched_entropy_ ##type.lock), \ .position = UINT_MAX \ }; \ \ diff --git a/include/linux/locallock.h b/include/linux/locallock.h index 0c3ff5b23f6a1..70af9a177197e 100644 --- a/include/linux/locallock.h +++ b/include/linux/locallock.h @@ -22,6 +22,8 @@ struct local_irq_lock { unsigned long flags; }; +#define INIT_LOCAL_LOCK(lvar) { .lock = __SPIN_LOCK_UNLOCKED((lvar).lock.lock) } + #define DEFINE_LOCAL_IRQ_LOCK(lvar) \ DEFINE_PER_CPU(struct local_irq_lock, lvar) = { \ .lock = __SPIN_LOCK_UNLOCKED((lvar).lock) } @@ -256,6 +258,9 @@ static inline int __local_unlock_irqrestore(struct local_irq_lock *lv, #else /* PREEMPT_RT_BASE */ +struct local_irq_lock { }; +#define INIT_LOCAL_LOCK(lvar) { } + #define DEFINE_LOCAL_IRQ_LOCK(lvar) __typeof__(const int) lvar #define DECLARE_LOCAL_IRQ_LOCK(lvar) extern __typeof__(const int) lvar -- 2.37.2 Sebastian