mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: luoben <luoben@linux.alibaba.com>
Cc: alex.williamson@redhat.com, linux-kernel@vger.kernel.org,
	tao.ma@linux.alibaba.com, gerry@linux.alibaba.com,
	nanhai.zou@linux.alibaba.com, linyunsheng@huawei.com
Subject: Re: [PATCH v3 2/3] genirq: introduce update_irq_devid()
Date: Mon, 19 Aug 2019 10:18:42 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1908191005530.1923@nanos.tec.linutronix.de> (raw)
In-Reply-To: <8161633d-638d-f4b2-f225-462f711c1212@linux.alibaba.com>

[-- Attachment #1: Type: text/plain, Size: 1906 bytes --]

Ben,

On Mon, 19 Aug 2019, luoben wrote:
> 在 2019/8/15 下午10:58, Thomas Gleixner 写道:
> > > This narrows the gap for setting up new irq (and irte, if has)
> > What does that mean: "narrows the gap"
> > 
> > What's the gap and why is it only made smaller and not closed?
> 
> Sorry for confusing. The so called 'gap' is a time window between free_irq()
> and request_irq().

And exactly this information wants to be in the changelog.
 
> > function please. Also it does not matter whether the time is short or
> > not. The point is:
> > 
> >       	 Ensure that an interrupt in flight on another CPU which uses
> > the
> >       	 old 'dev_id' has completed because the caller can free the
> > memory
> > 	 to which it points after this function returns.
> > 
> > But this has another twist:
> > 
> >      CPU0				CPU1
> > 
> >      interrupt
> >      	primary_handler(old_dev_id)
> > 	   do_stuff_on(old_dev_id)
> > 	   return WAKE_THREAD;		update_dev_id()
> >          wakeup_thread();
> > 					  action->dev_id = new_dev_id;
> >      irq_thread()
> >          secondary_handler(new_dev_id)
> > 	
> > That's broken and synchronize_irq() does not protect against it.
> 
> Thanks to point it out, I will change to the following in next version, is
> that ok?
> 
> ...
> 
>     /*

  ^^^
Please use a mail client which does not insert random wierd characters.

>      * Ensure that an interrupt in flight on another CPU which uses the
>      * old 'dev_id' has completed because the caller can free the memory
>      * to which it points after this function returns. And also void to

s/void/avoid/

>      * update 'dev_id' in the middle of a threaded interrupt process, it
>      * can lead to a twist that primary handler uses old 'dev_id' but new
>      * 'dev_id' is used by secondary handler.
>      */
>     disable_irq(irq);

Yes, that works.

Thanks,

	tglx

  reply	other threads:[~2019-08-19  8:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15 13:02 [PATCH v3 0/3] genirq/vfio: Introduce update_irq_devid and optimize VFIO irq ops Ben Luo
2019-08-15 13:02 ` [PATCH v3 1/3] genirq: enhance error recovery code in free irq Ben Luo
2019-08-15 14:20   ` Thomas Gleixner
2019-08-15 13:03 ` [PATCH v3 2/3] genirq: introduce update_irq_devid() Ben Luo
2019-08-15 14:58   ` Thomas Gleixner
2019-08-19  5:31     ` luoben
2019-08-19  8:18       ` Thomas Gleixner [this message]
2019-08-15 13:03 ` [PATCH v3 3/3] vfio_pci: make use of update_irq_devid and optimize irq ops Ben Luo
2019-08-15 16:45   ` Thomas Gleixner
     [not found]     ` <7a3606ad-8fa6-45d5-b5a4-ee3f07893a25@linux.alibaba.com>
2019-08-20 15:27       ` Liu, Jiang
2019-08-22 13:41         ` luoben
2019-08-19 20:51 ` [PATCH v3 0/3] genirq/vfio: Introduce update_irq_devid and optimize VFIO " Alex Williamson
2019-08-20  4:03   ` luoben
2019-08-20 15:22     ` Alex Williamson
2019-08-20 15:51       ` luoben

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=alpine.DEB.2.21.1908191005530.1923@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=alex.williamson@redhat.com \
    --cc=gerry@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linyunsheng@huawei.com \
    --cc=luoben@linux.alibaba.com \
    --cc=nanhai.zou@linux.alibaba.com \
    --cc=tao.ma@linux.alibaba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®