Skip to contentSkip to conversation

Let DAC960 supply entropy to random pool

PATCH In review Anders K. Pedersen 2 participants 5 messages Feb 23, 2006 – Mar 7, 2006 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Let DAC960 supply entropy to random pool

Hello,

We have a couple of servers with Mylex RAID controllers (handled by the DAC960 block device driver). There's normally no keyboard or mouse attached, and neither the DAC960 nor the NIC driver (e100) provides entropy to the random pool, so it was impossible to get any data from /dev/random.

The patch below lets the DAC960 IRQ provide entropy to the random pool, and after applying this (to 2.6.15.4), /dev/random is able to provide data on these servers. I fear, that my mailer may line wrap the patch, so it is also attached to this mail.

block/DAC960.c renamed from block/DAC960.c~ +1 -1
@@ -3024,7 +3024,7 @@ DAC960_DetectController(struct pci_dev *
      Acquire shared access to the IRQ Channel.
   */
   IRQ_Channel = PCI_Device->irq;
-  if (request_irq(IRQ_Channel, InterruptHandler, SA_SHIRQ,
+  if (request_irq(IRQ_Channel, InterruptHandler,

SA_SHIRQ|SA_SAMPLE_RANDOM,
Controller->FullModelName, Controller) < 0)
{
DAC960_Error("Unable to acquire IRQ Channel %d for Controller at\n",

Signature · 4 lines
Med venlig hilsen - Best regards

Anders K. Pedersen
Network Engineer
block/DAC960.c renamed from block/DAC960.c~ +1 -1
@@ -3024,7 +3024,7 @@ DAC960_DetectController(struct pci_dev *
      Acquire shared access to the IRQ Channel.
   */
   IRQ_Channel = PCI_Device->irq;
-  if (request_irq(IRQ_Channel, InterruptHandler, SA_SHIRQ,
+  if (request_irq(IRQ_Channel, InterruptHandler, SA_SHIRQ|SA_SAMPLE_RANDOM,
 		      Controller->FullModelName, Controller) < 0)
   {
 	DAC960_Error("Unable to acquire IRQ Channel %d for Controller at\n",
#1 lore raw
Quoted 7 lines · Anders K. Pedersen

Hello,

We have a couple of servers with Mylex RAID controllers (handled by the DAC960 block device driver). There's normally no keyboard or mouse attached, and neither the DAC960 nor the NIC driver (e100) provides entropy to the random pool, so it was impossible to get any data from /dev/random.

Doesn't the add_disk_randomness call in ll_rw_blk.c suffice? This is the proper path for disks to add entropy.

I intend to kill the SA_SAMPLE_RANDOM path. It's part of a fast path and all of its users are bogus.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#2 lore raw
Quoted 9 lines · Matt Mackall
Quoted 5 lines · Anders K. Pedersen

We have a couple of servers with Mylex RAID controllers (handled by the DAC960 block device driver). There's normally no keyboard or mouse attached, and neither the DAC960 nor the NIC driver (e100) provides entropy to the random pool, so it was impossible to get any data from /dev/random.

Doesn't the add_disk_randomness call in ll_rw_blk.c suffice? This is the proper path for disks to add entropy.

Apparently the add_disk_randomness call in ll_rw_blk.c isn't invoked for my setup. There were absolutely no data available from /dev/random for more than an hour (with heavy disk activity) before applying the dac960.c patch, and after applying it, random data were instantly available.

Signature · 4 lines
Med venlig hilsen - Best regards

Anders K. Pedersen
Network Engineer
#3 lore raw
Quoted 8 lines · Anders K. Pedersen
Quoted 7 lines · Matt Mackall
Quoted 5 lines · Anders K. Pedersen

We have a couple of servers with Mylex RAID controllers (handled by the DAC960 block device driver). There's normally no keyboard or mouse attached, and neither the DAC960 nor the NIC driver (e100) provides entropy to the random pool, so it was impossible to get any data from /dev/random.

Quoted 8 lines
Quoted 2 lines

Doesn't the add_disk_randomness call in ll_rw_blk.c suffice? This is the proper path for disks to add entropy.

Apparently the add_disk_randomness call in ll_rw_blk.c isn't invoked for my setup. There were absolutely no data available from /dev/random for more than an hour (with heavy disk activity) before applying the dac960.c patch, and after applying it, random data were instantly available.

Ok, we probably want this patch. Please test.

Add disk entropy in DAC960 request completions.

drivers/block/DAC960.c +2 -1
Index: 2.6/drivers/block/DAC960.c
===================================================================
@@ -41,6 +41,7 @@
 #include <linux/timer.h>
 #include <linux/pci.h>
 #include <linux/init.h>
+#include <linux/random.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include "DAC960.h"
@@ -3463,7 +3464,7 @@ static inline boolean DAC960_ProcessComp
 		Command->SegmentCount, Command->DmaDirection);
 
 	 if (!end_that_request_first(Request, UpToDate, Command->BlockCount)) {
-
+		add_disk_randomness(Request->rq_disk);
  	 	end_that_request_last(Request, UpToDate);
 
 		if (Command->Completion) {
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#4 lore raw
Quoted 10 lines · Matt Mackall
Quoted 5 lines · Anders K. Pedersen

Apparently the add_disk_randomness call in ll_rw_blk.c isn't invoked for my setup. There were absolutely no data available from /dev/random for more than an hour (with heavy disk activity) before applying the dac960.c patch, and after applying it, random data were instantly available.

Ok, we probably want this patch. Please test.

Add disk entropy in DAC960 request completions.

Adding this patch (and removing mine) also provides random data, so I'm happy with either solution.

Signature · 4 lines
Med venlig hilsen - Best regards

Anders K. Pedersen
Network Engineer