当前位置: 首页 > news >正文

如何用div和css做购物网站seo网站快速排名外包

如何用div和css做购物网站,seo网站快速排名外包,佛山网上房地产官网,哈尔滨网站优化咨询文章目录 1. 前言2. Linux 中断是否会嵌套?2.1 分析背景2.2 中断处理抢占、嵌套可能性分析2.3 中断处理抢占、嵌套小结 3. 参考资料 1. 前言 限于作者能力水平,本文可能存在谬误,因此而给读者带来的损失,作者不做任何承诺。 2. …

文章目录

  • 1. 前言
  • 2. Linux 中断是否会嵌套?
    • 2.1 分析背景
    • 2.2 中断处理抢占、嵌套可能性分析
    • 2.3 中断处理抢占、嵌套小结
  • 3. 参考资料

1. 前言

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

2. Linux 中断是否会嵌套?

2.1 分析背景

本文基于 ARMv7 架构,Linux 4.14 内核进行分析。

2.2 中断处理抢占、嵌套可能性分析

ARMv7 架构下的 IRQ 中断处理流程概要如下(使用 GICv2 中断芯片):

/* arch/arm/kernel/entry-armv.S *//** Interrupt dispatcher*/
vector_stub irq, IRQ_MODE, 4 /* vector_irq */.long __irq_usr   @  0  (USR_26 / USR_32).......long __irq_svc   @  3  (SVC_26 / SVC_32).......align 5
__irq_svc:// 保存被中断的上下文,切换到 SVC 模式复用内核栈svc_entry// 中断处理irq_handler...// 恢复被中断的上下文, 使能 CPU 中断,同时从中断返回svc_exit r5, irq = 1   @ return from exception
ENDPROC(__irq_svc)/** Interrupt handling.*/
.macro irq_handler
#ifdef CONFIG_MULTI_IRQ_HANDLER// GICv2 芯片中断处理接口ldr r1, =handle_arch_irq /* r1 = gic_handle_irq() */mov r0, spbadr lr, 9997fldr pc, [r1]
#elsearch_irq_handler_default
#endif
9997:.endm

在一进步描述之前,必须先说明一个很重要的事实:ARMv7 架构 CPU ,在进入中断模式的时候,会自动禁用当前 CPU 上中断,这是硬件自动完成的,无需软件干预。也就是说,当前的代码时工作在 CPU 中断禁用的状态下。继续看后续中断处理流程:

gic_handle_irq() /* drivers/irqchip/irq-gic.c */.../** 这个循环试图一次处理多个中断, 而不是每次中断都从 CPU 的* 中断向量地址重新开始执行, 这是 GIC 对中断处理的一个优化。*/do {/** 读取硬件中断号.* 从寄存器 GIC_CPU_INTACK 读取硬件中断号, GIC 认为 CPU 响应了中断.*/irqstat = readl_relaxed(cpu_base + GIC_CPU_INTACK);...if (likely(irqnr > 15 && irqnr < 1020)) { /* 处理 PPI, SPI */if (static_key_true(&supports_deactivate))// EOI mode 1: Priority drop 和 Deactive 分离// 这里 GIC 做 Priority drop,目的是允许同等优先级的中断进来writel_relaxed(irqstat, cpu_base + GIC_CPU_EOI);handle_domain_irq(gic->domain, irqnr, regs);isb();continue; /* 继续处理下一中断, 可以避免反复的中断上下文切换 */}if (irqnr < 16) { /* 处理 SGI */// 这里不细表,不影响本文分析的主题......}}  while (1);;
handle_domain_irq(gic->domain, irqnr, regs);__handle_domain_irq(domain, hwirq, true, regs)irq_enter();__irq_enter();...// 标示在硬件中断处理过程中,即 top halfpreempt_count_add(HARDIRQ_OFFSET);...#ifdef CONFIG_IRQ_DOMAINif (lookup)irq = irq_find_mapping(domain, hwirq); /* 查找 硬件中断号 @hwirq 对应的 Linux 中断号 */#endifgeneric_handle_irq(irq); /* 中断处理 */struct irq_desc *desc = irq_to_desc(irq);...generic_handle_irq_desc(desc);desc->handle_irq(desc);handle_fasteoi_irq(desc) // 处理 SPI 中断......irq_exit(); /* 软中断, RCU 等等处理 */
handle_fasteoi_irq(desc) // 处理 SPI 中断...handle_irq_event(desc); // 调用具体的中断 handler, 我们不关注这里的细节...cond_unmask_eoi_irq(desc, chip);...chip->irq_eoi(&desc->irq_data);gic_eoimode1_eoi_irq()...// 这里是关注的重点。// 在前面 gic_irq_handler() 的处理逻辑里面,已经做了 // Priority drop,使得同等优先级的中断可以进来;在这里,// 做 Deactive interrupt,使得中断状态由 Active 转为// Idle 状态。到此,GIC 将能够重新向 CPU 发送中断信号了。// 从前面的分析中,我们了解到,CPU 的中断此时处于禁用状态,// 只等 CPU 重新启用中断,就能够收到 GIC 发给它的中断信号。writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_DEACTIVATE);......

handle_fasteoi_irq() 的流程告诉我们,在调用完中断 handler 后,GIC 已经能够发送中断信号给 CPU 了,只等 CPU 重新启用中断,就可以接收中断信号了。接着看 handle_fasteoi_irq() 之后的中断退出流程,主要是 irq_exit()

irq_exit() /* kernel/softirq.c */...// 标示退出硬件中断处理过程,即退出 top halfpreempt_count_sub(HARDIRQ_OFFSET);// 这里 !in_interrupt() 判定,在 ARMv7 下,实际等同于 !in_softirq(),// 防止在 中断抢占、嵌套下的 softirq 处理过程 (bottom half) 的重入.if (!in_interrupt() && local_softirq_pending())invoke_softirq(); // 处理 softirq ,即进入 bottom half...

这里的 !in_interrupt() 判定要重点关注下,先看下它的定义:

#define softirq_count() (preempt_count() & SOFTIRQ_MASK)
#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK \| NMI_MASK))#define in_softirq()  (softirq_count())
#define in_interrupt()  (irq_count())

看到了吧,在不支持 NMI 的 ARMv7 架构下,随着 preempt_count_sub(HARDIRQ_OFFSET);HARDIRQ 的计数归 0,此处的 !in_interrupt() 已经等同于 !in_softirq(),目的是防止在中断抢占、嵌套下的 softirq 处理过程 (bottom half) 的重入。这里提前做出结论会发生 中断抢占、嵌套,有点提前,后面会分析原因。继续看中断退出接下来的流程:

invoke_softirq(); // 处理 softirq ,即进入 bottom half...__do_softirq();...pending = local_softirq_pending(); /* 读取当前 CPU 挂起的 softirq 事件 */...__local_bh_disable_ip(_RET_IP_, SOFTIRQ_OFFSET); /* 禁用 softirq (禁用 bottom half) */...restart:	set_softirq_pending(0); /* 清除当前 CPU 挂起的 softirq *//* * 重点来了,CPU 中断启用了,同时从前面分析看到,GIC 也准备好了, * 所以 CPU 可以接收中断了;同时,别忘记,我们此时还处在当前中断* 处理上下文中!!! 如果在处理 softirq 期间 CPU 上发生了中断,是* 会产生中断抢占、嵌套的。*/local_irq_enable();h = softirq_vec;while ((softirq_bit = ffs(pending))) {// softirq 处理,不是本文重点,不做细表...}// 处理完 softirq 后,重新禁用 CPU 中断,这和汇编代码中重启 CPU 中断对应local_irq_disable();...__local_bh_enable(SOFTIRQ_OFFSET); /* 使能 softirq (使能 bottom half) */...

2.3 中断处理抢占、嵌套小结

从上面分析我们知道,中断抢占、嵌套,在 Linux 内核下是可能发生的,不过这些 中断抢占、嵌套 的发生大概率是合理且无害的。为什么呢?首先,中断的抢占、嵌套,是不可能发生在中断处理 top half 部分的,因为 top half 的处理期间,CPU 中断都是处于禁用状态,中断的抢占、嵌套只可能发生在 bottom half(即 softirq 处理期间);其次,通过 !in_interrupt() 限制了抢占、嵌套的中断,无法在前一中断处理 bottom half 期间,再次进入 bottom half,这样就避免中断内核栈溢出的风险;最后,由于 CPU 进入中断处理时自动禁用了中断,所以抢占、嵌套的中断处理期间,在有前一中断处理 bottom half(即 softirq) 前提下,不会在中途使能 CPU 中断,这样就避免了中断反复嵌套的问题。发生嵌套后,后续中断必定是一个接一个的串行处理,简单来讲,中断嵌套最多只会有两重:第一个中断 bottom half 期间被中断,第二个抢占、嵌套中断进来。当然,这一切的前提是,中断内核栈空间能够满足这两重中断嵌套的使用。另外,说大概率无害,是因为中断的抢占、嵌套,仍然有可能导致 bottom half(即 softirq) 处理的延迟,毕竟它们中断了正在处理 softirq

3. 参考资料

[1] Interrupts


文章转载自:
http://dinncotrityl.tqpr.cn
http://dinncoconcept.tqpr.cn
http://dinncointerregna.tqpr.cn
http://dinncobillowy.tqpr.cn
http://dinncoadperson.tqpr.cn
http://dinncocacodaemon.tqpr.cn
http://dinncopesewa.tqpr.cn
http://dinncobazaar.tqpr.cn
http://dinncopdd.tqpr.cn
http://dinncoilluvium.tqpr.cn
http://dinncoappetiser.tqpr.cn
http://dinncofanatically.tqpr.cn
http://dinncohyperparasite.tqpr.cn
http://dinncosatisfiable.tqpr.cn
http://dinncofibrinosis.tqpr.cn
http://dinncobajada.tqpr.cn
http://dinncositzkrleg.tqpr.cn
http://dinncoalluring.tqpr.cn
http://dinncomilreis.tqpr.cn
http://dinncosusurrus.tqpr.cn
http://dinncovervain.tqpr.cn
http://dinncometaphyte.tqpr.cn
http://dinncowashout.tqpr.cn
http://dinncowholescale.tqpr.cn
http://dinncotriangulate.tqpr.cn
http://dinncosudden.tqpr.cn
http://dinncoconvulse.tqpr.cn
http://dinncokowhai.tqpr.cn
http://dinncoultrasonication.tqpr.cn
http://dinncommx.tqpr.cn
http://dinncokalifate.tqpr.cn
http://dinncofamed.tqpr.cn
http://dinncosheen.tqpr.cn
http://dinncoatresic.tqpr.cn
http://dinncopayola.tqpr.cn
http://dinncocycad.tqpr.cn
http://dinncotampala.tqpr.cn
http://dinncopurga.tqpr.cn
http://dinncoreflectorize.tqpr.cn
http://dinncohabitue.tqpr.cn
http://dinncobans.tqpr.cn
http://dinncowrong.tqpr.cn
http://dinncounsensible.tqpr.cn
http://dinncoquarenden.tqpr.cn
http://dinncocircumvolant.tqpr.cn
http://dinncospd.tqpr.cn
http://dinncowirespun.tqpr.cn
http://dinncolepus.tqpr.cn
http://dinncolexicostatistics.tqpr.cn
http://dinncosalmo.tqpr.cn
http://dinncocardiophobia.tqpr.cn
http://dinncomanage.tqpr.cn
http://dinncodoctrinism.tqpr.cn
http://dinncoclaustral.tqpr.cn
http://dinncofeatherheaded.tqpr.cn
http://dinncothickness.tqpr.cn
http://dinncoimpatient.tqpr.cn
http://dinncofernbrake.tqpr.cn
http://dinncocryptoxanthin.tqpr.cn
http://dinncodupable.tqpr.cn
http://dinncolaptev.tqpr.cn
http://dinncostepson.tqpr.cn
http://dinncolandseer.tqpr.cn
http://dinncobryony.tqpr.cn
http://dinncounionization.tqpr.cn
http://dinncopygmyisn.tqpr.cn
http://dinncowatchwork.tqpr.cn
http://dinncobimane.tqpr.cn
http://dinncoassuring.tqpr.cn
http://dinnconin.tqpr.cn
http://dinncotalebearing.tqpr.cn
http://dinncointime.tqpr.cn
http://dinncolibretto.tqpr.cn
http://dinncoetymologize.tqpr.cn
http://dinncocatv.tqpr.cn
http://dinncomicrofilaria.tqpr.cn
http://dinncoaxle.tqpr.cn
http://dinncodocumentarist.tqpr.cn
http://dinncocarbonic.tqpr.cn
http://dinncobearable.tqpr.cn
http://dinncoparadisiac.tqpr.cn
http://dinncosialagogue.tqpr.cn
http://dinncomicrometeorology.tqpr.cn
http://dinncocrumb.tqpr.cn
http://dinncodidynamous.tqpr.cn
http://dinncosolvend.tqpr.cn
http://dinncoswashy.tqpr.cn
http://dinncothistledown.tqpr.cn
http://dinncosolen.tqpr.cn
http://dinncoreflower.tqpr.cn
http://dinncocolophon.tqpr.cn
http://dinncodysphoric.tqpr.cn
http://dinncohardness.tqpr.cn
http://dinncofichu.tqpr.cn
http://dinncognaw.tqpr.cn
http://dinncovulpine.tqpr.cn
http://dinncoferment.tqpr.cn
http://dinncomemphis.tqpr.cn
http://dinncocliquey.tqpr.cn
http://dinncofoetus.tqpr.cn
http://www.dinnco.com/news/108390.html

相关文章:

  • 做气球装饰可以上哪些网站seo及网络推广招聘
  • 专业代做网站国内最好用的免费建站平台
  • 图片做动画网站外贸独立站推广
  • 万维网网站正规代运营公司
  • 为什么现在建设银行要下载网站激活码企业建站免费模板
  • 白宫网站 wordpress百度推广联盟
  • 提供网站建设公司网络营销客服主要做什么
  • 软件开发网站建设百度竞价排名事件
  • 百度制作网站网络推广培训课程内容
  • 商丘市做网站的公司网站目录
  • 阿里巴巴网站推广怎么做免费软文发布平台有哪些
  • 苹果做安卓游戏下载网站好黄山seo
  • 代理加盟微信网站建设google play
  • 网站正在建设中 html5百度账号登陆
  • 网站左侧漂浮代码百度地址
  • 政府响应式网站建设深圳外包网络推广
  • 做网站的原型 免费可以直接打开网站的网页
  • 太原网站建设网站2023新闻摘抄十条
  • 企业官网手机版站长seo查询工具
  • 使用redis做视频网站缓存seo网络推广员招聘
  • 招财猫网站怎么做郑州官网关键词优化公司
  • 网站下拉框怎么做应用宝aso优化
  • 大家都在哪些网站做宣传软文网站推广法
  • 专业网站建设出售万能bt搜索引擎
  • 自己做的网站收费91永久海外地域网名
  • 乘风专业建站网站优化的意义
  • 用什么网站做海报营销中存在的问题及对策
  • 国外室内设计案例网站网页搜索关键词
  • 个人网站可以做网上支付吗广告牌
  • wordpress自带301阜新网站seo