Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2740848pxb; Mon, 31 Jan 2022 03:21:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJqn+TqTedbcd4Tm44gvKQbp+tD/ONvfMBOTfi3tFCn63pOJimUo5gXYX2GhGxfe7ghra+ X-Received: by 2002:a05:6402:448c:: with SMTP id er12mr20156281edb.137.1643628065277; Mon, 31 Jan 2022 03:21:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643628065; cv=none; d=google.com; s=arc-20160816; b=l3hIud6qJppTuyGSXXWyp9ddhe3+xe3ZI5QeGHbYZoBod80581Hei2kN1VHw6E1Ah4 Qt/3+K0zPSrxi7oM+gqwYNlnswYgctwa0dXagWzjUAGavQY2XZjLRT2X1bA1zK3bOyEh Y3nbbbSnObixTwPVsDflLBdCyoLNISz5SIVGJH8d1escRng6CHZfDlOwb2YAiWPePPoe ihJAxCgIk8VectTVnHS6yFV/zTc0Kj+vKspOMH1NnoECb2ndMBRsCQc94XzLj/Wbo9Tg abokEQzID/3FCV5y8zd9chWf/3NzJpHjunWHjaGw7WyGmvxkNqHR/YKoWbM4HD5D8m96 VtnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=guMFLMofiqe5xiQ2BRsEVmO5w5+mC76cL6WiryePP2M=; b=DuVtGvLRtZkRy+jZypkYJDq2ujVtDLV2ERva2fcJKwUzPTfDw//7KWl8S+GPFlr6xi cpokNnn7MvrfCBUb5eHqwD/EoaGl6atPz31DZNpc4WOEwaSlDggZzVPIzgYli/f1Z2Ac 9F43TCzSJ5BoCtdszXmzECQVazgPaa730Qgl2cJILMq/l/q5HG2qkzQfcZmXTfO1Ez8S TbYIadL8HWN6m4l7DtiXNGsgE/hovU4B+/dZ+cL1a2Nn+iLipct2s8BGfIIjgwx9UIK7 XyDLsmBZ09RkBUCz1bWljC9yIrgqf2tF9gazHzJ0teKwHvQAGGsDgWsNRzuVBJofsmOR 4fVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=WPFDHaST; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 21si7403356eji.830.2022.01.31.03.20.39; Mon, 31 Jan 2022 03:21:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=WPFDHaST; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350211AbiA1QhZ (ORCPT + 99 others); Fri, 28 Jan 2022 11:37:25 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:38284 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350198AbiA1QhO (ORCPT ); Fri, 28 Jan 2022 11:37:14 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B5C1260A37; Fri, 28 Jan 2022 16:37:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3E01C340E7; Fri, 28 Jan 2022 16:37:12 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="WPFDHaST" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1643387830; 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=guMFLMofiqe5xiQ2BRsEVmO5w5+mC76cL6WiryePP2M=; b=WPFDHaSTuo9cwPUupNClF1shvSf/TIevVpkraCRUH76k02rT29m2qByqhBfQEsIyhmcJRl nBLgcMHUwfHVN3F55umgCkvQkOXM01TFoM7VXMDBMGNKo0oMMe/fKeuKKoXhQ2psiO1hEH JOf9xDGK+UQNaBH2GjHFBponi4zHdGw= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 87c3a824 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Fri, 28 Jan 2022 16:37:10 +0000 (UTC) Received: by mail-yb1-f182.google.com with SMTP id g14so20060351ybs.8; Fri, 28 Jan 2022 08:37:10 -0800 (PST) X-Gm-Message-State: AOAM531G8xB1LijkHOqTguMwtjoViu76odh3lojCVazlBVmtJqWTSqx7 e8ePGxirtCwFyzm41++lq0qp7hHK0ldUwUg7cB4= X-Received: by 2002:a05:6902:1501:: with SMTP id q1mr14890230ybu.638.1643387828559; Fri, 28 Jan 2022 08:37:08 -0800 (PST) MIME-Version: 1.0 References: <20220128153344.34211-1-Jason@zx2c4.com> In-Reply-To: From: "Jason A. Donenfeld" Date: Fri, 28 Jan 2022 17:36:57 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] random: remove batched entropy locking To: Sebastian Andrzej Siewior Cc: Andy Lutomirski , =?UTF-8?Q?Jonathan_Neusch=C3=A4fer?= , "Theodore Ts'o" , LKML , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Andy Lutomirski , stable , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sebastian, I wrote in my last message, "I don't think that thread needs to spill over here, though," but clearly you disagreed, which is fine I guess. Replies inline below: On Fri, Jan 28, 2022 at 5:15 PM Sebastian Andrzej Siewior wrote: > > I did, and my reply is here: > > https://lore.kernel.org/lkml/CAHmME9pzdXyD0oRYyCoVUSqqsA9h03-oR7kcNhJuPEcEMTJYgw@mail.gmail.com/ > > > > I was hoping for a series that addresses these issues. As I mentioned > > before, I'm not super keen on deferring that processing in a > > conditional case and having multiple entry ways into that same > > functionality. I don't think that's worth it, especially if your > > actual concern is just userspace calling RNDADDTOENTCNT too often > > (which can be safely ratelimited). I don't think that thread needs to > > And what do you do in ratelimiting? If I'm understanding the RT issue correctly, the problem is that userspace can `for (;;) iotl(...);`, and the high frequency of ioctls then increases the average latency of interrupts to a level beyond the requirements for RT. The idea of ratelimiting the ioctl would be so that userspace is throttled from calling it too often, so that the average latency isn't increased. > As I explained, you get 20 that > "enter" and the following are block. The first 20 are already > problematic and you need a plan-B for those that can't enter. > So I suggested a mutex_t around the ioctl() which would act as a rate > limiting. You did not not follow up on that idea. A mutex_t would be fine I think? I'd like to see what this looks like in code, but conceptually I don't see why not. > Please ignore Jonathan report for now. As I tried to explain: This > lockdep report shows a serious problem on PREEMPT_RT. There is _no_ need > to be concerned on a non-PREEMPT_RT kernel. But it should be addressed. > If this gets merged as-is then thanks to the stable tag it will get > backported (again no change for !RT) and will collide with PREEMPT_RT > patch. And as I mentioned, the locking is not working on PREEMPT_RT. Gotcha, okay, that makes sense. It sounds like Andy's patch and your patch might both be part of the same non-stable-marked coin for cutting down on locks in the IRQ path. [Relatedly, I've been doing a bit of research on other ways to cut down the amount of processing we're doing in the IRQ path, such as . This is really not ready to go, and I'm not ready to have a discussion on the crypto there (please, nobody comment on the crypto there yet; I'll be really annoyed), but the general gist is that I think it might be possible to reduce the number of cycles spent in IRQ with some nice new tricks.] Jason