Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8002757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:27:35+00:00 2026-06-04T16:27:35+00:00

In the Linux Device Drivers. When it introduces spinlocks, it gives the following example:

  • 0

In the Linux Device Drivers. When it introduces spinlocks, it gives the following example:

Your driver is executing and has just taken out a lock that controls
access to its device. While the lock is held, the device issues an
interrupt, which causes your interrupt handler to run. The interrupt
handler, before accessing the device, must also obtain the lock.
Taking out a spinlock in an interrupt handler is a legitimate thing to
do; that is one of the reasons that spinlock operations do not sleep.
But what happens if the interrupt routine executes in the same
processor as the code that took out the lock originally? While the
interrupt handler is spinning, the noninterrupt code will not be able
to run to release the lock. That processor will spin forever.

How to solve this issue? Using semaphores? Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:27:37+00:00Added an answer on June 4, 2026 at 4:27 pm

    You use spin_lock_irqsave from non-interrupt code to disable hardware interrupts on the current core, or use any of the tools that are described in the “Alternatives to Locking” section in the same chapter.

    Edit 0:

    Don’t remember the exact details there, but the theory is that:

    • On UP systems you don’t need spin locks at all – disabling interrupts from the BH code that accesses data shared with interrupt handlers is enough.
    • On SMP systems you need a spinlock to protect from same BH code executing on other cores, and, if you deal with hardware, you also want to disable interrupts on the same core to avoid deadlocking with the IRQ routine.
    • The interrupt handler always needs to disable interrupts while holding any locks to avoid deadlocking with itself.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am following the Linux Device Drivers. When it introduces spinlocks, it gives the
I m bit confused by the following statement in linux device drivers book. http://www.linuxdriver.co.il/ldd3/
I am rather new to Linux device driver programmring, but for debugging purposes, I
I am using embedded-linux for device which has Arch ARMv5 Speed 266MHZ, vfpu and
Recently, i began developing a driver of an embedded device running linux. Until now
I'm trying to learn about device drivers on Linux Kernel, for that I've created
I have a Linux device driver that interfaces to a device that, in theory,
I'm writing a kernel object (.ko file, which is usually device driver) of Linux.
I'm learning about the blocking I/O functions for writing linux device driver and I'm
I'm reading Linux Device Driver programming 3rd edition and I've been trying to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.