mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: luoben <luoben@linux.alibaba.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: tglx@linutronix.de, 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 0/3] genirq/vfio: Introduce update_irq_devid and optimize VFIO irq ops
Date: Tue, 20 Aug 2019 12:03:50 +0800	[thread overview]
Message-ID: <a1a8f8bc-07c0-2304-8550-7c302704fa4e@linux.alibaba.com> (raw)
In-Reply-To: <20190819145150.2d30669b@x1.home>


在 2019/8/20 上午4:51, Alex Williamson 写道:
> On Thu, 15 Aug 2019 21:02:58 +0800
> Ben Luo <luoben@linux.alibaba.com> wrote:
>
>> Currently, VFIO takes a lot of free-then-request-irq actions whenever
>> a VM (with device passthru via VFIO) sets irq affinity or mask/unmask
>> irq. Those actions only change the cookie data of irqaction or even
>> change nothing. The free-then-request-irq not only adds more latency,
>> but also increases the risk of losing interrupt, which may lead to a
>> VM hung forever in waiting for IO completion
> What guest environment is generating this?  Typically I don't see that
> Windows or Linux guests bounce the interrupt configuration much.
> Thanks,
>
> Alex

By tracing centos5u8 on host, I found it keep masking and unmasking 
interrupt like this:

[1566032533709879] index:28 irte_hi:000000010004a601 
irte_lo:adb54bc000b98001
[1566032533711242] index:28 irte_hi:0000000000000000 
irte_lo:0000000000000000
[1566032533711258] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533711269] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533711291] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533711321] index:28 irte_hi:0000000000000000 
irte_lo:0000000000000000
[1566032533711340] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533711361] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533711376] index:28 irte_hi:000000010004a601 
irte_lo:adb54bc000b98001
[1566032533713368] index:28 irte_hi:0000000000000000 
irte_lo:0000000000000000
[1566032533713385] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533713396] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533713416] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533713447] index:28 irte_hi:0000000000000000 
irte_lo:0000000000000000
[1566032533713464] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533713485] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533713499] index:28 irte_hi:000000010004a601 
irte_lo:adb54bc000b98001
[1566032533718855] index:28 irte_hi:0000000000000000 
irte_lo:0000000000000000
[1566032533718871] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533718882] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533718902] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533718932] index:28 irte_hi:0000000000000000 
irte_lo:0000000000000000
[1566032533718949] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533718969] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533718984] index:28 irte_hi:000000010004a601 
irte_lo:adb54bc000b98001
[1566032533719873] index:28 irte_hi:0000000000000000 
irte_lo:0000000000000000
[1566032533719889] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533719900] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533719921] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533719954] index:28 irte_hi:0000000000000000 
irte_lo:0000000000000000
[1566032533719971] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533719992] index:28 irte_hi:000000000004a601 
irte_lo:00003fff00ac002d
[1566032533720007] index:28 irte_hi:000000010004a601 
irte_lo:adb54bc000b98001

"[1566032533720007]" is timestamp in μs, so centos5u8 tiggers 30+ irte 
modification within 10ms

Thanks,

     Ben

>> This patchset solved the issue by:
>> Patch 2 introduces update_irq_devid to only update dev_id of irqaction
>> Patch 3 make use of update_irq_devid and optimize irq operations in VFIO
>>
>> changes from v2:
>>   - reformat to avoid quoted string split across lines and etc.
>>
>> changes from v1:
>>   - add Patch 1 to enhance error recovery etc. in free irq per tglx's comments
>>   - enhance error recovery code and debugging info in update_irq_devid
>>   - use __must_check in external referencing of update_irq_devid
>>   - use EXPORT_SYMBOL_GPL for update_irq_devid
>>   - reformat code of patch 3 for better readability
>>
>> Ben Luo (3):
>>    genirq: enhance error recovery code in free irq
>>    genirq: introduce update_irq_devid()
>>    vfio_pci: make use of update_irq_devid and optimize irq ops
>>
>>   drivers/vfio/pci/vfio_pci_intrs.c | 101 +++++++++++++++++++++-------------
>>   include/linux/interrupt.h         |   3 ++
>>   kernel/irq/manage.c               | 110 +++++++++++++++++++++++++++++++++-----
>>   3 files changed, 164 insertions(+), 50 deletions(-)
>>

  reply	other threads:[~2019-08-20  4:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15 13:02 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
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 [this message]
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=a1a8f8bc-07c0-2304-8550-7c302704fa4e@linux.alibaba.com \
    --to=luoben@linux.alibaba.com \
    --cc=alex.williamson@redhat.com \
    --cc=gerry@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linyunsheng@huawei.com \
    --cc=nanhai.zou@linux.alibaba.com \
    --cc=tao.ma@linux.alibaba.com \
    --cc=tglx@linutronix.de \
    /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®