All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: chengkaitao <pilgrimtao@gmail.com>
Cc: linux-kernel@vger.kernel.org, smuchun@gmail.com,
	Kaitao Cheng <pilgrimtao@gmail.com>
Subject: Re: [RESEND v2] irq: Refactor irq_wait_for_interrupt info to simplify the code
Date: Wed, 15 Jan 2020 14:43:14 +0100	[thread overview]
Message-ID: <877e1sg7il.fsf@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20200106154430.3413-1-pilgrimtao@gmail.com>

chengkaitao <pilgrimtao@gmail.com> writes:
> From: Kaitao Cheng <pilgrimtao@gmail.com>
>
> Cleanup extra if(test_and_clear_bit), and put the other one in front.

That simplifies the code but opens a race window:

 CPU 0                                CPU 1
                                      irq_wait_for_interrupt()
                                        has not yet reached schedule()
 free_irq()
   remove_action();
   synchronize_irq();                   

   #ifdef CONFIG_DEBUG_SHIRQ
    action->handler()                   if (test_and_clear_bit())
                            ---> bit is not set yet                                           
      --> SET thread running
   #endif                               

   kthread_stop()                       if (kthread_stop())

                   ---> Leave with bit set and thread active count != 0

That's just the most obvious example...

Thanks,

        tglx

      reply	other threads:[~2020-01-15 13:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 15:44 [RESEND v2] irq: Refactor irq_wait_for_interrupt info to simplify the code chengkaitao
2020-01-15 13:43 ` Thomas Gleixner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877e1sg7il.fsf@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pilgrimtao@gmail.com \
    --cc=smuchun@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.