public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Karthik Vadambacheri Manian <karthikvm.uc@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: Receiving delayed packets from RTL8139 card in KVM
Date: Thu, 26 Aug 2010 11:14:31 +0300	[thread overview]
Message-ID: <4C762267.9020504@redhat.com> (raw)
In-Reply-To: <AANLkTim0iGvRe4J+P72X9p4T-HpwPnZ2yKvFmxA1Gzpu@mail.gmail.com>

  On 08/26/2010 05:10 AM, Karthik Vadambacheri Manian wrote:
> Hi Avi,
>
>> There may be a missing wakeup in the networking path.  You can try adding
>> printf()s in RTL8139's receive function, and in kvm_set_irq_level() to see
>> if there's a problem in interrupt flow.
> Thanks for your insights. I debugged the RTL8139's receive function
> rtl8139_do_receive() and the functions rtl8139_update_irq()
> (responsible for initiating the rtl8139 interrupts) and
> kvm_set_irq_level(). I came to know that the packets were not delayed
> as opposed to previous assumption. Also the interrupts were promptly
> provided by the rtl8139 using rtl8139_update_irq(). Also it seems
> kvm_set_irq_level() injects the interrupts to the guest properly.
>
> But inside the guest(kitten LWK) I see the number of interrupts to be
> less than what is injected from KVM. This may be due to the interrupts
> being coalesced in KVM before injection or the guest somehow misses
> some interrupts. I feel the coalescing of the interrupts may cause the
> problem in my application. For eg. Two packets needs to be received,
> hence instead of injecting two interrupts only one coalesced interrupt
> is injected to the guest. The RTL8139 driver in guest on receiving the
> coalesced interrupt reads the first packet(which is present in buffer)
> but when it tries to read the next packet immediately, the packet has
> not yet arrived to the guest's RTL8139's buffer hence it assumes no
> more data and returns. The second packet here is not received leading
> to retransmission. But in this scenario if a second interrupt occured
> then the driver would have once again checked the buffer to find the
> data available thereby avoiding retransmission.
>
> Please let me know what is the minimum time between interrupts to be
> considered for coalescing. Is it possible to reduce this time further
> as it will be useful in my case. Please let me know your comments on
> this issue.

Interrupts are not coalesced based on time; the interrupt is 
level-triggered, which means it is raised as long as it is not masked by 
the guest.

The guest ISR should look something like this:

ISR:
    mask interrupt
    process all packets
    unmask interrupts
    if packets have become available:
      goto ISR


-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2010-08-26  8:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20  1:01 Receiving delayed packets from RTL8139 card in KVM Karthik Vadambacheri Manian
2010-08-22 10:14 ` Avi Kivity
2010-08-26  2:10   ` Karthik Vadambacheri Manian
2010-08-26  8:14     ` Avi Kivity [this message]
2010-08-27 21:47       ` Karthik Vadambacheri Manian
2010-08-29  8:18         ` Avi Kivity

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=4C762267.9020504@redhat.com \
    --to=avi@redhat.com \
    --cc=karthikvm.uc@gmail.com \
    --cc=kvm@vger.kernel.org \
    /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