On Sun, Sep 15, 2019 at 8:52 PM Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote: > > Can we perhaps artifically increase the interrupt rate while the > CRNG is not initialised? Long term (or even medium term in some areas), the problem really is that device interrupts during boot really are going away, rather than becoming more common. That just happened to be the case now because of improved plugging, but it's fundamentally the direction any storage is moving with faster flash interfaces. The only interrupt we could easily increase the rate of in the kernel is the timer interrupt, but that's also the interrupt that is the least useful for randomness. The timer interrupt could be somewhat interesting if you are also CPU-bound on a non-trivial load, because then "what program counter got interrupted" ends up being possibly unpredictable - even with a very stable timer interrupt source - and effectively stand in for a cycle counter even on hardware that doesn't have a native TSC. Lots of possible low-level jitter there to use for entropy. But especially if you're just idly _waiting_ for entropy, you won't be "CPU-bound on an interesting load" - you'll just hit the CPU idle loop all the time so even that wouldn't work. But practically speaking timers really are not really much of an option. And if we are idle, even having a high-frequency TSC isn't all that useful with the timer interrupt, because the two tend to be very intimately related. Of course, if you're generating a host key for SSH or something like that, you could try to at least cause some network traffic while generating the key. That's not much of an option for the _kernel_, but for a program like ssh-keygen it certainly could be. Blocking is fine if you simply don't care about time at all (the "five hours later is fine" situation), or if you have some a-priori knowledge that the machine is doing real interesting work that will generate entropy. But I don't see how the kernel can generate entropy on its own, particularly during boot (which is when the problem happens), when most devices aren't even necessarily meaningfully set up yet. Hopefully hw random number generators will make this issue effectively moot before we really end up having the "nvdimms and their ilk are common enough that you really have no early boot irq-driven disk IO at all". Linus