genirq: Add the entropy pool function to the PPI interrupt handler
PATCH 1/1 genirq: Add the entropy pool function to the PPI interrupt handler
Accelerate the entropy pool initialization process
--- kernel/irq/chip.c | 1 + 1 file changed, 1 insertion(+)
kernel/irq/chip.c +1 -0
@@ -926,6 +926,7 @@ void handle_percpu_devid_irq(struct irq_desc *desc)trace_irq_handler_entry (irq, action); res = action->handler (irq,raw_cpu_ptr (action->percpu_dev_id));trace_irq_handler_exit (irq, action, res); +add_interrupt_randomness (irq); }else {bool enabled =cpumask_test_cpu (cpu, desc->percpu_enabled);
Signature · 1 line
2.39.5
Quoted 1 line · Enlin Mu
Accelerate the entropy pool initialization process
How? Please explain.
Quoted 10 lines
Signed-off-by Enlin Mu <[email protected]>--- kernel/irq/chip.c | 1 + 1 file changed, 1 insertion(+)kernel/irq/chip.c +0
-0
kernel/irq/chip.c void handle_percpu_devid_irq(struct irq_desc *desc) · line 929
Quoted 4 lines
kernel/irq/chip.c +1
-0@@ -926,6 +926,7 @@ void handle_percpu_devid_irq(struct irq_desc *desc)trace_irq_handler_entry (irq, action); res = action->handler (irq,raw_cpu_ptr (action->percpu_dev_id));trace_irq_handler_exit (irq, action, res); +add_interrupt_randomness (irq);
Are you sure this does anything measurable?
thanks,
greg k-h
Hi KH
hardware: raspberrypi 5
other patch(These two locations impact the entropy pool acceleration. comment them out temporarily):
acer@raspberrypi:linux $ git diff drivers/of/fdt.c drivers/char/hw_random/iproc-rng200.c
drivers/char/hw_random/iproc-rng200.c +4 -4
@@ -296,10 +296,10 @@ static const struct dev_pm_ops iproc_rng200_pm_ops = { };static const struct of_device_id iproc_rng200_of_match[] = { - { .compatible ="brcm,bcm2711-rng200" , }, - { .compatible ="brcm,bcm7211-rng200" , }, - { .compatible ="brcm,bcm7278-rng200" , }, - { .compatible ="brcm,iproc-rng200" , }, + { .compatible ="brcm,bcm2711-rng2000" , }, + { .compatible ="brcm,bcm7211-rng2000" , }, + { .compatible ="brcm,bcm7278-rng2000" , }, + { .compatible ="brcm,iproc-rng2000" , }, {}, };MODULE_DEVICE_TABLE (of, iproc_rng200_of_match);
drivers/of/fdt.c +1 -1
@@ -1100,7 +1100,7 @@ int __init early_init_dt_scan_chosen(char *cmdline) rng_seed =of_get_flat_dt_prop (node,"rng-seed" , &l);if (rng_seed && l >0 ) { -add_bootloader_randomness (rng_seed, l); +//add_bootloader_randomness(rng_seed, l); /* try to clear seed so it won't be found. */ fdt_nop_property (initial_boot_params, node,"rng-seed" );
acer@raspberrypi:linux $
Before testing:
acer@raspberrypi:linux $ dmesg | grep rng
[ 3.360898] random: crng init done
After testing:
acer@raspberrypi:~ $ dmesg | grep rng
[ 2.808880] random: crng init done
Quoted 25 lines · Greg KH
Quoted 1 line · Enlin Mu
Accelerate the entropy pool initialization process
How? Please explain.
Quoted 10 lines
Signed-off-by Enlin Mu <[email protected]>--- kernel/irq/chip.c | 1 + 1 file changed, 1 insertion(+)kernel/irq/chip.c +0
-0kernel/irq/chip.c void handle_percpu_devid_irq(struct irq_desc *desc) · line 929
Quoted 4 lines
kernel/irq/chip.c +1
-0@@ -926,6 +926,7 @@ void handle_percpu_devid_irq(struct irq_desc *desc)trace_irq_handler_entry (irq, action); res = action->handler (irq,raw_cpu_ptr (action->percpu_dev_id));trace_irq_handler_exit (irq, action, res); +add_interrupt_randomness (irq);Are you sure this does anything measurable?
thanks,
greg k-h
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
A: No.
Q: Should I include quotations after my reply?
http://daringfireball.net/2007/07/on_top
Quoted 15 lines · enlin.mu
Hi KH
hardware: raspberrypi 5
other patch(These two locations impact the entropy pool acceleration. comment them out temporarily):
acer@raspberrypi:linux $ git diffdrivers/of/fdt.cdrivers/char/hw_random/iproc-rng200.cdrivers/char/hw_random/iproc-rng200.c +0
-0@@ -296,10 +296,10 @@ static const struct dev_pm_ops iproc_rng200_pm_ops = { };
drivers/char/hw_random/iproc-rng200.c static const struct dev_pm_ops iproc_rng200_pm_ops = { · line 302
Quoted 10 lines
drivers/char/hw_random/iproc-rng200.c +4
-4static const struct of_device_id iproc_rng200_of_match[] = { - { .compatible ="brcm,bcm2711-rng200" , }, - { .compatible ="brcm,bcm7211-rng200" , }, - { .compatible ="brcm,bcm7278-rng200" , }, - { .compatible ="brcm,iproc-rng200" , }, + { .compatible ="brcm,bcm2711-rng2000" , }, + { .compatible ="brcm,bcm7211-rng2000" , }, + { .compatible ="brcm,bcm7278-rng2000" , }, + { .compatible ="brcm,iproc-rng2000" , },
What is this change for?
drivers/of/fdt.c int __init early_init_dt_scan_chosen(char *cmdline) · line 1103
Quoted 13 lines
drivers/char/hw_random/iproc-rng200.c +0
-0{}, };MODULE_DEVICE_TABLE (of, iproc_rng200_of_match);drivers/of/fdt.c +1
-1@@ -1100,7 +1100,7 @@ int __init early_init_dt_scan_chosen(char *cmdline) rng_seed =of_get_flat_dt_prop (node,"rng-seed" , &l);if (rng_seed && l >0 ) { -add_bootloader_randomness (rng_seed, l); +//add_bootloader_randomness(rng_seed, l);
Why did you comment this out?
Quoted 5 lines
drivers/of/fdt.c +0
-0/* try to clear seed so it won't be found. */ fdt_nop_property (initial_boot_params, node,"rng-seed" );acer@raspberrypi:linux $
Quoted 8 lines
Before testing:
acer@raspberrypi:linux $ dmesg | grep rng[ 3.360898] random: crng init doneAfter testing:
acer@raspberrypi:~ $ dmesg | grep rng[ 2.808880] random: crng init done
I think people have talked about irq "randomness" lots of time in the past, you need to provide lots of real documentation about why this time it is somehow "different".
thanks,
greg k-h
Quoted 29 lines · Greg KH
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?A: No.
Q: Should I include quotations after my reply?http://daringfireball.net/2007/07/on_top
Quoted 16 lines · enlin.mu
Hi KH
hardware: raspberrypi 5
other patch(These two locations impact the entropy pool acceleration. comment them out temporarily):
acer@raspberrypi:linux $ git diffdrivers/of/fdt.cdrivers/char/hw_random/iproc-rng200.cdrivers/char/hw_random/iproc-rng200.c +0
-0@@ -296,10 +296,10 @@ static const struct dev_pm_ops iproc_rng200_pm_ops = { };
Quoted 11 lines
drivers/char/hw_random/iproc-rng200.c static const struct dev_pm_ops iproc_rng200_pm_ops = { · line 302
Quoted 9 lines
drivers/char/hw_random/iproc-rng200.c +4
-4static const struct of_device_id iproc_rng200_of_match[] = { - { .compatible ="brcm,bcm2711-rng200" , }, - { .compatible ="brcm,bcm7211-rng200" , }, - { .compatible ="brcm,bcm7278-rng200" , }, - { .compatible ="brcm,iproc-rng200" , }, + { .compatible ="brcm,bcm2711-rng2000" , }, + { .compatible ="brcm,bcm7211-rng2000" , }, + { .compatible ="brcm,bcm7278-rng2000" , }, + { .compatible ="brcm,iproc-rng2000" , },What is this change for?
This driver accelerates the initialization of the entropy pool. If this dirver is added, the optimization effect of my patch will no longer be clearly observable.
Quoted 11 lines
Quoted 11 lines
drivers/char/hw_random/iproc-rng200.c +0
-0{}, };MODULE_DEVICE_TABLE (of, iproc_rng200_of_match);drivers/of/fdt.c +0
-0@@ -1100,7 +1100,7 @@ int __init early_init_dt_scan_chosen(char *cmdline)
Quoted 6 lines
drivers/of/fdt.c int __init early_init_dt_scan_chosen(char *cmdline) · line 1103
Quoted 4 lines
drivers/of/fdt.c +1
-1rng_seed =of_get_flat_dt_prop (node,"rng-seed" , &l);if (rng_seed && l >0 ) { -add_bootloader_randomness (rng_seed, l); +//add_bootloader_randomness(rng_seed, l); Why did you comment this out?
Before the kernel boots, the Raspberry Pi bootloader injects the rng-seed property into the kernel's Device Tree to accelerate entropy pool initialization. Therefore, I need to temporarily comment this out
to avoid interfering with the testing of my current patch.
Quoted 12 lines
Quoted 12 lines
drivers/of/fdt.c +0
-0/* try to clear seed so it won't be found. */ fdt_nop_property (initial_boot_params, node,"rng-seed" );acer@raspberrypi:linux $
Before testing:
acer@raspberrypi:linux $ dmesg | grep rng[ 3.360898] random: crng init done
Quoted 7 lines
Quoted 3 lines
After testing:
acer@raspberrypi:~ $ dmesg | grep rng[ 2.808880] random: crng init doneI think people have talked about irq "randomness" lots of time in the past, you need to provide lots of real documentation about why this time it is somehow "different".
The test results shown above are just from a single run. Based on multipe test runs, the overall performance gain is approximately 0.3 to 0.5 seconds.
Quoted 4 lines
thanks,
greg k-h
Quoted 43 lines · enlin.mu
Quoted 29 lines · Greg KH
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?A: No.
Q: Should I include quotations after my reply?http://daringfireball.net/2007/07/on_top
Quoted 16 lines · enlin.mu
Hi KH
hardware: raspberrypi 5
other patch(These two locations impact the entropy pool acceleration. comment them out temporarily):
acer@raspberrypi:linux $ git diffdrivers/of/fdt.cdrivers/char/hw_random/iproc-rng200.cdrivers/char/hw_random/iproc-rng200.c +0
-0@@ -296,10 +296,10 @@ static const struct dev_pm_ops iproc_rng200_pm_ops = { };Quoted 11 lines
drivers/char/hw_random/iproc-rng200.c static const struct dev_pm_ops iproc_rng200_pm_ops = { · line 302
Quoted 9 lines
drivers/char/hw_random/iproc-rng200.c +4
-4static const struct of_device_id iproc_rng200_of_match[] = { - { .compatible ="brcm,bcm2711-rng200" , }, - { .compatible ="brcm,bcm7211-rng200" , }, - { .compatible ="brcm,bcm7278-rng200" , }, - { .compatible ="brcm,iproc-rng200" , }, + { .compatible ="brcm,bcm2711-rng2000" , }, + { .compatible ="brcm,bcm7211-rng2000" , }, + { .compatible ="brcm,bcm7278-rng2000" , }, + { .compatible ="brcm,iproc-rng2000" , },What is this change for?
Quoted 3 lines
This driver accelerates the initialization of the entropy pool. If this dirver is added, the optimization effect of my patch will no longer be clearly observable.
Great, obviously your patch is not needed!
Quoted 18 lines
Quoted 12 lines
Quoted 12 lines
drivers/char/hw_random/iproc-rng200.c +0
-0{}, };MODULE_DEVICE_TABLE (of, iproc_rng200_of_match);drivers/of/fdt.c +0
-0@@ -1100,7 +1100,7 @@ int __init early_init_dt_scan_chosen(char *cmdline)Quoted 6 lines
drivers/of/fdt.c int __init early_init_dt_scan_chosen(char *cmdline) · line 1103
Quoted 4 lines
drivers/of/fdt.c +1
-1rng_seed =of_get_flat_dt_prop (node,"rng-seed" , &l);if (rng_seed && l >0 ) { -add_bootloader_randomness (rng_seed, l); +//add_bootloader_randomness(rng_seed, l); Why did you comment this out?
Quoted 4 lines
Before the kernel boots, the Raspberry Pi bootloader injects the rng-seed property into the kernel's Device Tree to accelerate entropy pool initialization. Therefore, I need to temporarily comment this out to avoid interfering with the testing of my current patch.
Again, that seems like the correct fix, don't change the common code path of all systems just because you don't want to accept the changes that have already been made for your platform to resolve this very issue!
thanks,
greg k-h
Quoted 73 lines · Greg KH
Quoted 43 lines · enlin.mu
Quoted 29 lines · Greg KH
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?A: No.
Q: Should I include quotations after my reply?http://daringfireball.net/2007/07/on_top
Quoted 16 lines · enlin.mu
Hi KH
hardware: raspberrypi 5
other patch(These two locations impact the entropy pool acceleration. comment them out temporarily):
acer@raspberrypi:linux $ git diffdrivers/of/fdt.cdrivers/char/hw_random/iproc-rng200.cdrivers/char/hw_random/iproc-rng200.c +0
-0@@ -296,10 +296,10 @@ static const struct dev_pm_ops iproc_rng200_pm_ops = { };Quoted 11 lines
drivers/char/hw_random/iproc-rng200.c static const struct dev_pm_ops iproc_rng200_pm_ops = { · line 302
Quoted 9 lines
drivers/char/hw_random/iproc-rng200.c +4
-4static const struct of_device_id iproc_rng200_of_match[] = { - { .compatible ="brcm,bcm2711-rng200" , }, - { .compatible ="brcm,bcm7211-rng200" , }, - { .compatible ="brcm,bcm7278-rng200" , }, - { .compatible ="brcm,iproc-rng200" , }, + { .compatible ="brcm,bcm2711-rng2000" , }, + { .compatible ="brcm,bcm7211-rng2000" , }, + { .compatible ="brcm,bcm7278-rng2000" , }, + { .compatible ="brcm,iproc-rng2000" , },What is this change for?
Quoted 3 lines
This driver accelerates the initialization of the entropy pool. If this dirver is added, the optimization effect of my patch will no longer be clearly observable.
Great, obviously your patch is not needed!
Quoted 18 lines
Quoted 12 lines
Quoted 12 lines
drivers/char/hw_random/iproc-rng200.c +0
-0{}, };MODULE_DEVICE_TABLE (of, iproc_rng200_of_match);drivers/of/fdt.c +0
-0@@ -1100,7 +1100,7 @@ int __init early_init_dt_scan_chosen(char *cmdline)Quoted 6 lines
drivers/of/fdt.c int __init early_init_dt_scan_chosen(char *cmdline) · line 1103
Quoted 4 lines
drivers/of/fdt.c +1
-1rng_seed =of_get_flat_dt_prop (node,"rng-seed" , &l);if (rng_seed && l >0 ) { -add_bootloader_randomness (rng_seed, l); +//add_bootloader_randomness(rng_seed, l); Why did you comment this out?
Quoted 4 lines
Before the kernel boots, the Raspberry Pi bootloader injects the rng-seed property into the kernel's Device Tree to accelerate entropy pool initialization. Therefore, I need to temporarily comment this out to avoid interfering with the testing of my current patch.
Quoted 4 lines
Again, that seems like the correct fix, don't change the common code path of all systems just because you don't want to accept the changes that have already been made for your platform to resolve this very issue!
I think there might be a misunderstanding. The code below adds entropy pool initialization, but this logic is missing in the PPI interrupt handler. I believe this was simply an accidental omission.
---------------------------irqreturn_t handle_irq_event_percpu(struct irq_desc *desc)
{
irqreturn_t retval;
retval = __handle_irq_event_percpu(desc);
add_interrupt_randomness(desc->irq_data.irq);
if (!irq_settings_no_debug(desc))
note_interrupt(desc, retval);
return retval;
}Quoted 4 lines
thanks,
greg k-h
Quoted 86 lines · enlin.mu
Quoted 73 lines · Greg KH
Quoted 43 lines · enlin.mu
Quoted 29 lines · Greg KH
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?A: No.
Q: Should I include quotations after my reply?http://daringfireball.net/2007/07/on_top
Quoted 16 lines · enlin.mu
Hi KH
hardware: raspberrypi 5
other patch(These two locations impact the entropy pool acceleration. comment them out temporarily):
acer@raspberrypi:linux $ git diffdrivers/of/fdt.cdrivers/char/hw_random/iproc-rng200.cdrivers/char/hw_random/iproc-rng200.c +0
-0@@ -296,10 +296,10 @@ static const struct dev_pm_ops iproc_rng200_pm_ops = { };Quoted 11 lines
drivers/char/hw_random/iproc-rng200.c static const struct dev_pm_ops iproc_rng200_pm_ops = { · line 302
Quoted 9 lines
drivers/char/hw_random/iproc-rng200.c +4
-4static const struct of_device_id iproc_rng200_of_match[] = { - { .compatible ="brcm,bcm2711-rng200" , }, - { .compatible ="brcm,bcm7211-rng200" , }, - { .compatible ="brcm,bcm7278-rng200" , }, - { .compatible ="brcm,iproc-rng200" , }, + { .compatible ="brcm,bcm2711-rng2000" , }, + { .compatible ="brcm,bcm7211-rng2000" , }, + { .compatible ="brcm,bcm7278-rng2000" , }, + { .compatible ="brcm,iproc-rng2000" , },What is this change for?
Quoted 3 lines
This driver accelerates the initialization of the entropy pool. If this dirver is added, the optimization effect of my patch will no longer be clearly observable.
Great, obviously your patch is not needed!
Quoted 18 lines
Quoted 12 lines
Quoted 12 lines
drivers/char/hw_random/iproc-rng200.c +0
-0{}, };MODULE_DEVICE_TABLE (of, iproc_rng200_of_match);drivers/of/fdt.c +0
-0@@ -1100,7 +1100,7 @@ int __init early_init_dt_scan_chosen(char *cmdline)Quoted 6 lines
drivers/of/fdt.c int __init early_init_dt_scan_chosen(char *cmdline) · line 1103
Quoted 4 lines
drivers/of/fdt.c +1
-1rng_seed =of_get_flat_dt_prop (node,"rng-seed" , &l);if (rng_seed && l >0 ) { -add_bootloader_randomness (rng_seed, l); +//add_bootloader_randomness(rng_seed, l); Why did you comment this out?
Quoted 4 lines
Before the kernel boots, the Raspberry Pi bootloader injects the rng-seed property into the kernel's Device Tree to accelerate entropy pool initialization. Therefore, I need to temporarily comment this out to avoid interfering with the testing of my current patch.
Quoted 4 lines
Again, that seems like the correct fix, don't change the common code path of all systems just because you don't want to accept the changes that have already been made for your platform to resolve this very issue!
I think there might be a misunderstanding. The code below adds entropy pool initialization, but this logic is missing in the PPI interrupt handler. I believe this was simply an accidental omission.
---------------------------irqreturn_thandle_irq_event_percpu(struct irq_desc *desc)
Quoted 10 lines
{
irqreturn_t retval;
retval = __handle_irq_event_percpu(desc);
add_interrupt_randomness(desc->irq_data.irq);
if (!irq_settings_no_debug(desc))
note_interrupt(desc, retval);
return retval;Look back at your original patch. It contained none of this information...
Quoted 92 lines · Greg KH
Quoted 91 lines · enlin.mu
Quoted 73 lines · Greg KH
Quoted 43 lines · enlin.mu
Quoted 29 lines · Greg KH
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?A: No.
Q: Should I include quotations after my reply?http://daringfireball.net/2007/07/on_top
Quoted 16 lines · enlin.mu
Hi KH
hardware: raspberrypi 5
other patch(These two locations impact the entropy pool acceleration. comment them out temporarily):
acer@raspberrypi:linux $ git diffdrivers/of/fdt.cdrivers/char/hw_random/iproc-rng200.cdrivers/char/hw_random/iproc-rng200.c +0
-0@@ -296,10 +296,10 @@ static const struct dev_pm_ops iproc_rng200_pm_ops = { };Quoted 11 lines
drivers/char/hw_random/iproc-rng200.c static const struct dev_pm_ops iproc_rng200_pm_ops = { · line 302
Quoted 9 lines
drivers/char/hw_random/iproc-rng200.c +4
-4static const struct of_device_id iproc_rng200_of_match[] = { - { .compatible ="brcm,bcm2711-rng200" , }, - { .compatible ="brcm,bcm7211-rng200" , }, - { .compatible ="brcm,bcm7278-rng200" , }, - { .compatible ="brcm,iproc-rng200" , }, + { .compatible ="brcm,bcm2711-rng2000" , }, + { .compatible ="brcm,bcm7211-rng2000" , }, + { .compatible ="brcm,bcm7278-rng2000" , }, + { .compatible ="brcm,iproc-rng2000" , },What is this change for?
Quoted 3 lines
This driver accelerates the initialization of the entropy pool. If this dirver is added, the optimization effect of my patch will no longer be clearly observable.
Great, obviously your patch is not needed!
Quoted 18 lines
Quoted 12 lines
Quoted 12 lines
drivers/char/hw_random/iproc-rng200.c +0
-0{}, };MODULE_DEVICE_TABLE (of, iproc_rng200_of_match);drivers/of/fdt.c +0
-0@@ -1100,7 +1100,7 @@ int __init early_init_dt_scan_chosen(char *cmdline)Quoted 6 lines
drivers/of/fdt.c int __init early_init_dt_scan_chosen(char *cmdline) · line 1103
Quoted 4 lines
drivers/of/fdt.c +1
-1rng_seed =of_get_flat_dt_prop (node,"rng-seed" , &l);if (rng_seed && l >0 ) { -add_bootloader_randomness (rng_seed, l); +//add_bootloader_randomness(rng_seed, l); Why did you comment this out?
Quoted 4 lines
Before the kernel boots, the Raspberry Pi bootloader injects the rng-seed property into the kernel's Device Tree to accelerate entropy pool initialization. Therefore, I need to temporarily comment this out to avoid interfering with the testing of my current patch.
Quoted 4 lines
Again, that seems like the correct fix, don't change the common code path of all systems just because you don't want to accept the changes that have already been made for your platform to resolve this very issue!
I think there might be a misunderstanding. The code below adds entropy pool initialization, but this logic is missing in the PPI interrupt handler. I believe this was simply an accidental omission.
---------------------------irqreturn_thandle_irq_event_percpu(struct irq_desc *desc){ irqreturn_t retval; retval = __handle_irq_event_percpu(desc);
Quoted 8 lines
Quoted 5 lines
add_interrupt_randomness(desc->irq_data.irq); if (!irq_settings_no_debug(desc)) note_interrupt(desc, retval); return retval;Look back at your original patch. It contained none of this information...
My apologies. I mistakenly assumed the context was obvious, but I realize now that it should have been explicitly documented in the original patch. I will send a v2 patch immediately with all this information added to the commit message.