Linux: 中断只被GIC转发到CPU0问题分析

news2024/9/25 3:25:31

文章目录

  • 1. 前言
  • 2. 分析背景
  • 3. 问题
  • 4. 分析
    • 4.1 ARM GIC 中断芯片简介
      • 4.1.1 中断类型和分布
      • 4.1.2 拓扑结构
    • 4.2 问题根因
      • 4.2.1 设置GIC `SPI` 中断CPU亲和性
      • 4.2.2 GIC初始化:缺省的CPU亲和性
        • 4.2.2.1 boot CPU亲和性初始化流程
        • 4.2.2.1 其它非 boot CPU亲和性初始化流程
  • 5. GIC 的救赎?
    • 5.1 默认配置成转发给所有CPU
    • 5.2 用当前 CPU ID 作为 gic_cpu_map[] 索引
  • 6. 一个解决方案:irqbalance
  • 7. 参考资料

1. 前言

限于作者能力水平,本文可能存在谬误,因此而给读者带来的损失,作者不做任何承诺。

2. 分析背景

本文分析基于 linux-4.14.132 内核代码分析,运行环境 Ubuntu 16.04.4 LTS + QEMU + ARM vexpress-a9rootfs 基于 ubuntu-base-16.04-core-armhf.tar.gz 制作。

3. 问题

在使用全志H3机器时,观察到一个现象,外设中断总是集中在 CPU0 处理:

# cat /proc/interrupts
           CPU0       CPU1       CPU2       CPU3
 16:          0          0          0          0     GICv2  25 Level     vgic
 17:          0          0          0          0     GICv2  50 Level     /soc/timer@01c20c00
 18:          0          0          0          0     GICv2  29 Level     arch_timer
 19:       6119       3595       3947       3046     GICv2  30 Level     arch_timer
 20:          0          0          0          0     GICv2  27 Level     kvm guest timer
 22:          0          0          0          0     GICv2 120 Level     1ee0000.hdmi, dw-hdmi-cec
 24:          0          0          0          0     GICv2 118 Level     1c0c000.lcd-controller
 25:          0          0          0          0     GICv2  82 Level     1c02000.dma-controller
 26:         24          0          0          0     GICv2  92 Level     sunxi-mmc
 27:         25          0          0          0     GICv2  93 Level     sunxi-mmc
 28:       2697          0          0          0     GICv2  94 Level     sunxi-mmc
 29:          0          0          0          0     GICv2 103 Level     musb-hdrc.4.auto
 30:          0          0          0          0     GICv2 104 Level     ehci_hcd:usb1
 31:          0          0          0          0     GICv2 105 Level     ohci_hcd:usb2
 32:          0          0          0          0     GICv2 106 Level     ehci_hcd:usb3
 33:          0          0          0          0     GICv2 107 Level     ohci_hcd:usb6
 34:          0          0          0          0     GICv2 108 Level     ehci_hcd:usb4
 35:          0          0          0          0     GICv2 109 Level     ohci_hcd:usb7
 36:          0          0          0          0     GICv2 110 Level     ehci_hcd:usb5
 37:          0          0          0          0     GICv2 111 Level     ohci_hcd:usb8
 40:        205          0          0          0     GICv2  63 Level     1c25000.ths
 42:       1802          0          0          0     GICv2 114 Level     eth0
 43:          0        

我们观察到,除了第6行

 19:       6119       3595       3947       3046     GICv2  30 Level     arch_timer

之外,其它所有的行,CPU1~CPU3 的中断计数都为0。另外,用 QEMU 模拟的 vexpress-a9 板上,也观察到类似的现象:

$ cat /proc/interrupts 
           CPU0       CPU1       CPU2       CPU3       
 16:      69412      69401      69376      69332     GIC-0  29 Level     twd
 17:          6          0          0          0     GIC-0  34 Level     timer
 27:          0          0          0          0     GIC-0  92 Level     arm-pmu
 28:          0          0          0          0     GIC-0  93 Level     arm-pmu
 29:          0          0          0          0     GIC-0  94 Level     arm-pmu
 30:          0          0          0          0     GIC-0  95 Level     arm-pmu
 34:       3521          0          0          0     GIC-0  41 Level     mmci-pl18x (cmd)
 35:     197190          0          0          0     GIC-0  42 Level     mmci-pl18x (pio)
 36:          8          0          0          0     GIC-0  44 Level     kmi-pl050
 37:        100          0          0          0     GIC-0  45 Level     kmi-pl050
 38:         23          0          0          0     GIC-0  37 Level     uart-pl011
 44:          0          0          0          0     GIC-0  36 Level     rtc-pl031
IPI0:          0          1          1          1  CPU wakeup interrupts
IPI1:          0          0          0          0  Timer broadcast interrupts
IPI2:        750       1231       1441        947  Rescheduling interrupts
IPI3:          1          2          3          3  Function call interrupts
IPI4:          0          0          0          0  CPU stop interrupts
IPI5:          0          0          0          0  IRQ work interrupts
IPI6:          0          0          0          0  completion interrupts
Err:          0

4. 分析

4.1 ARM GIC 中断芯片简介

4.1.1 中断类型和分布

我们这里讨论的是 ARM GICv1 芯片,该芯片的中断分为3类:

SGI(Software-generated interrupt):用于处理期之间的通信,编号为 0~15 ;
PPI(Private peripheral interrupt):发送到特定处理器的中断,编号为 16~31 ;
SPI(Shared peripheral interrupt):可以发送给所有处理器的中断,编号为 32~1019 。

注意,每个处理器都有自己的 SGI 和 PPI 中断,它们使用相同的编号。假设系统有4个处理器,则这4个处理器都有自己的16个 SGI 中断和16个 PPI 中断。SPI 中断是全局的、所有处理器共享的。

4.1.2 拓扑结构

ARM GIC 芯片的内部结构如下图:
在这里插入图片描述
GIC 芯片内部包含两大功能模块:DistributorCPU interfaceDistributor 用于将外设投递的中断信号转发给 CPU interface,具体转发给哪些 CPU interface ,可通过寄存器 ICDIPTRn 进行配置,当然,Distributor 也可以禁止外设中断信号的传入。而 CPU interface 用于将接收自 Distributor 的中断信号传递给连接的 CPU, CPU interface 也可以禁止将信号传递给 CPU 。

4.2 问题根因

4.2.1 设置GIC SPI 中断CPU亲和性

从上一小节了解到,具体将中断转发给哪个 CPU 核处理,取决于寄存器 ICDIPTRn 的配置。看一下 GIC 手册对该寄存器的描述:

4.3.11 Interrupt Processor Targets Registers (ICDIPTRn)
       The ICDIPTR characteristics are:
Purpose                     The ICDIPTRs provide an 8-bit CPU targets field for each interrupt supported by
                            the GIC. This field stores the list of processors that the interrupt is sent to if it is
                            asserted.

在这里插入图片描述
准确来讲,这是一个寄存器集,可以按字节访问,每个字节对应一个中断号的 Distributor 转发配置,每个bit对应一个CPU核的配置,最多支持8核。对于 SGIPPI 中断号区间对应的寄存器,它们是每个CPU一份的(上面的引用没有描述),而对于 SPI 中断号区间对应的寄存器,它们的所有CPU共享一份的。GIC 芯片驱动提供接口 gic_set_affinity() 来配置 Distributor ICDIPTRn 寄存器,来决定 Distributor 将中断信号转发给哪个CPU核来处理,来看它的逻辑:

int cpumask_next_and(int n, const struct cpumask *src1p,
		     const struct cpumask *src2p)
{
	while ((n = cpumask_next(n, src1p)) < nr_cpu_ids)
		if (cpumask_test_cpu(n, src2p))
			break;
	return n;
}

/**
 * cpumask_next_and - get the next cpu in *src1p & *src2p
 * @n: the cpu prior to the place to search (ie. return will be > @n)
 * @src1p: the first cpumask pointer
 * @src2p: the second cpumask pointer
 *
 * Returns >= nr_cpu_ids if no further cpus set in both.
 */
int cpumask_next_and(int n, const struct cpumask *src1p,
		     const struct cpumask *src2p)
{
	while ((n = cpumask_next(n, src1p)) < nr_cpu_ids)
		if (cpumask_test_cpu(n, src2p))
			break;
	return n;
}

/**
 * cpumask_first_and - return the first cpu from *srcp1 & *srcp2
 * @src1p: the first input
 * @src2p: the second input
 *
 * Returns >= nr_cpu_ids if no cpus set in both.  See also cpumask_next_and().
 */
#define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p))

/**
 * cpumask_any_and - pick a "random" cpu from *mask1 & *mask2
 * @mask1: the first input cpumask
 * @mask2: the second input cpumask
 *
 * Returns >= nr_cpu_ids if no cpus set.
 */
/* 这个注释里的 "random" 真是个误导,从来也存在什么随机可言 */ 
#define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p))

/**
 * cpumask_first - get the first cpu in a cpumask
 * @srcp: the cpumask pointer
 *
 * Returns >= nr_cpu_ids if no cpus set.
 */
static inline unsigned int cpumask_first(const struct cpumask *srcp)
{
	return find_first_bit(cpumask_bits(srcp), nr_cpumask_bits);
}

static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
			    bool force)
{
	/* 计算中断 @d->hwirq 的 ICDIPTRn 寄存器地址 */
	void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3);
	/* ICDIPTRn 是 32-bit 寄存器,包含4个中断的设置,要计算中断 @d->hwirq 配置域的位偏移 */
	unsigned int cpu, shift = (gic_irq(d) % 4) * 8;
	u32 val, mask, bit;
	unsigned long flags;

	/*
	 * 从 @mask_val 选一个 CPU,然后用它的转发配置来配置对中断 @d->hwirq 的转发。
	 * 这里就是导致 SPI 中断都转发给 CPU0 的根因了。force 可能是 true ,也可能是 
	 * false ,看起来似乎得到的 @cpu 的值会是变化的。
	 * SPI 中断初始化从 request_irq*() 系列调用发起,在过程中会设置 SPI 中断的CPU
	 * 亲和性,传进来的 @mask_val 掩码包含系统所有的 CPU,这样在这里得到的 @cpu 均
	 * 为 0 (假定 CPU0 是 boot CPU,这是通常的情形) !!!
	 * 当然,从 request_percpu_irq() 注册的每 CPU 中断是例外。
	 */
	if (!force)
		cpu = cpumask_any_and(mask_val, cpu_online_mask);
	else
		cpu = cpumask_first(mask_val);

	...

	mask = 0xff << shift;
	/* 
	 * 这个逻辑,说实话,很是违反人类的直觉(至少是我的)。 譬如,用户空间通过指令
	 * echo f > /proc/irq/38/smp_affinity 
	 * 来配置38号中断的 CPU affinity (即 Distributor 转发38号中断给哪些CPU核),
	 * 我理解的是可以将38号中断发送给 CPU0~3 中的任一个来处理。
	 * 但最终发生了什么呢?GIC 驱动代码仅仅是从掩码计算出一个编号 @cpu ,然后以 
	 * @cpu 为索引,取值 @gic_cpu_map[@cpu] 来配置中断 @d->hwirq 的 Distributor 
	 * 的转发配置:发送中断 @d->hwirq 给哪些 CPU !!! 呵呵,完全出乎意料。
	 * 从前面的代码片段了解到,除非特殊配置,索引值 @cpu 总是返回 0,这意味着,驱动
	 * 总是将 SPI 中断的转发配置为固定值 @gic_cpu_map[@cpu] ,也就是 SPI 中断总是
	 * 被某几个或某个CPU核处理,最终结果是 SPI 中断总是被 CPU0 处理。
	 * 从哪里知道固定值 @gic_cpu_map[@cpu] 是固定值,而且是 0x01 这个固定值(假设
	 * boot CPU 是 CPU0)?简略的看后面中断初始化的流程,可以了解这些。
	 */
	bit = gic_cpu_map[cpu] << shift;
	val = readl_relaxed(reg) & ~mask;
	writel_relaxed(val | bit, reg);
	...

	irq_data_update_effective_affinity(d, cpumask_of(cpu));

	return IRQ_SET_MASK_OK_DONE;
}

4.2.2 GIC初始化:缺省的CPU亲和性

4.2.2.1 boot CPU亲和性初始化流程

int __init
gic_of_init(struct device_node *node, struct device_node *parent)
{
	...

	ret = __gic_init_bases(gic, -1, &node->fwnode);

	...
}

static int __init __gic_init_bases(struct gic_chip_data *gic,
				   int irq_start,
				   struct fwnode_handle *handle)
{
	if (gic == &gic_data[0]) { /* ROOT 中断控制器 */
		for (i = 0; i < NR_GIC_CPU_IF; i++)
			gic_cpu_map[i] = 0xff; /* 初始将中断转发给所有 CPU interface 上的 CPU */
		...
		/* 设置非 boot CPU 中断初始化入口 gic_starting_cpu() */
		cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_GIC_STARTING,
					  "irqchip/arm/gic:starting",
					  gic_starting_cpu, NULL);
		set_handle_irq(gic_handle_irq); /* 设置中断 GIC 中断处理入口 */
		...
	}

	...

	ret = gic_init_bases(gic, irq_start, handle);
	ret = gic_cpu_init(gic);
	
	...
}

static int gic_init_bases(struct gic_chip_data *gic, int irq_start,
			  struct fwnode_handle *handle)
{
	...

	cpumask = gic_get_cpumask(gic); /* 读取当前 CPU 的默认中断转发配置 */
	/* 将 gic_get_cpumask() 读回的 8-bit 值复制到 32-bit @cpumask 
	 * 的所有 4个 8-bit 域 */
	cpumask |= cpumask << 8;
	cpumask |= cpumask << 16;
	/* 
	 * 默认的 Distributor 转发配置:只将中断转发给 boot CPU。 
	 * 这是合理的,因为当前处于 boot 阶段,除 boot CPU 外的其它CPU还没有运行起来。
	 */
	for (i = 32; i < gic_irqs; i += 4)
		writel_relaxed(cpumask, base + GIC_DIST_TARGET + i * 4 / 4);
	
	...
}

/* 读取当前 CPU 的默认中断转发配置 */
static u8 gic_get_cpumask(struct gic_chip_data *gic)
{
	/* 
	 * 这里的代码,如果没读过 GIC 手册,是比较难理解的。 
	 * 这里读的是 CPU 私有中断 SGI,PPI 的转发配置值,它们的理所当然的是只会
	 * 转发给对应的 CPU 核,譬如编号为 29 的 PPI 中断:
	 * . CPU0 读到的值就应该是 0xXX_XX_01_XX
	 * . CPU1 读到的值就应该是 0xXX_XX_02_XX
	 * . CPU2 读到的值就应该是 0xXX_XX_04_XX
	 * . CPU3 读到的值就应该是 0xXX_XX_08_XX
	 * 对于 SGI,PPI 这些私有中断,寄存器是多份的(banked register),所以不同的CPU
	 * 在这里读的是自己私有的寄存器;而 SPI 中断的寄存器是全局独一份的。
	 */
	for (i = mask = 0; i < 32; i += 4) {
		/* 
		 * 对于不同的 SPI 中断号,读到值的不为 0 的 8-bit 的位偏移位置不同, 
		 * 后面的移位操作是为了保证将不为 0 的 8-bit 移动到最低 8-bit 。
		 * 为什么?因为返回值类型是 u8 。
		 */
		mask = readl_relaxed(base + GIC_DIST_TARGET + i);
		mask |= mask >> 16;
		mask |= mask >> 8;
		/*
		 * 为什么 @mask 不为 0 就返回了?
		 * 因为只要是同一 CPU 核,只要读到某个 SGI 或 PPI 中断的转发配置值不为0,剩余
		 * 其它 SGI 或 PPI 中断配置值一定是相同的。这里只是要取得当前 CPU 的某个 SGI 
		 * 或 PPI 中断转发配置值就够了。
		 * 那又为什么不直接根据 CPU ID 返回 0x01, 0x02, 0x04, 0x08, ... 这样的值呢?
		 * 因为 SGI 或 PPI 中断转发配置寄存器的值它们是【只读的】,具体的值是由硬件设
		 * 计决定的,有可能 CPU0 读到的值是 0x02 ,因为 GIC 的 CPU interface 0 有可
		 * 能连接到 CPU1 ,这在理论上是可能出现的。
		 */
		if (mask) /* 硬件实现了某 SGI, PPI 中断的映射,即中断转发配置不为0值 */
			break;
	}

	return mask;
}

static int gic_cpu_init(struct gic_chip_data *gic)
{
	if (gic == &gic_data[0]) {
		cpu_mask = gic_get_cpumask(gic);
		gic_cpu_map[cpu] = cpu_mask; /* 当前 CPU @cpu 中断的默认转发配置:只转发给自身 */

		/*
		 * Clear our mask from the other map entries in case they're
		 * still undefined.
		 */
		for (i = 0; i < NR_GIC_CPU_IF; i++)
			if (i != cpu)
				gic_cpu_map[i] &= ~cpu_mask;
	}
	...
}

4.2.2.1 其它非 boot CPU亲和性初始化流程

secondary_start_kernel()
	notify_cpu_starting(cpu)
		struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu);
		enum cpuhp_state target = min((int)st->target, CPUHP_AP_ONLINE);

		...
		while (st->state < target) {
			st->state++;
			ret = cpuhp_invoke_callback(cpu, st->state, true, NULL, NULL);
				...
				gic_starting_cpu(cpu)
		}
		...
static int gic_starting_cpu(unsigned int cpu)
{
	gic_cpu_init(&gic_data[0]); /* 见 4.2.2.1 章节分析 */
	return 0;
}

总结起来就是,在 boot CPU 为 CPU0 的情形下,所有 SPI 中断的 ICDIPTRn 寄存器 都配置为 gic_cpu_map[0] == 0x01 ,即将所有 SPI 中断都转发给 CPU0 处理。SGIPPI 中断不在我们考虑范围之内,因为它们本来就是特定于 CPU 的。

5. GIC 的救赎?

以下测试均基于 QEMU 模拟的 vexpress-a9 开发板 。

5.1 默认配置成转发给所有CPU

这看起来是比较合理的解决方案,对 GIC 驱动的 gic_set_affinity() 接口做如下修改:

- bit = gic_cpu_map[cpu] << shift;
+ bit = 0xff << shift; /* 默认转发给所有的 CPU */

我们来看一下实际效果:

$ cat /proc/interrupts 
           CPU0       CPU1       CPU2       CPU3       
 16:       4558       4548       4578       4505     GIC-0  29 Level     twd
 17:          6          0          0          0     GIC-0  34 Level     timer
 27:          0          0          0          0     GIC-0  92 Level     arm-pmu
 28:          0          0          0          0     GIC-0  93 Level     arm-pmu
 29:          0          0          0          0     GIC-0  94 Level     arm-pmu
 30:          0          0          0          0     GIC-0  95 Level     arm-pmu
 34:       1426       1146       1275       1308     GIC-0  41 Level     mmci-pl18x (cmd)
 35:      81272      78233      77890      78991     GIC-0  42 Level     mmci-pl18x (pio)
 36:          0          0          8          0     GIC-0  44 Level     kmi-pl050
 37:          0          0         99          1     GIC-0  45 Level     kmi-pl050
 38:         18          3          0          2     GIC-0  37 Level     uart-pl011
 44:          0          0          0          0     GIC-0  36 Level     rtc-pl031
IPI0:          0          1          1          1  CPU wakeup interrupts
IPI1:          0          0          0          0  Timer broadcast interrupts
IPI2:        750        501        548        864  Rescheduling interrupts
IPI3:          0          2          2          1  Function call interrupts
IPI4:          0          0          0          0  CPU stop interrupts
IPI5:          0          0          0          0  IRQ work interrupts
IPI6:          0          0          0          0  completion interrupts
Err:          0

看起来不错,SPI 中断的处理,已经散落到各个 CPU 核上了。如果…,但世界上没有如果,由于 GIC 芯片设计的缺陷,当配置多个 CPU 接收中断的时候,所有这些 CPU 核在中断发生时,都来争抢处理进入的中断,当然最终只会有一个CPU获得胜利,其它的核白白的在那里浪费时间。如果某核当前正在睡眠,如执行了 WFI,WFE 指令,就会造成能耗,这在很多设备是电池供电的嵌入式环境下,也是不合适的。看看 Russell King 的解释:

The behaviour of the GIC is as follows. If you set two CPUs in
GICD_ITARGETSRn, then the interrupt will be delivered to _both_ of
those CPUs. Not just one selected at random or determined by some
algorithm, but both CPUs.

Both CPUs get woken up if they're in sleep, and both CPUs attempt to
process the interrupt. One CPU will win the lock, while the other CPU
spins waiting for the lock to process the interrupt.

The winning CPU will process the interrupt, clear it on the device,
release the lock and acknowledge it at the GIC CPU interface.

The CPU that lost the previous race can now proceed to process the
very same interrupt, discovers that it's no longer pending on the
device, and signals IRQ_NONE as it appears to be a spurious interrupt.

The result is that the losing CPU ends up wasting CPU cycles, and
if the losing CPU was in a low power idle state, needlessly wakes up
to process this interrupt.

If you have more CPUs involved, you have more CPUs wasting CPU cycles,
being woken up wasting power - not just occasionally, but almost every
single interrupt that is raised from a device in the system.

On architectures such as x86, the PICs distribute the interrupts in
hardware amongst the CPUs. So if a single interrupt is set to be sent
to multiple CPUs, only _one_ of the CPUs is actually interrupted.
Hence, x86 can have multiple CPUs selected as a destination, and
the hardware delivers the interrupt across all CPUs.

On ARM, we don't have that. We have a thundering herd of CPUs if we
set more than one CPU to process the interrupt, which is grossly
inefficient.

原文见此处。

5.2 用当前 CPU ID 作为 gic_cpu_map[] 索引

对 GIC 驱动的 gic_set_affinity() 接口做如下修改:

- if (!force)
-	cpu = cpumask_any_and(mask_val, cpu_online_mask);
- else
-	cpu = cpumask_first(mask_val);
+ cpu = smp_processor_id();

当前 CPU ID 作为数组 gic_cpu_map[] 的索引,这样 SPI 中断不会集中到 CPU0 上。看一下实际效果:

$ cat /proc/interrupts 
           CPU0       CPU1       CPU2       CPU3       
 16:       7626       7583       7531       7495     GIC-0  29 Level     twd
 17:          6          0          0          0     GIC-0  34 Level     timer
 27:          0          0          0          0     GIC-0  92 Level     arm-pmu
 28:          0          0          0          0     GIC-0  93 Level     arm-pmu
 29:          0          0          0          0     GIC-0  94 Level     arm-pmu
 30:          0          0          0          0     GIC-0  95 Level     arm-pmu
 34:          0          0          0       2912     GIC-0  41 Level     mmci-pl18x (cmd)
 35:          0          0          0     204459     GIC-0  42 Level     mmci-pl18x (pio)
 36:          0          0          0          8     GIC-0  44 Level     kmi-pl050
 37:          0          0          0        100     GIC-0  45 Level     kmi-pl050
 38:         23          0          0          0     GIC-0  37 Level     uart-pl011
 44:          0          0          0          0     GIC-0  36 Level     rtc-pl031
IPI0:          0          1          1          1  CPU wakeup interrupts
IPI1:          0          0          0          0  Timer broadcast interrupts
IPI2:       1423       1288       1527        360  Rescheduling interrupts
IPI3:          1          2          2          1  Function call interrupts
IPI4:          0          0          0          0  CPU stop interrupts
IPI5:          0          0          0          0  IRQ work interrupts
IPI6:          0          0          0          0  completion interrupts
Err:          0

SPI 中断集中在 CPU0,CPU3 两个核上处理,但至少不会集中在同一个核上了。一个改进思路是记录每个核上当前转发的 SPI 个数,然后将它们均匀的散落到各个核上,这其实有点类似于我们后面即将提到的 irqbalance 了。但这并不值得提倡,因为这意味将机制实现在内核中,限制了用户空间的灵活性,内核应该只提供策略,而实现留给用户空间。

6. 一个解决方案:irqbalance

使用 irqbalance 是一个常见的解决方案,它的实现时监控 CPU 上的中断处理状况,通过 /proc/irq/N/smp_affinity/proc/irq/N/smp_affinity_list 对中断进行显式配置,让它们均匀的散落到各个 CPU 上去。
irqbalance 是完美的吗?由于可能会经常的改变中断转发的 CPU,所以也会影响到数据访问的本地 cache 命中率,在网络场景下,可能对性能造成损害。世界就是这样,总是这么复杂,没有什么是完美无缺的。

7. 参考资料

《IHI0048A_gic_architecture_spec_v1_0.pdf》
《DDI0471A_gic400_r0p0_trm.pdf》

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/382572.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【蓝桥杯入门不入土】变幻莫测的链表

文章目录一&#xff1a;链表的类型单链表双链表循环链表二&#xff1a;链表的存储方式三&#xff1a;链表的定义删除节点添加节点四&#xff1a;实战练习1.设计链表2. 移除链表元素最后说一句一&#xff1a;链表的类型 单链表 什么是链表&#xff0c;链表是一种通过指针串联在…

最经典的黑客技术入门知识大全

第一节、什么是黑客 以我的理解&#xff0c;“黑客”大体上应该分为“正”、“邪”两类&#xff0c;正派黑客依靠自己掌握的知识帮助系统管理员找出系统中的漏洞并加以完善&#xff0c;而邪派黑客则是通过各种黑客技能对系统进行攻击、入侵或者做其他一些有害于网络的事情&…

LCR数字电桥软件下载安装教程

软件&#xff1a;LCR数字电桥软件NS-LCR 语言&#xff1a;简体中文 环境&#xff1a;NI-VISA 安装环境&#xff1a;Win10以上版本&#xff08;特殊需求请后台私信联系客服&#xff09; 硬件要求&#xff1a;CPU2GHz 内存4G(或更高&#xff09;硬盘500G(或更高&#xff09; …

ProcDump+Mimikatz绕过杀毒软件抓密码

抓密码的奇淫技巧背景1、原理2、实操演示背景 如果主机上装了杀毒软件&#xff0c;开了防火墙&#xff0c;例如&#xff1a;360、火绒之类的话。Mimikatz就会被检测为病毒&#xff0c;无法使用&#xff0c;而想要对Mimikatz进行二次开发或者免杀难度会比较大&#xff0c;那有办…

边缘计算开源项目解读——kubeedge mappers实现

0 背景 本文重点解读kubeedge项目中的mapper模块。该模块位于kubeedge的edgecore的南向边缘侧&#xff0c;主要对接入kubeedge的终端设备&#xff0c;进行协议的适配和转换&#xff0c;使其可以和边缘设备通信&#xff0c;转换后的协议是我们前面描述的mqtt协议&#xff0c;当然…

玩转ThreadLocal

前言 ThreadLocal想必都不陌生&#xff0c;当多线程访问同一个共享变量时&#xff0c;就容易出现并发问题&#xff0c;为了保证线程安全&#xff0c;我们需要对共享变量进行同步加锁&#xff0c;但这又带来了性能消耗以及使用者的负担&#xff0c;那么有没有可能当我们创建一个…

只知道删除单张表的数据?不知道删除多张表的数据?

一些废话 可能在某某一天&#xff0c;你在表删除表数据的时候&#xff0c;不想一张表一张表的去删除&#xff0c;想把两个表的数据同时删除&#xff1b;然后你就会去搜索&#xff0c;然后你就很有很有很有很有可能会看到 me 的这篇优质&#xff08;呸&#xff01;&#xff01;…

HOT100--(5)最长回文子串

点击查看题目详情 中心扩散法 思路&#xff1a; 遍历字符串&#xff0c;以每个字符为中心点向两边扩散&#xff0c;如果遇到不一样的就跳出循环。以此类推&#xff0c;最后截取最大回文串返回。 细节 字符个数不一定都是奇数。当个数是偶数的是时候&#xff0c;我们可以“忽…

学习红客技术必备,手把手教你成为“安防第一人”

互联网时代已悄悄来临&#xff0c;作为新时代的人们&#xff0c;我们日常生活、工作、学习方面都需要借助互联网来完成&#xff0c;这样&#xff0c;又产生一种新的问题&#xff0c;那就是网络安全的问题&#xff0c;有时我们拼命加班好不容易完成的东西&#xff0c;在一夜之间…

优化Linux系统性能的必杀技:调整进程优先级!学会使用nice命令,让你的系统飞一般的顺畅!

文章目录前言一. nice命令介绍1.1 nice的介绍1.2 cpu资源的调度1.3 nice是控制内核吗&#xff1f;二. 语法格式及常用选项三. 参考案例3.1 将ls命令的优先级调整为最高3.2 将 find 命令的优先级调整为最低3.3 如何查看nice值四. nice和renice的区别总结前言 大家好&#xff0c…

Zookeeper的安装

目录 Zookeeper的安装 1、环境准备 2、上传 3、解压文件到opt/zookeeper目下 4、安装完后进入zookeeper&#xff0c;找到conf目录 5、复制zoo_sample.cfg 6、编辑zoo.cfg 7、复制一份会话&#xff0c;进入zookeeper安装目录&#xff0c;创建一个文件夹zkdata&#xff0…

Linux·DMA 与零拷贝技术

DMA 与零拷贝技术注意事项&#xff1a;除了 Direct I/O&#xff0c;与磁盘相关的文件读写操作都有使用到 page cache 技术。1. 数据的四次拷贝与四次上下文切换很多应用程序在面临客户端请求时&#xff0c;可以等价为进行如下的系统调用&#xff1a;File.read(file, buf, len);…

NOC2021年测试卷3

1. 角色初始位置坐标是(0,0),执行下面程序后,角色会出现在什么位置上?( ) A. x坐标为10,y坐标为50B. x坐标为40,y坐标为50C. x坐标为50,y坐标为40D. x坐标为30,y坐标为502. 执行下面程序后,按一次→键,兔子会?() A. 向右移动10步B. 向左移动10步C. 向上移动…

入职外包三个月,我提桶跑路了

有一种打工人的羡慕&#xff0c;叫做“大厂”。 真是年少不知大厂香&#xff0c;错把青春插稻秧。 但是&#xff0c;在深圳有一群比大厂员工更庞大的群体&#xff0c;他们顶着大厂的“名”&#xff0c;做着大厂的工作&#xff0c;还可以享受大厂的伙食&#xff0c;却没有大厂…

基于龙芯+国产FPGA 的VPX以太网交换板设计(一)

“棱镜门”的曝光&#xff0c;暴露出我国的信息安全存在极大的安全隐患&#xff0c;作为信息传输 载体的网络设备&#xff0c;其国产化需求迫切&#xff0c;国产处理器、国产可编程逻辑器件、以太网交 换芯片等具有良好的应用前景&#xff0c;另一方面&#xff0c;宽带数据业务…

Java 对象深拷贝

需求 写一个java对象深拷贝工具&#xff0c;用以对象深拷贝。 分析 在 Java 中&#xff0c;变量间值的传递分为两种。对于 int,char,string,等基本数据类型进行值传递时&#xff0c;使用值传递。即原变量 a 的值与新变量 b 的值相等&#xff0c;且 a 与 b 拥有不同的内存地址…

HTML认知

HTML认知 文章目录HTML认知语法规范注释标签组成和关系标签的关系标签学习排版系列标签**标题标签****段落标签**换行标签水平线标签文本格式化标签媒体标签图片标签src 目标图片的路径alt 替换文本title 图片的标题width 宽度 / height 高度路径绝对路径相对路径&#xff08;常…

win10搭建android monkeyrunner自动化测试环境

本文记录一下monkeyrunner环境搭建遇到的各种坑&#xff0c;以免以后再次踩坑。首先要提一下巨坑&#xff0c;务必要安装java 8&#xff08;本文记录于2023.3&#xff09;&#xff0c;安装其他版本java&#xff0c;运行monneyrunner会有很多问题&#xff0c;见第七节。 一、安…

Threejs 教程1

threejs核心概念场景、照相机、对象、光、渲染器等1.1.场景Scene 场景是所有物体的容器&#xff0c;对应着显示生活中的三维世界&#xff0c;所有的可视化对象级相关的动作均发生在场景中。1.2.照相机Camera照相机是三维世界中的观察者&#xff0c;类似与眼睛。为了观察这个世界…

5款软件压力测试工具分享

一、什么是软件压力测试? 软件压力测试是一种基本的质量保证行为&#xff0c;它是每个重要软件测试工作的一部分。软件压力测试的基本思路很简单&#xff1a;不是在常规条件下运行手动或自动测试&#xff0c;而是在计算机数量较少或系统资源匮乏的条件下运行测试。通常要进行…