lkml.org 
[lkml]   [2019]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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, &reg_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

\
 
 \ /
  Last update: 2019-11-16 12:25    [W:0.504 / U:2.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site