Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp13203pxb; Mon, 7 Feb 2022 05:31:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/pDGkZN7HeomRGJlMBDSTRYVEWiE+s9CVG4Nj7PnF3aLiakRz/x0DIxRvDvr1hH7IYAPZ X-Received: by 2002:a63:ed58:: with SMTP id m24mr9241295pgk.33.1644240696071; Mon, 07 Feb 2022 05:31:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644240696; cv=none; d=google.com; s=arc-20160816; b=mp2kaC7zwQAC540FqEJDt+RAwAxM0L7Ii0i/PWBRl953NI1Dy90ApCYLVLjjABXfSX ZsaoN6COPquMP/pKElPpcDd3s79BzNsrS+dJR1cv/JCM1dahypW8YAm1lqHoWNky1cvN 5Ea7Xx93APGDsF1wD2we01CrWZUXpEogp1v7v4vrlc+hvFZFIfLJlIO+MSkFu8qtYxfj uqfgeiD+/6hFR7jYpiJ0pXP2G1PZZVz1sjDD1ZuEUQcDOpbJckntPeGOukqgYZWUr9wX SbX1USVVMuwpkOJevm/6EAScHjlxdUFFulpZM8pSUVNfZBgjzNe+wP7pyCVQZls4NcyT HPIg== 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=Tg5AZLGIn8MkxSEe8OP8pxy3cet7YfAGJEuYNNSj2ag=; b=S5AMKBvYyqNRp9YKsHlf6jxSRtGGvalCXJzgBRzpX0QVwn6K/BnvWWsNyxSEWMGduE tNDbYMVohOJAOKs0CeQoMNz2ZOjYN2r4hvwv/vqzs4s8UqbLkWKki6O6mz2j5/rUwWEP RFYaF2ZIYSYw4nxfUI7cxoXbFbJkyVtWQ/gK+GgDhTA5ZBHmMyAlvhfRN19YuErNL0fE 0a5iXNlm70gtHS/UMjVXew81UslZskREd+wFXNo4NQaIRuwyb9VOElcB4RBpg8jJDs/X kgLJ2hIkJaIIvFskwDVmaJCzJ0sm3mLbJ6y48Cj5iwVDuk7GHNQOT2MAePLz7fIlWoWe GenQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=NYo4uMSI; 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=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 125si4084352pge.778.2022.02.07.05.31.15; Mon, 07 Feb 2022 05:31:36 -0800 (PST) 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=@zx2c4.com header.s=20210105 header.b=NYo4uMSI; 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=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379863AbiBEMvC (ORCPT + 99 others); Sat, 5 Feb 2022 07:51:02 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49366 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233550AbiBEMvA (ORCPT ); Sat, 5 Feb 2022 07:51:00 -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 ams.source.kernel.org (Postfix) with ESMTPS id 6DAB0B80B86 for ; Sat, 5 Feb 2022 12:50:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2A95C340EF for ; Sat, 5 Feb 2022 12:50:57 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="NYo4uMSI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1644065455; 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=Tg5AZLGIn8MkxSEe8OP8pxy3cet7YfAGJEuYNNSj2ag=; b=NYo4uMSINmznCkqPshn0vT03tToNit1LebywaOZwOcDXi4VOaoVa67OXgiZ2EpFqJctNbe nFK6FTW57XvqMFli2DRf6QliK+5IrCguu9w9GHHXYmvvkzTG+qeCWRYNoZiyG+L8Ex4L2B fH465alzoYpWA9LpqrOcPLvwsljwIWo= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id a9c7c32a (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Sat, 5 Feb 2022 12:50:54 +0000 (UTC) Received: by mail-yb1-f173.google.com with SMTP id y6so11968475ybc.5 for ; Sat, 05 Feb 2022 04:50:54 -0800 (PST) X-Gm-Message-State: AOAM530aNUXeFAzPk4yLw3MVLj02vk+G0luBs6il8cj+4roFQFC2za30 m/ZrYMANRsXziZG/LUN/Ysv8zqaDNIzmUdPM2+I= X-Received: by 2002:a81:1b54:: with SMTP id b81mr3479295ywb.404.1644065453446; Sat, 05 Feb 2022 04:50:53 -0800 (PST) MIME-Version: 1.0 References: <20220204153149.51428-1-Jason@zx2c4.com> In-Reply-To: From: "Jason A. Donenfeld" Date: Sat, 5 Feb 2022 13:50:42 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC v1] random: do not take spinlocks in irq handler To: Sultan Alsawaf Cc: Sebastian Andrzej Siewior , LKML , Thomas Gleixner , Peter Zijlstra , "Theodore Ts'o" , =?UTF-8?Q?Jonathan_Neusch=C3=A4fer?= Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sultan, On Sat, Feb 5, 2022 at 5:02 AM Sultan Alsawaf wrote: > The __this_cpu_{ATOMIC_OP}() functions are for atomically performing a single > per-CPU operation for the current CPU from contexts that permit CPU migration. > Since this code is safe from CPU migrations (add_interrupt_randomness() runs in > hardirq context), the atomic per-CPU helpers are unneeded. Instead of using > __this_cpu_inc_return() and __this_cpu_or(), we can operate on the per-CPU > pointer directly without any extra safety (e.g., `++fast_pool->count` can be > used in place of `__this_cpu_inc_return(irq_randomness.count)`). Oh, right, thanks. We're already in irq so we don't have to worried about load,add,store being cut up in any way. I'll go back to simple increments for v3. Jason