LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-27-2021, 01:56 PM   #1
zvivered
Member
 
Registered: Sep 2007
Posts: 294

Rep: Reputation: 23
Signals vs. IOCTL: Notify interrupts to user space


Hello,

My hardware is creating an interrupt handled by a kernel driver.
In order to notify the application there are 2 ways (that I know about):

1. Send a signal from driver to user space
2. User space can send IOCTL answered upon interrupt.

Can you please tell if one method is better than the other ?
What method is more popular ?

Thank you,
Zvika
 
Old 10-27-2021, 05:41 PM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,691
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
I suggest that you "send a signal." The signal-handler can then use IOCTL to find whatever else it needs to know – and it can do so at any convenient time as it sees fit.

The whole idea is to avoid so-called "busy waiting."

Your first-level interrupt handler should gather all of the necessary information into a place that the IOCTL can then retrieve. Then, it launches a user-space signal, unless it notices that a signal has already been launched. The userland program "only pays attention to the telephone because it is ringing."

Last edited by sundialsvcs; 10-27-2021 at 05:44 PM.
 
1 members found this post helpful.
Old 10-28-2021, 08:18 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,753

Rep: Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983
Quote:
Originally Posted by zvivered View Post
Hello,
My hardware is creating an interrupt handled by a kernel driver. In order to notify the application there are 2 ways (that I know about):

1. Send a signal from driver to user space
2. User space can send IOCTL answered upon interrupt.

Can you please tell if one method is better than the other ? What method is more popular ?
You've been asking about kernel modules/code for years at this point:
https://www.linuxquestions.org/quest...on-4175697514/

Is there some point at which you'll be able to apply things you've been told and learned?? You've been asking about/working with IOCTL for TWELVE YEARS now; and that question is nearly IDENTICAL to this one:
https://www.linuxquestions.org/quest...-space-746821/
 
Old 10-29-2021, 11:56 AM   #4
zvivered
Member
 
Registered: Sep 2007
Posts: 294

Original Poster
Rep: Reputation: 23
Hi,

Strange. I downloaded long term linux-5.10.76.tar.xz
and looked for send_sig_info in drivers folder.
There are only 3 (!!!) drivers that use it.

If using signals is better than IOCTLs (for application to be notified on interrupts) why it is almost not used ?
My collegue claims that with signals, the time between the interrupt to the notification in the application is much shorter compared to using IOCTL.

Thank you,
Zvika
 
Old 10-29-2021, 12:18 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,753

Rep: Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983
Quote:
Originally Posted by zvivered View Post
Hi,
Strange. I downloaded long term linux-5.10.76.tar.xz and looked for send_sig_info in drivers folder. There are only 3 (!!!) drivers that use it.

If using signals is better than IOCTLs (for application to be notified on interrupts) why it is almost not used ? My collegue claims that with signals, the time between the interrupt to the notification in the application is much shorter compared to using IOCTL.
Still don't have any idea why you're asking. You've been working on this for twelve years...you have a 'colleague' who works with you on this. So why don't you and your 'colleague' try both approaches on your hardware, and see which works better for you??? Run some actual tests....do some actual work on your own actual hardware.
 
Old 10-29-2021, 01:38 PM   #6
zvivered
Member
 
Registered: Sep 2007
Posts: 294

Original Poster
Rep: Reputation: 23
Hi,

Before changing approach to signals,
I have to be sure that this method is better than using IOCTL based on the experience of the experts here.

Thank you,
Zvika
 
Old 10-29-2021, 01:57 PM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,753

Rep: Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983
Quote:
Originally Posted by zvivered View Post
Hi,
Before changing approach to signals, I have to be sure that this method is better than using IOCTL based on the experience of the experts here.
Wrong: you need to make sure it's better by actually testing it for your own purposes on your own hardware by doing your own work (bold for emphasis). What works in one scenario may not work as well for others, so the excuse of, "I need experts else to tell me" isn't believable.

Again, you have been working on this for TWELVE YEARS now; you have repeatedly asked about kernel modules/hardware/etc., so there is *ABSOLUTELY NOTHING* stopping you from testing things. If this is for your work, you have ample time/resources to do the best job you can; there is no reason NOT to try both approaches. You and your 'colleague' can work together, can't you?? If your 'colleague' says it's better and you say different, then you can ask them to prove it.

Do actual work; run tests; benchmark things. Again, none of this is nothing you haven't been told before, MANY TIMES:
https://www.linuxquestions.org/quest...er-4175695475/
https://www.linuxquestions.org/quest...-a-4175685514/
https://www.linuxquestions.org/quest...ng-4175671805/
https://www.linuxquestions.org/quest...ct-4175669923/
https://www.linuxquestions.org/quest...-a-4175668757/

Last edited by TB0ne; 10-30-2021 at 09:45 AM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Notifications don't show up (notify-send notify-osd) michal017 Linux - Desktop 0 05-06-2014 03:44 PM
Can anyone please explain about "Function call interrupts" entry in /proc/interrupts? cyclops.xmen Linux - Software 2 12-09-2009 12:13 PM
notify user space application from the kernel space lordofring Linux - Software 2 06-22-2009 12:32 PM
How to interrupts work queue with signals iamjayanth Linux - Kernel 1 11-10-2008 04:39 AM
C++ RS232/serial port - problem with signals or interrupts muzic Programming 14 08-12-2008 01:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration