[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1911161216540.14348@nanos.tec.linutronix.de>
Date: Sat, 16 Nov 2019 12:25:21 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: Stephan Müller <smueller@...onox.de>
cc: Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-crypto@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
linux-api@...r.kernel.org,
"Eric W. Biederman" <ebiederm@...ssion.com>,
"Alexander E. Patrakov" <patrakov@...il.com>,
"Ahmed S. Darwish" <darwish.07@...il.com>,
"Theodore Y. Ts'o" <tytso@....edu>, Willy Tarreau <w@....eu>,
Matthew Garrett <mjg59@...f.ucam.org>,
Vito Caputo <vcaputo@...garu.com>,
Andreas Dilger <adilger.kernel@...ger.ca>,
Jan Kara <jack@...e.cz>, Ray Strode <rstrode@...hat.com>,
William Jon McCann <mccann@....edu>,
zhangjs <zachary@...shancloud.com>,
Andy Lutomirski <luto@...nel.org>,
Florian Weimer <fweimer@...hat.com>,
Lennart Poettering <mzxreary@...inter.de>,
Nicolai Stange <nstange@...e.de>,
"Peter, Matthias" <matthias.peter@....bund.de>,
Marcelo Henrique Cerri <marcelo.cerri@...onical.com>,
Roman Drahtmueller <draht@...altsekun.de>,
Neil Horman <nhorman@...hat.com>
Subject: Re: [PATCH v25 01/12] Linux Random Number Generator
On Sat, 16 Nov 2019, Stephan Müller wrote:
> +/**
> + * Hot code path - Callback for interrupt handler
> + */
> +void add_interrupt_randomness(int irq, int irq_flags)
> +{
> + lrng_time_process();
> +
> + if (!lrng_pool_highres_timer()) {
> + struct pt_regs *regs = get_irq_regs();
> + static atomic_t reg_idx = ATOMIC_INIT(0);
> + u64 ip;
> +
> + lrng_pool_lfsr_u32(jiffies);
> + lrng_pool_lfsr_u32(irq);
> + lrng_pool_lfsr_u32(irq_flags);
> +
> + if (regs) {
> + u32 *ptr = (u32 *)regs;
> + int reg_ptr = atomic_add_return_relaxed(1, ®_idx);
> + size_t n = (sizeof(struct pt_regs) / sizeof(u32));
> +
> + ip = instruction_pointer(regs);
> + lrng_pool_lfsr_u32(*(ptr + (reg_ptr % n)));
> + } else
> + ip = _RET_IP_;
> +
> + lrng_pool_lfsr_u32(ip >> 32);
> + lrng_pool_lfsr_u32(ip);
> + }
Is there a way to avoid all that processing right in the interrupt hot
path and just store the raw data for later processing?
Thanks,
tglx
Powered by blists - more mailing lists