Sponsored Content
Top Forums Programming Getting notified in user-space on interrupts Post 302432858 by mylinuxforums on Sunday 27th of June 2010 04:55:41 PM
Old 06-27-2010
Getting notified in user-space on interrupts

Hi,
I'm working on an AMD opteron running Linux 2.6.28.6
I want to preload a module specific register (MSR) with a value to have it overflow after a number of a specific event counts. As I understand, when the counter in the register overflows, an interrupt will be generated and handled by the appropriate interrupt handler. How can my user-level application get notified whenever the interrupt occurs? I want to know the instruction that caused the overflow. Is this possible?
I think this is different than responding to signals with sigaction(). I never dealt with interrupts before, so any help is appreciated.

Thanks
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Does unix use interrupts?

I'm a freshman here and I have a simple question. Does unix use interrupts which is like Dos? Are they the same? Thx.:cool: (6 Replies)
Discussion started by: Frank_M
6 Replies

2. UNIX for Dummies Questions & Answers

catching interrupts

hey i have been facing a problem,can you tell me if we can catch ctrl d in unix i have tried and sucessfully catched and disabled ctrl-c and ctrl -z but am not sure if we can do the same for CTRL-D, so got any clue mail on he forum or ...i mean c programming in Unix thats what i am working on (1 Reply)
Discussion started by: toughguy2handle
1 Replies

3. UNIX for Dummies Questions & Answers

Traps and Interrupts

Well, I don't know where exactly to ask this doubt so I'm asking in the newbie section. I was reading about traps and interrupts when I thought of traps as something that cease the control of the OS from the user and interrupts that cease the control yet provide support for multitasking. Am I right... (3 Replies)
Discussion started by: Legend986
3 Replies

4. Shell Programming and Scripting

Can users be notified of the disk failures.

Hi All, Just wanted to know if there is any way by which users can be notified about the failures in disks on Red Hat linux systems. Thanks for all the help!! nua7 (4 Replies)
Discussion started by: nua7
4 Replies

5. UNIX for Dummies Questions & Answers

about concept of Interrupts.

Hi all, I am new here ,i want to know about interrupts in detail.What r Interrupts .how they r handeled. Thanx in adavnce. (1 Reply)
Discussion started by: vishwasrao
1 Replies

6. UNIX for Advanced & Expert Users

wake up user space thread from kernel space ISR

Hello, I'm searching for a proper way to let the kernel space ISR(implemented in a kernel module) wake up a user space thread on a hardware interrupt. Except for sending a real-time signal, is it possible to use a semaphore? I've searched it on google, but it seems impossible to share a... (0 Replies)
Discussion started by: aaronwong
0 Replies

7. Programming

Question on interrupts and user space app

Can a user space application be asynchronously affected of its normal execution course by an interrupt? How does the driver know which user space process to interrupt? What are the functions in user space and kernel drivers that achieve this? (1 Reply)
Discussion started by: dragonpoint
1 Replies

8. Programming

Signalling interrupts to user space

What is the simplest function I can use to signal an interrupt from kernel module to user space. I knw the usr app pid in my module. Also can someone explain the parameters in kill_fasync and send_sig (0 Replies)
Discussion started by: dragonpoint
0 Replies

9. Shell Programming and Scripting

How to get notified when screenshots are taken?

Hi, I use third-party softwares but like to get notified when screenshots, if any, are taken. Any hints on how to achieve it? Thanks, Riku Linux 3.19.0-56-generic #62~14.04.1-Ubuntu SMP Fri Mar 11 11:03:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux Ubuntu 14.04.3 LTS (3 Replies)
Discussion started by: rikuito
3 Replies

10. UNIX for Beginners Questions & Answers

Accessing the user space of one OS from within another.

Recently, I setup a dual boot on this PC. I can currently jump from Ubuntu 12.04 and 16.04. What I would like to be able to do is access the home directory of my 16.04 OS from within the 12.04, is that possible? I can mount the partition of the hard drive where 16.04 lives from within 12.04 but it... (4 Replies)
Discussion started by: Circuits
4 Replies
PAPI_overflow(3)						       PAPI							  PAPI_overflow(3)

NAME
PAPI_overflow - Set up an event set to begin registering overflows. SYNOPSIS
Detailed Description PAPI_overflow() marks a specific EventCode in an EventSet to generate an overflow signal after every threshold events are counted. More than one event in an event set can be used to trigger overflows. In such cases, the user must call this function once for each overflowing event. To turn off overflow on a specified event, call this function with a threshold value of 0. Overflows can be implemented in either software or hardware, but the scope is the entire event set. PAPI defaults to hardware overflow if it is available. In the case of software overflow, a periodic timer interrupt causes PAPI to compare the event counts against the threshold values and call the overflow handler if one or more events have exceeded their threshold. In the case of hardware overflow, the counters are typically set to the negative of the threshold value and count up to 0. This zero-crossing triggers a hardware interrupt that calls the overflow handler. Because of this counter interrupt, the counter values for overflowing counters may be very small or even negative numbers, and cannot be relied upon as accurate. In such cases the overflow handler can approximate the counts by supplying the threshold value whenever an overflow occurs. _papi_overflow_handler() is a placeholder for a user-defined function to process overflow events. A pointer to this function is passed to the PAPI_overflow routine, where it is invoked whenever a software or hardware overflow occurs. This handler receives the EventSet of the overflowing event, the Program Counter address when the interrupt occured, an overflow_vector that can be processed to determined which event(s) caused the overflow, and a pointer to the machine context, which can be used in a platform-specific manor to extract register information about what was happening when the overflow occured. C Interface: #include <papi.h> int PAPI_overflow (int EventSet, int EventCode, int threshold, int flags, PAPI_overflow_handler_t handler ); (*PAPI_overflow_handler_t) _papi_overflow_handler (int EventSet, void *address, long_long overflow_vector, void *context ); Fortran Interface: Not implemented Parameters: EventSet -- an integer handle to a PAPI event set as created by PAPI_create_eventset EventCode -- the preset or native event code to be set for overflow detection. This event must have already been added to the EventSet. threshold -- the overflow threshold value for this EventCode. flags -- bitmap that controls the overflow mode of operation. Set to PAPI_OVERFLOW_FORCE_SW to force software overflowing, even if hardware overflow support is available. If hardware overflow support is available on a given system, it will be the default mode of operation. There are situations where it is advantageous to use software overflow instead. Although software overflow is inherently less accurate, with more latency and processing overhead, it does allow for overflowing on derived events, and for the accurate recording of overflowing event counts. These two features are typically not available with hardware overflow. Only one type of overflow is allowed per event set, so setting one event to hardware overflow and another to forced software overflow will result in an error being returned. handler -- pointer to the user supplied handler function to call upon overflow address -- the Program Counter address at the time of the overflow overflow_vector -- a long long word containing flag bits to indicate which hardware counter(s) caused the overflow *context -- pointer to a machine specific structure that defines the register context at the time of overflow. This parameter is often unused and can be ignored in the user function. Return values: PAPI_OK On success, PAPI_overflow returns PAPI_OK. PAPI_EINVAL One or more of the arguments is invalid. Most likely a bad threshold value. PAPI_ENOMEM Insufficient memory to complete the operation. PAPI_ENOEVST The EventSet specified does not exist. PAPI_EISRUN The EventSet is currently counting events. PAPI_ECNFLCT The underlying counter hardware cannot count this event and other events in the EventSet simultaneously. Also can happen if you are trying to overflow both by hardware and by forced software at the same time. PAPI_ENOEVNT The PAPI event is not available on the underlying hardware. Example * // Define a simple overflow handler: * void handler(int EventSet, void *address, long_long overflow_vector, void *context) * { * fprintf(stderr, * address,overflow_vector); * } * * // Call PAPI_overflow for an EventSet containing PAPI_TOT_INS, * // setting the threshold to 100000. Use the handler defined above. * retval = PAPI_overflow(EventSet, PAPI_TOT_INS, 100000, 0, handler); * See Also: PAPI_get_overflow_event_index Author Generated automatically by Doxygen for PAPI from the source code. Version 5.2.0.0 Tue Jun 17 2014 PAPI_overflow(3)
All times are GMT -4. The time now is 07:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy