[OpenWrt-Devel] [PATCH] oxnas: set irq of usb&sata to cpu1

Daniel Golle daniel at makrotopia.org
Sun Nov 22 08:44:31 EST 2015


Hi!

On Sun, Nov 08, 2015 at 04:12:31AM +0800, Shonn Lu wrote:
> Signed-off-by: Shonn Lu <countrysideboy at qq.com>
> ---
>  .../linux/oxnas/base-files/init.d/set-irq-affinity  | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100755 target/linux/oxnas/base-files/init.d/set-irq-affinity
> 
> diff --git a/target/linux/oxnas/base-files/init.d/set-irq-affinity b/target/linux/oxnas/base-files/init.d/set-irq-affinity
> new file mode 100755
> index 0000000..89c1622
> --- /dev/null
> +++ b/target/linux/oxnas/base-files/init.d/set-irq-affinity
> @@ -0,0 +1,21 @@
> +#!/bin/sh /etc/rc.common
> +
> +START=99
> +
> +get_irq() {
> +	local name="$1"
> +	grep -m 1 "$name" /proc/interrupts | cut -d: -f1 | sed 's, *,,'
> +}
> +
> +set_irq_affinity() {
> +	local name="$1"
> +	local val="$2"
> +	local irq="$(get_irq "$name")"
> +	[ -n "$irq" ] || return
> +	echo "$val" > "/proc/irq/$irq/smp_affinity"
> +}
> +
> +start() {
> +	set_irq_affinity sata 2
> +	set_irq_affinity usb 2

please do this instead:
	set_irq_affinity ehci_hcd 2
	set_irq_affinity xhci_hcd 2

or allow multiple matches with grep (see below).

As on the KD-20 there is an additional USB 3.0 controller wired via
PCIe. And that should probably also be bound to CPU1.

root at OpenWrt:/# cat /proc/interrupts
           CPU0       CPU1       
  2:     278514     278506       GIC  29 Edge      twd
  6:       2968          0       GIC  55 Level     serial
  7:      16295        571       GIC  50 Level     45900000.sata
  8:     193006          0       GIC  40 Level     eth0
  9:          0          0       GIC  49 Level     eth0
 10:          0          0       GIC  39 Level     ehci_hcd:usb3
 11:       3136          0       GIC  51 Level     xhci-hcd:usb1
FIQ:              oxnas-fiq
IPI0:          0          1  CPU wakeup interrupts
IPI1:          0          0  Timer broadcast interrupts
IPI2:      49508      45366  Rescheduling interrupts
IPI3:          0          0  Function call interrupts
IPI4:      20917     108103  Single function call interrupts
IPI5:          0          0  CPU stop interrupts
IPI6:          0          0  IRQ work interrupts
IPI7:          0          0  completion interrupts
Err:          0
root at OpenWrt:/# grep -m 1 "usb" /proc/interrupts | cut -d: -f1 | sed 's, *,,'
10
root at OpenWrt:/# grep "usb" /proc/interrupts | cut -d: -f1 | sed 's, *,,'
10
11


Cheers


Daniel
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list