KERNEL
Posts
183 posts[리눅스커널] 인터럽트 후반부 처리: setup_irq_thread() 함수 분석
이어서 IRQ 스레드를 생성 역할을 수행하는 setup_irq_thread() 함수를 분석하겠습니다.1 static int2 setup_irq_thread(struct irqaction *new, unsigned int irq, bool secondary)3 {4struct task_struct *t;5struct sched_param param = {6.sched_priority = MAX_USER_RT_PRIO/2,7};89if (!secondary) {10t = kthread_create(irq_thread, new, "irq/%d-%s", irq, 11 new->name);12} else {13t = kthread_create(irq_thread, new, "i
[리눅스커널] 워크큐: 워커 쓰레드 핸들 worker_thread() 함수 분석
워크는 워커 쓰레드가 실행합니다. 워커 쓰레드를 관리하는 자료구조는 struct worker 구조체이며 이를 워커라고 부릅니다. 이전 절까지는 자료구조 중심으로 워크를 분석했는데 이번에는 워커 쓰레드가 쓰레드 관점으로 어떻게 실행하는지 알아봅니다. 다음은 워커 자료구조인 struct worker 구조체 선언부입니다.[https://elixir.bootlin.com/linux/v4.14.43/source/kernel/workqueue_internal.h#L24]1 struct worker {2union {3struct list_headentry; 4struct hlist_nodehentry; 5};6struct work_struct*current_work;7work_func_tcu
[리눅스커널][스케줄링] 유저 프로세스 실행 중 인터럽트 발생으로 선점 스케줄링
선점 스케줄링 실행 진입점 중 하나가 인터럽트를 핸들링 후 입니다. 이번 소절에서 유저 프로세스가 실행하던 도중 인터럽트가 발생했을 때 어떤 방식으로 선점 스케줄링(Preemption)이 시작하는지 살펴보겠습니다. 다음 블록 다이어그램을 같이 봅시다. 위 블록 다이어그램은 유저 레벨 프로세스가 실행 도중 선점 스케줄링되는 흐름도입니다.유저 레벨 프로세스 실행 도중 선점 스케줄링은 다음 과정으로 실행합니다. 1. 인터럽트가 발생해서 __irq_usr란 인터럽트 벡터 실행 2. 인터럽트 핸들러 실행으로 인터럽트 핸들링 마무리 3. __irq_usr 레이블에서 ret_to_user_from_irq 레이블 실행 4. 프로세스 struct thread_info 구조체 flags 필드를 점검해서 _TI
[리눅스커널] 인터럽트 후반부 처리: IRQ 스레드 생성 예제 코드 분석
이번에는 IRQ 스레드를 생성하는 예제 코드를 소개합니다. 실제 request_threaded_irq() 함수를 호출해서 IRQ 스레드를 생성하는 과정을 살펴보겠습니다. 분석할 코드는 다음과 같습니다.[https://elixir.bootlin.com/linux/v4.14.30/source/drivers/usb/dwc3/gadget.c]1 static int dwc3_gadget_start(struct usb_gadget *g,2 struct usb_gadget_driver *driver)3 {4 struct dwc3 *dwc = gadget_to_dwc(g);5 unsigned long flags;6 int ret = 0;7 int irq;89 irq = dwc->irq_gadget;1



