리눅스에서 인터럽트처리 금지구역에서 어떻게 동작하는지 궁금합니다.

trymp의 이미지


일반적으로 리눅스 커널 코드에서 local_irq_disable() 함수를 사용해서
인터럽트 발생을 금지 시키잖아요.

 local_irq_disable();
 /* 금지구간*/
 local_irq_enable();

이 금지구간에서 timer 신호나 네트워크에서 패킷 RX 수신이 이루어지면
ISR() 함수도 호출이 안되고 그냥 무시(ignore)되는 건가요?
아니면 나중에라도 처리될 수있게 pedding 처리 되는 건가요?

아예 HW 신호를 무시하는지 local_irq_enable()하면 지연되었던
인터럽트 함수처리가 수행되는지 궁금합니다.

회원님들의 조언 부탁드립니다. ^^

shint의 이미지

//
커널 2.6.3 발표...
https://kldp.org/node/30805

If happen the shared interrupt, the this ISR style may lose a
chance of netif_rx_schedule().
 
공유 인터럽트가 발생하면 이 ISR 스타일에 netif_rx_schedule()의 가능성이 없어질 수 있습니다.

//
리눅스에서 인터럽트처리 금지구역에서 어떻게 동작하는지 궁금합니다.
https://kldp.org/node/160200

local_irq_disable ISR
interrupt service routine (ISR)

Chapter 10. Interrupt Handling
https://www.oreilly.com/library/view/linux-device-drivers/0596005903/ch10.html

Chapter 7. Interrupts and Interrupt Handlers
https://notes.shichao.io/lkd/ch7/

Status of the Interrupt System

Function Description
local_irq_disable() Disables local interrupt delivery
local_irq_enable() Enables local interrupt delivery
local_irq_save() Saves the current state of local interrupt delivery and then disables it
local_irq_restore() Restores local interrupt delivery to the given state
disable_irq() Disables the given interrupt line and ensures no handler on the line is executing before returning
disable_irq_nosync() Disables the given interrupt line
enable_irq() Enables the given interrupt line
irqs_disabled() Returns nonzero if local interrupt delivery is disabled; otherwise returns zero
in_interrupt() Returns nonzero if in interrupt context and zero if in process context
in_irq() Returns nonzero if currently executing an interrupt handler and zero otherwise

in_interrupt()에서 0을 반환하는 경우 커널은 프로세스 컨텍스트에 있습니다.
이 기능은 프로세스 컨텍스트, 즉 인터럽트 컨텍스트에 있지 않은지,
즉 인터럽트 컨텍스트에 있지 않은지 확인하고자 하는 경우에 유용합니다.

How to disable interrupts
https://armbedded.taskit.de/node/36

[Linux][Kernel] 인터럽트 - request_threaded_irq 기초
http://egloos.zum.com/rousalome/v/9964791

//

Softirqs and Tasklets
https://www.oreilly.com/library/view/understanding-the-linux/0596005652/ch04s07.html

NET_TX_SOFTIRQ 2 Transmits packets to network cards
NET_RX_SOFTIRQ 3 Receives packets from network cards

Basics of Writing Interrupt Handlers in Linux
http://embeddedlearnings.blogspot.com/2014/06/basics-of-writing-interrupt-handlers-in.html

Interrupt Handling
https://www.oreilly.com/library/view/understanding-the-linux/0596002130/ch04s06.html

#include

int
InterruptAttachEvent (int intr,
const struct sigevent *event,
unsigned flags);

int
InterruptAttach (int intr,
const struct sigevent *
(*handler) (void *area, int id),
const void *area,
int size,
unsigned flags);

atomic_*() functions (such as atomic_set())
mem*() functions (such as memcpy())
most str*() functions (such as strcmp()). Beware, though, that not all these are safe, such as strdup() — it calls malloc(), which uses a mutex, and that's not allowed. For the string functions, you should really consult the individual entries in the Neutrino Library Reference before using.
InterruptMask()
InterruptUnmask()
InterruptLock()
InterruptUnlock()
InterruptDisable()
InterruptEnable()
in*() and out*()

Interrupt Services
https://docs.zephyrproject.org/1.3.0/kernel/nanokernel/nanokernel_interrupts.html

IRQ_CONNECT(MY_DEV_IRQ, MY_DEV_PRIO, my_isr, MY_ISR_ARG, MY_IRQ_FLAGS);
irq_enable(MY_DEV_IRQ); /* enable IRQ */

Equivalent function local_irq_disable()(Linux)
https://community.osr.com/discussion/134670

ISR
https://techterms.com/definition/isr

//--------------------------------------------
//기타
//--------------------------------------------
인터럽트 비활성화 시, 다른 task들의 스케쥴링이 안되는 이유는?
https://kldp.org/node/157907

리눅스 커널메시지를 이용해서 "C" 코드를 찾는방법 ?
https://kldp.org/node/116074

커널 타이머 인터럽트에서 spin_lock_irqsave() 실행시 문제점...
https://kldp.org/node/80800

인터럽트 금지, 해제 함수 둘의 차이가 어떤것인가요?
https://kldp.org/node/116690

cli() sti() 함수에 관한 질문입니다
https://kldp.org/node/43805

리눅스 인터럽트 enable / disable 관련 질문입니다.
https://kldp.org/node/134552

local_irq_disable smp

SMP 시스템의 동기화 기술
http://miguelkey.blogspot.com/2016/02/smp.html

리눅스에서의 동기화 정리
http://www.iamroot.org/xe/index.php?mid=Programming&document_srl=13650

리눅스에서의 동기화
http://damduc.tistory.com/351

local_irq_disable

타겟보드를 이용하여 디바이스 드라이버를 배워보자!(14) - 인터럽트 금지(2)
http://forum.falinux.com/zbxe/?document_srl=564671&mid=lecture_tip&page=1

What is the difference between "local_irq_save()" and "local_irq_disable()" API?
https://www.quora.com/What-is-the-difference-between-local_irq_save-and-local_irq_disable-API

local_irq_disable(), local_irq_save(flags) 분석
http://decdream.tistory.com/318

local_irq_disable()
http://www.iamroot.org/xe/index.php?mid=Kernel&document_srl=20234

리눅스 인터럽트의 금지와 해제
http://chammoru.egloos.com/v/3955565

local_irq_disable()
http://jake.dothome.co.kr/local_irq_disable/

----------------------------------------------------------------------------
젊음'은 모든것을 가능하게 만든다.

매일 1억명이 사용하는 프로그램을 함께 만들어보고 싶습니다.
정규 근로 시간을 지키는. 야근 없는 회사와 거래합니다.

각 분야별. 좋은 책'이나 사이트' 블로그' 링크 소개 받습니다. shintx@naver.com

라스코니의 이미지

무시되지는 않지만 놓칠수도 있습니다.
CPU 핀에는 interrupt 라인이라는 것이 달려 있는데 그 곳을 통해서 인터럽트 신호가 전달됩니다. 인터럽트를 금지하면 그 핀을 통해서 온 신호를 CPU가 읽어가지 않습니다. 인터럽트를 다시 enable하면 읽어가죠. 그래서 무시되지는 않습니다.

하지만 인터럽트 신호는 queue가 있는 체계가 아니라서 한번 왔는지 세번 왔는지 알수 있는 도리가 없습니다. 그래서 ISR() 함수를 짧게 만들어야 하는 이유죠. ISR() 함수를 처리하고 있는동안 똑같은 인터럽트가 세번 왔다면 그것을 CPU는 한번만 도착했다고 생각하게 될 것입니다. 그래서 놓치는 인터럽트도 발생할 수 있죠.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.