SlideShare a Scribd company logo
1 of 11
Download to read offline
LINUX AYGIT SURUCUSU
GELISTIRME
Dursun Can TURAN
BRAXP Bilişim Sistemleri
ONCEKI DERS NE YAPTIK
• Donanımla ile haberleşme yöntemlerini inceledik
• I/O Port ve I/O Hafızası ile RAM ve cihaz registerları arasındaki farkı
gösterdik
• Memory Barrier (Hafıza Bariyeri) kullanımını gördük
• Portlara erişim ve portları kullanabilmek için alan talep etmeyi öğrendik
• Port değerlerine user space ve kernel spaceden eriştik
• I/O hafıza eşleme ve eşlenen hafızadaki verilere erişmeyi öğrendik
• ISA ve PCI arayüzlerini özetledik
INTERRUPT NEDİR?
• İşlevine göre
• Maskable Interrupt
• Non-maskable Interrupt
• Inter-process Interrupt
• Software Interrupt
• Spurious Interrupt
• Fiziksel olarak
• Level-triggered
• Edge-triggered
• Hybrid
• Message-signaled
INTERRUPT HANDLING (KESME YAKALAMA)
• /proc/interrupts ve /proc/stat dosyasındaki “intr” belirteci
• <linux/interrupt.h>
• int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long flags, const char *dev_name, void *dev_id);
• void free_irq(unsigned int irq, void *dev_id);
• Flags
• IRQF_SHARED (SA_SHIRQ)
• IRQF_TIMER (SA_INTERRUPT)
• IRQF_PERCPU
• IRQF_NOBALANCING
IRQ NUMARASI ELDE ETME
• int can_request_irq(unsigned int irq, unsigned long flags);
• Otomatik algılama
• Status byte, PCI, …
• Kernel destekli yoklama
• Manuel algılama
• Yoklama için kullanılan fonksiyonlar (<linux/interrupt.h>
• unsigned long probe_irq_on(void);
• int probe_irq_off(unsigned long);
HANDLER GERÇEKLEME
• Interrupt Context
• User space’ten veri alınamaz ve user space’e veri gönderilemez
• Bloklanan fonksiyonlar çalıştırılamaz
• wait_event çağrılamaz
• Bellek sadece GFP_ATOMIC flagi ile ayrılır
• Semaphore kullanımı
• schedule çağrılamaz
• “Interrupt pending” bit sıfırlama
• CPU zamanında kısa işler yapılmalı
• Eğer uzun işler yapılacaksa ya “tasklet”ler kullanılmalı ya da işlem uygun bir zamanda işlenilmek
üzere “workqueue”a eklenmelidir
HANDLER GERÇEKLEME
• irqreturn_t sample_interrupt(int irq, void *dev_id, struct pt_regs *regs);
• irqreturn_t
• IRQ_NONE
• IRQ_HANDLED
• IRQ_RETVAL(var);
INTERRUPTLARI KAPATMA
• <asm/irq.h>
• void disable_irq(int irq);
• void disable_irq_nosync(int irq);
• void enable_irq(int irq);
• <asm/system.h>
• void local_irq_save(unsigned long flags);
• void local_irq_disable(void);
• void local_irq_restore(unsigned long flags);
• void local_irq_enable (void);
TASKLET VS WORKQUEUE
Tasklet Workqueue
Software Interrupt Context Process Context
Sadece bir kere çalışır Birden çok kez çağrılabilir
CPU affinity CPU affinity zorunluluğu yok
Interrupt oluşabilir, bloklamamalıdır Interrupt oluşabilir, bloklayabilir
INTERRUPT DESTEKLİ I/O
• Okuma ve yazma interruptlarında gelen datayı bir tampon bellekte (buffer)
tutup kullanma fikri
ÖNÜMÜZDEKİ DERS
• Kernel Veri Türleri ve C standart türlerinin kullanımı
• Arayüze özel türlerin kullanımı
• Taşınabilirlik sorunları
• Kernelda bulunan ve sıklıkla kullanılan veri yapıları
• Aygıt modeli
• Bus, Device, Class yapıları
• Platform aygıt ve sürücüsü kavramları
• Kobject, Ksets ve alt sistemler
• Aygıtlarda firmware kullanımı

More Related Content

Featured

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 

Featured (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Linux Sürücü Geliştirme - 11 Interruptlar

  • 1. LINUX AYGIT SURUCUSU GELISTIRME Dursun Can TURAN BRAXP Bilişim Sistemleri
  • 2. ONCEKI DERS NE YAPTIK • Donanımla ile haberleşme yöntemlerini inceledik • I/O Port ve I/O Hafızası ile RAM ve cihaz registerları arasındaki farkı gösterdik • Memory Barrier (Hafıza Bariyeri) kullanımını gördük • Portlara erişim ve portları kullanabilmek için alan talep etmeyi öğrendik • Port değerlerine user space ve kernel spaceden eriştik • I/O hafıza eşleme ve eşlenen hafızadaki verilere erişmeyi öğrendik • ISA ve PCI arayüzlerini özetledik
  • 3. INTERRUPT NEDİR? • İşlevine göre • Maskable Interrupt • Non-maskable Interrupt • Inter-process Interrupt • Software Interrupt • Spurious Interrupt • Fiziksel olarak • Level-triggered • Edge-triggered • Hybrid • Message-signaled
  • 4. INTERRUPT HANDLING (KESME YAKALAMA) • /proc/interrupts ve /proc/stat dosyasındaki “intr” belirteci • <linux/interrupt.h> • int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *dev_name, void *dev_id); • void free_irq(unsigned int irq, void *dev_id); • Flags • IRQF_SHARED (SA_SHIRQ) • IRQF_TIMER (SA_INTERRUPT) • IRQF_PERCPU • IRQF_NOBALANCING
  • 5. IRQ NUMARASI ELDE ETME • int can_request_irq(unsigned int irq, unsigned long flags); • Otomatik algılama • Status byte, PCI, … • Kernel destekli yoklama • Manuel algılama • Yoklama için kullanılan fonksiyonlar (<linux/interrupt.h> • unsigned long probe_irq_on(void); • int probe_irq_off(unsigned long);
  • 6. HANDLER GERÇEKLEME • Interrupt Context • User space’ten veri alınamaz ve user space’e veri gönderilemez • Bloklanan fonksiyonlar çalıştırılamaz • wait_event çağrılamaz • Bellek sadece GFP_ATOMIC flagi ile ayrılır • Semaphore kullanımı • schedule çağrılamaz • “Interrupt pending” bit sıfırlama • CPU zamanında kısa işler yapılmalı • Eğer uzun işler yapılacaksa ya “tasklet”ler kullanılmalı ya da işlem uygun bir zamanda işlenilmek üzere “workqueue”a eklenmelidir
  • 7. HANDLER GERÇEKLEME • irqreturn_t sample_interrupt(int irq, void *dev_id, struct pt_regs *regs); • irqreturn_t • IRQ_NONE • IRQ_HANDLED • IRQ_RETVAL(var);
  • 8. INTERRUPTLARI KAPATMA • <asm/irq.h> • void disable_irq(int irq); • void disable_irq_nosync(int irq); • void enable_irq(int irq); • <asm/system.h> • void local_irq_save(unsigned long flags); • void local_irq_disable(void); • void local_irq_restore(unsigned long flags); • void local_irq_enable (void);
  • 9. TASKLET VS WORKQUEUE Tasklet Workqueue Software Interrupt Context Process Context Sadece bir kere çalışır Birden çok kez çağrılabilir CPU affinity CPU affinity zorunluluğu yok Interrupt oluşabilir, bloklamamalıdır Interrupt oluşabilir, bloklayabilir
  • 10. INTERRUPT DESTEKLİ I/O • Okuma ve yazma interruptlarında gelen datayı bir tampon bellekte (buffer) tutup kullanma fikri
  • 11. ÖNÜMÜZDEKİ DERS • Kernel Veri Türleri ve C standart türlerinin kullanımı • Arayüze özel türlerin kullanımı • Taşınabilirlik sorunları • Kernelda bulunan ve sıklıkla kullanılan veri yapıları • Aygıt modeli • Bus, Device, Class yapıları • Platform aygıt ve sürücüsü kavramları • Kobject, Ksets ve alt sistemler • Aygıtlarda firmware kullanımı