主頁 > 作業系統 > Linux ARM中斷后的處理(5)【轉】

Linux ARM中斷后的處理(5)【轉】

2021-11-06 06:05:46 作業系統

轉自:https://blog.csdn.net/zgtzqzg2020/article/details/105703394

1. 中斷進入自定義函式 

在中斷發生后,經歷ARM通用的處理階段,到達irq_handler宏,轉入C語言階段,

  1. //arch/arm/kernel/entry-armv.S
  2. /*
  3. *注釋:
  4. *宏CONFIG_MULTI_IRQ_HANDLER在.config中有定義,會將handle_arch_irq里的值賦值給pc去執行,
  5. *給handle_arch_irq請看后面的C語言階段分析
  6. */
  7. /*
  8. * Interrupt handling.
  9. */
  10. .macro irq_handler
  11. #ifdef CONFIG_MULTI_IRQ_HANDLER
  12. ldr r1, =handle_arch_irq
  13. mov r0, sp
  14. badr lr, 9997f
  15. ldr pc, [r1] //進入C語言階段的中斷處理
  16. #else
  17. arch_irq_handler_default
  18. #endif
  19. 9997:
  20. .endm
  21. //arch/arm/kernel/entry-armv.S
  22. #ifdef CONFIG_MULTI_IRQ_HANDLER
  23. .globl handle_arch_irq
  24. handle_arch_irq:
  25. .space 4
  26. #endif

2. handle_arch_irq

handle_arch_irq賦值在/drivers/irqchip/irq-vic.c的vic_register函式中呼叫set_handle_irq進行賦值

  1. //driver/irqchip/irq-vic.c
  2. /**
  3. * vic_register() - Register a VIC.
  4. * @base: The base address of the VIC.
  5. * @parent_irq: The parent IRQ if cascaded, else 0.
  6. * @irq: The base IRQ for the VIC.
  7. * @valid_sources: bitmask of valid interrupts
  8. * @resume_sources: bitmask of interrupts allowed for resume sources.
  9. * @node: The device tree node associated with the VIC.
  10. *
  11. * Register the VIC with the system device tree so that it can be notified
  12. * of suspend and resume requests and ensure that the correct actions are
  13. * taken to re-instate the settings on resume.
  14. *
  15. * This also configures the IRQ domain for the VIC.
  16. */
  17. // __vic_init(regs, 0, 0, interrupt_mask, wakeup_mask, node);
  18. //vic_register(base, 0, irq_start, vic_sources, 0, node);
  19. static void __init vic_register(void __iomem *base, unsigned int parent_irq,
  20. unsigned int irq,
  21. u32 valid_sources, u32 resume_sources,
  22. struct device_node *node)
  23. {
  24. struct vic_device *v;
  25. int i;
  26. if (vic_id >= ARRAY_SIZE(vic_devices)) {
  27. printk(KERN_ERR "%s: too few VICs, increase CONFIG_ARM_VIC_NR\n", __func__);
  28. return;
  29. }
  30. v = &vic_devices[vic_id];
  31. v->base = base;
  32. v->valid_sources = valid_sources;
  33. v->resume_sources = resume_sources;
  34. set_handle_irq(vic_handle_irq); //此處被呼叫
  35. vic_id++;
  36. if (parent_irq) {
  37. irq_set_chained_handler_and_data(parent_irq,
  38. vic_handle_irq_cascaded, v);
  39. }
  40. v->domain = irq_domain_add_simple(node, fls(valid_sources), irq,
  41. &vic_irqdomain_ops, v);
  42. /* create an IRQ mapping for each valid IRQ */
  43. for (i = 0; i < fls(valid_sources); i++) {
  44. if (valid_sources & (1 << i)) {
  45. irq_create_mapping(v->domain, i);
  46. }
  47. }
  48. /* If no base IRQ was passed, figure out our allocated base */
  49. if (irq)
  50. v->irq = irq;
  51. else
  52. v->irq = irq_find_mapping(v->domain, 0);
  53. }
  54. //arch/arm/kernel/irq.c
  55. #ifdef CONFIG_MULTI_IRQ_HANDLER
  56. void __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
  57. {
  58. if (handle_arch_irq)
  59. return;
  60. handle_arch_irq = handle_irq;
  61. }
  62. #endif

3. vic_handle_irq

  1. //drivers/irqchip/irq-vic.c
  2. /*
  3. * Keep iterating over all registered VIC's until there are no pending
  4. * interrupts.
  5. */
  6. static void __exception_irq_entry vic_handle_irq(struct pt_regs *regs)
  7. {
  8. int i, handled;
  9. do {
  10. for (i = 0, handled = 0; i < vic_id; ++i)
  11. handled |= handle_one_vic(&vic_devices[i], regs);
  12. } while (handled);
  13. }

4. handle_one_vic

  1. //drivers/irqchip/irq-vic.c
  2. /*
  3. * Handle each interrupt in a single VIC. Returns non-zero if we've
  4. * handled at least one interrupt. This reads the status register
  5. * before handling each interrupt, which is necessary given that
  6. * handle_IRQ may briefly re-enable interrupts for soft IRQ handling.
  7. */
  8. static int handle_one_vic(struct vic_device *vic, struct pt_regs *regs)
  9. {
  10. u32 stat, irq;
  11. int handled = 0;
  12. while ((stat = readl_relaxed(vic->base + VIC_IRQ_STATUS))) {
  13. irq = ffs(stat) - 1;
  14. handle_domain_irq(vic->domain, irq, regs);
  15. handled = 1;
  16. }
  17. return handled;
  18. }
  19. //具體代碼參看arch/arm/include/asm/io.h
  20. /*
  21. * Memory access primitives
  22. * ------------------------
  23. *
  24. * These perform PCI memory accesses via an ioremap region. They don't
  25. * take an address as such, but a cookie.
  26. *
  27. * Again, this are defined to perform little endian accesses. See the
  28. * IO port primitives for more information.
  29. */
  30. #ifndef readl
  31. #define readb_relaxed(c) ({ u8 __r = __raw_readb(c); __r; })
  32. #define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16) \
  33. __raw_readw(c)); __r; })
  34. #define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
  35. __raw_readl(c)); __r; })
  36. #define writeb_relaxed(v,c) __raw_writeb(v,c)
  37. #define writew_relaxed(v,c) __raw_writew((__force u16) cpu_to_le16(v),c)
  38. #define writel_relaxed(v,c) __raw_writel((__force u32) cpu_to_le32(v),c)
  39. #define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; })
  40. #define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; })
  41. #define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; })
  42. #define writeb(v,c) ({ __iowmb(); writeb_relaxed(v,c); })
  43. #define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); })
  44. #define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
  45. #define readsb(p,d,l) __raw_readsb(p,d,l)
  46. #define readsw(p,d,l) __raw_readsw(p,d,l)
  47. #define readsl(p,d,l) __raw_readsl(p,d,l)
  48. #define writesb(p,d,l) __raw_writesb(p,d,l)
  49. #define writesw(p,d,l) __raw_writesw(p,d,l)
  50. #define writesl(p,d,l) __raw_writesl(p,d,l)

5. handle_domain_irq

  1. //include/linux/irqdesc.h
  2. #ifdef CONFIG_HANDLE_DOMAIN_IRQ
  3. /*
  4. * Convert a HW interrupt number to a logical one using a IRQ domain,
  5. * and handle the result interrupt number. Return -EINVAL if
  6. * conversion failed. Providing a NULL domain indicates that the
  7. * conversion has already been done.
  8. */
  9. int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
  10. bool lookup, struct pt_regs *regs);
  11. static inline int handle_domain_irq(struct irq_domain *domain,
  12. unsigned int hwirq, struct pt_regs *regs)
  13. {
  14. return __handle_domain_irq(domain, hwirq, true, regs);
  15. }
  16. #endif

6. __handle_domain_irq

  1. //kernel/irq/irqdesc.c
  2. #ifdef CONFIG_HANDLE_DOMAIN_IRQ
  3. /**
  4. * __handle_domain_irq - Invoke the handler for a HW irq belonging to a domain
  5. * @domain: The domain where to perform the lookup
  6. * @hwirq: The HW irq number to convert to a logical one
  7. * @lookup: Whether to perform the domain lookup or not
  8. * @regs: Register file coming from the low-level handling code
  9. *
  10. * Returns: 0 on success, or -EINVAL if conversion has failed
  11. */
  12. int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
  13. bool lookup, struct pt_regs *regs)
  14. {
  15. struct pt_regs *old_regs = set_irq_regs(regs);
  16. unsigned int irq = hwirq;
  17. int ret = 0;
  18. irq_enter();
  19. #ifdef CONFIG_IRQ_DOMAIN
  20. if (lookup)
  21. irq = irq_find_mapping(domain, hwirq);
  22. #endif
  23. /*
  24. * Some hardware gives randomly wrong interrupts. Rather
  25. * than crashing, do something sensible.
  26. */
  27. if (unlikely(!irq || irq >= nr_irqs)) {
  28. ack_bad_irq(irq);
  29. ret = -EINVAL;
  30. } else {
  31. generic_handle_irq(irq);
  32. }
  33. irq_exit();
  34. set_irq_regs(old_regs);
  35. return ret;
  36. }
  37. #endif

7. generic_handle_irq

  1. //kernel/irq/irqdesc.c
  2. /**
  3. * generic_handle_irq - Invoke the handler for a particular irq
  4. * @irq: The irq number to handle
  5. *
  6. */
  7. int generic_handle_irq(unsigned int irq)
  8. {
  9. struct irq_desc *desc = irq_to_desc(irq);
  10. if (!desc)
  11. return -EINVAL;
  12. generic_handle_irq_desc(desc);
  13. return 0;
  14. }
  15. EXPORT_SYMBOL_GPL(generic_handle_irq);

8. generic_handle_irq_desc

  1. //include/linux/irqdesc.h
  2. /*
  3. * Architectures call this to let the generic IRQ layer
  4. * handle an interrupt.
  5. */
  6. static inline void generic_handle_irq_desc(struct irq_desc *desc)
  7. {
  8. /*
  9. *handle_irq在struct domain的struct domain_ops的map函式中呼叫
  10. *irq_set_chip_and_handler賦值為handle_level_irq
  11. */
  12. desc->handle_irq(desc);
  13. }
  14. int generic_handle_irq(unsigned int irq);

9. handle_level_irq

  1. //kernel/irq/chip.c
  2. /**
  3. * handle_level_irq - Level type irq handler
  4. * @desc: the interrupt description structure for this irq
  5. *
  6. * Level type interrupts are active as long as the hardware line has
  7. * the active level. This may require to mask the interrupt and unmask
  8. * it after the associated handler has acknowledged the device, so the
  9. * interrupt line is back to inactive.
  10. */
  11. void handle_level_irq(struct irq_desc *desc)
  12. {
  13. raw_spin_lock(&desc->lock);
  14. mask_ack_irq(desc);
  15. if (!irq_may_run(desc))
  16. goto out_unlock;
  17. desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
  18. kstat_incr_irqs_this_cpu(desc);
  19. /*
  20. * If its disabled or no action available
  21. * keep it masked and get out of here
  22. */
  23. if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data))) {
  24. desc->istate |= IRQS_PENDING;
  25. goto out_unlock;
  26. }
  27. handle_irq_event(desc);
  28. cond_unmask_irq(desc);
  29. out_unlock:
  30. raw_spin_unlock(&desc->lock);
  31. }
  32. EXPORT_SYMBOL_GPL(handle_level_irq);
  33. //kernel/irq/chip.c
  34. static inline void mask_ack_irq(struct irq_desc *desc)
  35. {
  36. /*desc->irq_data.chip在struct domain的struct domain_ops的map函式中呼叫
  37. *irq_set_chip_and_handler賦值為vic_chip.
  38. */
  39. if (desc->irq_data.chip->irq_mask_ack)
  40. desc->irq_data.chip->irq_mask_ack(&desc->irq_data);
  41. else {
  42. desc->irq_data.chip->irq_mask(&desc->irq_data);
  43. if (desc->irq_data.chip->irq_ack)
  44. desc->irq_data.chip->irq_ack(&desc->irq_data);
  45. }
  46. irq_state_set_masked(desc);
  47. }
  48. //include/linux/irq.h
  49. /**
  50. * struct irq_chip - hardware interrupt chip descriptor
  51. *
  52. * @name: name for /proc/interrupts
  53. * @irq_startup: start up the interrupt (defaults to ->enable if NULL)
  54. * @irq_shutdown: shut down the interrupt (defaults to ->disable if NULL)
  55. * @irq_enable: enable the interrupt (defaults to chip->unmask if NULL)
  56. * @irq_disable: disable the interrupt
  57. * @irq_ack: start of a new interrupt
  58. * @irq_mask: mask an interrupt source
  59. * @irq_mask_ack: ack and mask an interrupt source
  60. * @irq_unmask: unmask an interrupt source
  61. * @irq_eoi: end of interrupt
  62. * @irq_set_affinity: set the CPU affinity on SMP machines
  63. * @irq_retrigger: resend an IRQ to the CPU
  64. * @irq_set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ
  65. * @irq_set_wake: enable/disable power-management wake-on of an IRQ
  66. * @irq_bus_lock: function to lock access to slow bus (i2c) chips
  67. * @irq_bus_sync_unlock:function to sync and unlock slow bus (i2c) chips
  68. * @irq_cpu_online: configure an interrupt source for a secondary CPU
  69. * @irq_cpu_offline: un-configure an interrupt source for a secondary CPU
  70. * @irq_suspend: function called from core code on suspend once per
  71. * chip, when one or more interrupts are installed
  72. * @irq_resume: function called from core code on resume once per chip,
  73. * when one ore more interrupts are installed
  74. * @irq_pm_shutdown: function called from core code on shutdown once per chip
  75. * @irq_calc_mask: Optional function to set irq_data.mask for special cases
  76. * @irq_print_chip: optional to print special chip info in show_interrupts
  77. * @irq_request_resources: optional to request resources before calling
  78. * any other callback related to this irq
  79. * @irq_release_resources: optional to release resources acquired with
  80. * irq_request_resources
  81. * @irq_compose_msi_msg: optional to compose message content for MSI
  82. * @irq_write_msi_msg: optional to write message content for MSI
  83. * @irq_get_irqchip_state: return the internal state of an interrupt
  84. * @irq_set_irqchip_state: set the internal state of a interrupt
  85. * @irq_set_vcpu_affinity: optional to target a vCPU in a virtual machine
  86. * @flags: chip specific flags
  87. */
  88. struct irq_chip {
  89. const char *name;
  90. unsigned int (*irq_startup)(struct irq_data *data);
  91. void (*irq_shutdown)(struct irq_data *data);
  92. void (*irq_enable)(struct irq_data *data);
  93. void (*irq_disable)(struct irq_data *data);
  94. void (*irq_ack)(struct irq_data *data);
  95. void (*irq_mask)(struct irq_data *data);
  96. void (*irq_mask_ack)(struct irq_data *data);
  97. void (*irq_unmask)(struct irq_data *data);
  98. void (*irq_eoi)(struct irq_data *data);
  99. int (*irq_set_affinity)(struct irq_data *data, const struct cpumask *dest, bool force);
  100. int (*irq_retrigger)(struct irq_data *data);
  101. int (*irq_set_type)(struct irq_data *data, unsigned int flow_type);
  102. int (*irq_set_wake)(struct irq_data *data, unsigned int on);
  103. void (*irq_bus_lock)(struct irq_data *data);
  104. void (*irq_bus_sync_unlock)(struct irq_data *data);
  105. void (*irq_cpu_online)(struct irq_data *data);
  106. void (*irq_cpu_offline)(struct irq_data *data);
  107. void (*irq_suspend)(struct irq_data *data);
  108. void (*irq_resume)(struct irq_data *data);
  109. void (*irq_pm_shutdown)(struct irq_data *data);
  110. void (*irq_calc_mask)(struct irq_data *data);
  111. void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);
  112. int (*irq_request_resources)(struct irq_data *data);
  113. void (*irq_release_resources)(struct irq_data *data);
  114. void (*irq_compose_msi_msg)(struct irq_data *data, struct msi_msg *msg);
  115. void (*irq_write_msi_msg)(struct irq_data *data, struct msi_msg *msg);
  116. int (*irq_get_irqchip_state)(struct irq_data *data, enum irqchip_irq_state which, bool *state);
  117. int (*irq_set_irqchip_state)(struct irq_data *data, enum irqchip_irq_state which, bool state);
  118. int (*irq_set_vcpu_affinity)(struct irq_data *data, void *vcpu_info);
  119. unsigned long flags;
  120. };
  121. //drivers/irqchip/irq-vic.c 在
  122. static struct irq_chip vic_chip = {
  123. .name = "VIC",
  124. .irq_ack = vic_ack_irq,
  125. .irq_mask = vic_mask_irq,
  126. .irq_unmask = vic_unmask_irq,
  127. .irq_set_wake = vic_set_wake,
  128. };
  129. static void vic_ack_irq(struct irq_data *d)
  130. {
  131. void __iomem *base = irq_data_get_irq_chip_data(d);
  132. unsigned int irq = d->hwirq;
  133. writel(1 << irq, base + VIC_INT_ENABLE_CLEAR);
  134. /* moreover, clear the soft-triggered, in case it was the reason */
  135. writel(1 << irq, base + VIC_INT_SOFT_CLEAR);
  136. }
  137. static void vic_mask_irq(struct irq_data *d)
  138. {
  139. void __iomem *base = irq_data_get_irq_chip_data(d);
  140. unsigned int irq = d->hwirq;
  141. writel(1 << irq, base + VIC_INT_ENABLE_CLEAR);
  142. }
  143. static void vic_unmask_irq(struct irq_data *d)
  144. {
  145. void __iomem *base = irq_data_get_irq_chip_data(d);
  146. unsigned int irq = d->hwirq;
  147. writel(1 << irq, base + VIC_INT_ENABLE);
  148. }
  149. #if defined(CONFIG_PM)
  150. static struct vic_device *vic_from_irq(unsigned int irq)
  151. {
  152. struct vic_device *v = vic_devices;
  153. unsigned int base_irq = irq & ~31;
  154. int id;
  155. for (id = 0; id < vic_id; id++, v++) {
  156. if (v->irq == base_irq)
  157. return v;
  158. }
  159. return NULL;
  160. }
  161. static int vic_set_wake(struct irq_data *d, unsigned int on)
  162. {
  163. struct vic_device *v = vic_from_irq(d->irq);
  164. unsigned int off = d->hwirq;
  165. u32 bit = 1 << off;
  166. if (!v)
  167. return -EINVAL;
  168. if (!(bit & v->resume_sources))
  169. return -EINVAL;
  170. if (on)
  171. v->resume_irqs |= bit;
  172. else
  173. v->resume_irqs &= ~bit;
  174. return 0;
  175. }
  176. #else
  177. #define vic_set_wake NULL
  178. #endif /* CONFIG_PM */
  179. //include/linux/irq.h
  180. static inline void *irq_data_get_irq_chip_data(struct irq_data *d)
  181. {
  182. /*
  183. *d->chip_data在struct domain的struct domain_ops的map函式中呼叫
  184. *irq_set_chip_data賦值為中斷控制器暫存器的虛擬地址
  185. *
  186. */
  187. return d->chip_data;
  188. }

10. handle_irq_event

  1. //kernel/irq/handle.c
  2. irqreturn_t handle_irq_event(struct irq_desc *desc)
  3. {
  4. irqreturn_t ret;
  5. desc->istate &= ~IRQS_PENDING;
  6. irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
  7. raw_spin_unlock(&desc->lock);
  8. ret = handle_irq_event_percpu(desc);
  9. raw_spin_lock(&desc->lock);
  10. irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);
  11. return ret;
  12. }

11. handle_irq_event_percpu:

  1. //kernel/irq/handle.c
  2. irqreturn_t handle_irq_event_percpu(struct irq_desc *desc)
  3. {
  4. irqreturn_t retval = IRQ_NONE;
  5. unsigned int flags = 0, irq = desc->irq_data.irq;
  6. struct irqaction *action = desc->action;
  7. /* action might have become NULL since we dropped the lock */
  8. while (action) {
  9. irqreturn_t res;
  10. trace_irq_handler_entry(irq, action);
  11. /*
  12. *action->handler處理函式為驅動中注冊的處理函式
  13. */
  14. res = action->handler(irq, action->dev_id);
  15. trace_irq_handler_exit(irq, action, res);
  16. if (WARN_ONCE(!irqs_disabled(),"irq %u handler %pF enabled interrupts\n",
  17. irq, action->handler))
  18. local_irq_disable();
  19. switch (res) {
  20. case IRQ_WAKE_THREAD:
  21. /*
  22. * Catch drivers which return WAKE_THREAD but
  23. * did not set up a thread function
  24. */
  25. if (unlikely(!action->thread_fn)) {
  26. warn_no_thread(irq, action);
  27. break;
  28. }
  29. __irq_wake_thread(desc, action);
  30. /* Fall through to add to randomness */
  31. case IRQ_HANDLED:
  32. flags |= action->flags;
  33. break;
  34. default:
  35. break;
  36. }
  37. retval |= res;
  38. action = action->next;
  39. }
  40. add_interrupt_randomness(irq, flags);
  41. if (!noirqdebug)
  42. note_interrupt(desc, retval);
  43. return retval;
  44. }

【作者】陳金
【出處】https://www.cnblogs.com/yifeichongtian2021/
【博客園】https://www.cnblogs.com/yifeichongtian2021/
本文著作權歸作者和博客園共有,歡迎轉載,但未經作者同意必須保留此段宣告,且在文章頁面明顯位置給出原文連接,否則保留追究法律責任的權利.

轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/349465.html

標籤:其他

上一篇:IDM使用教程:利用IDM下載百度網盤檔案

下一篇:Linux內核驅動--硬體訪問I/O【轉】

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • CA和證書

    1、在 CentOS7 中使用 gpg 創建 RSA 非對稱密鑰對 gpg --gen-key #Centos上生成公鑰/密鑰對(存放在家目錄.gnupg/) 2、將 CentOS7 匯出的公鑰,拷貝到 CentOS8 中,在 CentOS8 中使用 CentOS7 的公鑰加密一個檔案 gpg -a ......

    uj5u.com 2020-09-10 00:09:53 more
  • Kubernetes K8S之資源控制器Job和CronJob詳解

    Kubernetes的資源控制器Job和CronJob詳解與示例 ......

    uj5u.com 2020-09-10 00:10:45 more
  • VMware下安裝CentOS

    VMware下安裝CentOS 一、軟硬體準備 1 Centos鏡像準備 1.1 CentOS鏡像下載地址 下載地址 1.2 CentOS鏡像下載程序 點擊下載地址進入如下圖的網站,選擇需要下載的版本,這里選擇的是Centos8,點擊如圖所示。 決定選擇Centos8后,選擇想要的鏡像源進行下載,此 ......

    uj5u.com 2020-09-10 00:12:10 more
  • 如何使用Grep命令查找多個字串

    如何使用Grep 命令查找多個字串 大家好,我是良許! 今天向大家介紹一個非常有用的技巧,那就是使用 grep 命令查找多個字串。 簡單介紹一下,grep 命令可以理解為是一個功能強大的命令列工具,可以用它在一個或多個輸入檔案中搜索與正則運算式相匹配的文本,然后再將每個匹配的文本用標準輸出的格式 ......

    uj5u.com 2020-09-10 00:12:28 more
  • git配置http代理

    git配置http代理 經常遇到克隆 github 慢的問題,這里記錄一下幾種配置 git 代理的方法,解決 clone github 過慢。 目錄 git配置代理 git單獨配置github代理 git配置全域代理 配置終端環境變數 git配置代理 主要使用 git config 命令 git單獨 ......

    uj5u.com 2020-09-10 00:12:33 more
  • Linux npm install 裝包時提示Error EACCES permission denied解

    npm install 裝包時提示Error EACCES permission denied解決辦法 ......

    uj5u.com 2020-09-10 00:12:53 more
  • Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包

    Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包。 18 (flaskApi) [root@67 flaskDemo]# yum -y install nginx 19 已加載插件:fastestmirror, langpacks 20 Loading ......

    uj5u.com 2020-09-10 00:13:13 more
  • Linux查看服務器暴力破解ssh IP

    在公網的服務器上經常遇到別人爆破你服務器的22埠,用來挖礦或者干其他嘿嘿嘿的事情~ 這種情況下正確的做法是: 修改默認ssh的22埠 使用設定密鑰登錄或者白名單ip登錄 建議服務器密碼為復雜密碼 創建普通用戶登錄服務器(root權限過大) 建立堡壘機,實作統一管理服務器 統計爆破IP [root ......

    uj5u.com 2020-09-10 00:13:17 more
  • CentOS 7系統常見快捷鍵操作方式

    Linux系統中一些常見的快捷方式,可有效提高操作效率,在某些時刻也能避免操作失誤帶來的問題。 ......

    uj5u.com 2020-09-10 00:13:31 more
  • CentOS 7作業系統目錄結構介紹

    作業系統存在著大量的資料檔案資訊,相應檔案資訊會存在于系統相應目錄中,為了更好的管理資料資訊,會將系統進行一些目錄規劃,不同目錄存放不同的資源。 ......

    uj5u.com 2020-09-10 00:13:35 more
最新发布
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:43:21 more
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:42:36 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:26:53 more
  • 設定Windows主機的瀏覽器為wls2的默認瀏覽器

    這里以Chrome為例。 1. 準備作業 wsl是可以使用Windows主機上安裝的exe程式,出于安全考慮,默認情況下改功能是無法使用。要使用的話,終端需要以管理員權限啟動。 我這里以Windows Terminal為例,介紹如何默認使用管理員權限打開終端,具體操作如下圖所示: 2. 操作 wsl ......

    uj5u.com 2023-04-19 09:25:49 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:19:04 more
  • Linux學習筆記

    IP地址和主機名 IP地址 ifconfig可以用來查詢本機的IP地址,如果不能使用,可以通過install net-tools安裝。 Centos系統下ens33表示主網卡;inet后表示IP地址;lo表示本地回環網卡; 127.0.0.1表示代指本機;0.0.0.0可以用于代指本機,同時在放行設 ......

    uj5u.com 2023-04-18 06:52:01 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:50 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:01 more
  • 你是不是暴露了?

    作者:袁首京 原創文章,轉載時請保留此宣告,并給出原文連接。 如果您是計算機相關從業人員,那么應該經歷不止一次網路安全專項檢查了,你肯定是收到過資訊系統技術檢測報告,要求你加強風險監測,確保你提供的系統服務堅實可靠了。 沒檢測到問題還好,檢測到問題的話,有些處理起來還是挺麻煩的,尤其是線上正在運行的 ......

    uj5u.com 2023-04-05 16:52:56 more
  • 細節拉滿,80 張圖帶你一步一步推演 slab 記憶體池的設計與實作

    1. 前文回顧 在之前的幾篇記憶體管理系列文章中,筆者帶大家從宏觀角度完整地梳理了一遍 Linux 記憶體分配的整個鏈路,本文的主題依然是記憶體分配,這一次我們會從微觀的角度來探秘一下 Linux 內核中用于零散小記憶體塊分配的記憶體池 —— slab 分配器。 在本小節中,筆者還是按照以往的風格先帶大家簡單 ......

    uj5u.com 2023-04-05 16:44:11 more