From: jianhai luan <jianhai.luan@oracle.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: annie li <annie.li@oracle.com>,
xen-devel@lists.xenproject.org,
Ian Campbell <Ian.Campbell@citrix.com>,
netdev@vger.kernel.org
Subject: Re: [Xen-devel] DomU's network interface will hung when Dom0 running 32bit
Date: Wed, 16 Oct 2013 23:04:34 +0800 [thread overview]
Message-ID: <525EAB02.9050207@oracle.com> (raw)
In-Reply-To: <20131016134740.GG16371@zion.uk.xensource.com>
[-- Attachment #1: Type: text/plain, Size: 2170 bytes --]
On 2013-10-16 21:47, Wei Liu wrote:
> On Wed, Oct 16, 2013 at 09:08:03PM +0800, jianhai luan wrote:
> [...]
>>>>> expires now next_credit
>>>>> ----time increases this direction--->
>>>>>
>>>>> * time_after_eq(now, next_credit) -> false
>>>>> * time_before(now, expires) -> false
>>>>>
>>>>> Then it's stuck again. You're merely narrowing the window, not fixing
>>>>> the real problem.
>>>> The above environment isn't stack again. The netback will
>>>> pending one timer to process the environment.
>>>>
>>>> The attachment program will prove if !(time_after_eq(now,
>>>> next_credit) || time_before(now, vif->credit_timeout.expires)),
>>>> now will only be placed in above environment [ expires
>>>> next_credit), and the above environment will be processed by
>>>> timer in soon.
>>> Or check following to see what the if condition really do,
>>>
>>> ----------expires-------now-------credit---------- is the only
>>> case where we need to add a timer.
>>>
>>> Other cases like following would match the if condition above,
>>> then no timer is added.
>>> ----------expires----------credit------now------
>>> -----now-----expires----------credit----------
>>>
>>> Or we can consider the extreme condition, when the rate control
>>> does not exist, "credit_usec" is zero, and "next_credit" is equal
>>> to "expires". The above if condition would cover all conditions,
>>> and no rate control really happens. If credit_usec is not zero,
>>> the "if condition" would cover the range outside of that from
>>> expires to next_credit.
>>>
>>> Even if "now" is wrapped again into the range from "expires" to
>>> "next_credit", the "next_credit" that is set in __mod_timer is
>>> reasonable value(this can be gotten from credit_usec), and the
>>> timer would be hit soon.
>> Thanks Annie's express, my option is consistent with Annie.
>>
> OK, thanks for the explanation. I think I get the idea.
>
> In any case, could you use !time_in_range / !time_in_range_open instead
> of open coded one-liner? Though I presume one-liner open coding would
> not hurt.
I agree above the suggest. The attachment patch may be better than
previous patch.
Jason
>
> Wei.
[-- Attachment #2: 0001-xen-netback-pending-timer-only-in-the-range-expire-n.patch --]
[-- Type: text/plain, Size: 1627 bytes --]
>From ef02403a10173896c5c102f768741d0700b8a3a2 Mon Sep 17 00:00:00 2001
From: Jason Luan <jianhai.luan@oracle.com>
Date: Tue, 15 Oct 2013 17:07:49 +0800
Subject: [PATCH] xen-netback: pending timer only in the range [expire,
next_credit)
The function time_after_eq() do correct judge in range of MAX_UNLONG/2.
If net-front send lesser package, the delta between now and next_credit
will out of the range and time_after_eq() will do wrong judge in result
to net-front hung. For example:
expire next_credit .... next_credit+MAX_UNLONG/2 now
-----------------time increases this direction----------------->
We should be add the environment which now beyond next_credit+MAX_UNLONG/2.
Because the fact now mustn't before expire, time_before(now, expire) == true
will show the environment.
time_after_eq(now, next_credit) || time_before (now, expire)
==
!time_in_range_open(now, expire, next_credit)
Signed-off-by: Jason Luan <jianhai.luan@oracle.com>
---
drivers/net/xen-netback/netback.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index f3e591c..62492f0 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -1195,7 +1195,7 @@ static bool tx_credit_exceeded(struct xenvif *vif, unsigned size)
return true;
/* Passed the point where we can replenish credit? */
- if (time_after_eq(now, next_credit)) {
+ if (!time_in_range(now, vif->credit_timeout.expires, next_credit)) {
vif->credit_timeout.expires = now;
tx_add_credit(vif);
}
--
1.7.6.5
next prev parent reply other threads:[~2013-10-16 15:04 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-12 8:53 DomU's network interface will hung when Dom0 running 32bit jianhai luan
2013-10-14 11:19 ` Wei Liu
2013-10-14 11:19 ` Wei Liu
2013-10-15 2:44 ` jianhai luan
2013-10-15 2:44 ` jianhai luan
2013-10-15 8:43 ` Ian Campbell
2013-10-15 8:43 ` Ian Campbell
2013-10-15 9:34 ` jianhai luan
2013-10-15 9:34 ` jianhai luan
2013-10-15 10:06 ` Wei Liu
2013-10-15 11:26 ` jianhai luan
2013-10-15 11:26 ` jianhai luan
2013-10-15 12:58 ` Wei Liu
2013-10-15 12:58 ` Wei Liu
2013-10-15 14:29 ` jianhai luan
2013-10-15 14:49 ` Wei Liu
2013-10-15 14:49 ` Wei Liu
2013-10-15 14:50 ` Ian Campbell
2013-10-15 15:19 ` jianhai luan
2013-10-15 15:19 ` jianhai luan
2013-10-15 16:03 ` Wei Liu
2013-10-15 16:03 ` Wei Liu
2013-10-15 16:23 ` jianhai luan
2013-10-15 16:23 ` jianhai luan
2013-10-16 0:15 ` jianhai luan
2013-10-16 0:15 ` jianhai luan
2013-10-15 14:50 ` Ian Campbell
2013-10-15 14:29 ` jianhai luan
2013-10-16 7:35 ` jianhai luan
2013-10-16 9:39 ` [Xen-devel] " annie li
2013-10-16 13:08 ` jianhai luan
2013-10-16 13:47 ` Wei Liu
2013-10-16 15:04 ` jianhai luan
2013-10-16 15:04 ` jianhai luan [this message]
2013-10-16 15:17 ` Wei Liu
2013-10-16 15:17 ` [Xen-devel] " Wei Liu
2013-10-16 16:11 ` David Vrabel
2013-10-16 16:11 ` [Xen-devel] " David Vrabel
2013-10-16 16:44 ` jianhai luan
2013-10-16 16:44 ` [Xen-devel] " jianhai luan
2013-10-16 15:26 ` annie li
2013-10-16 15:26 ` [Xen-devel] " annie li
2013-10-16 13:47 ` Wei Liu
2013-10-16 13:08 ` jianhai luan
2013-10-16 9:39 ` annie li
2013-10-16 7:35 ` jianhai luan
2013-10-15 10:06 ` Wei Liu
2013-10-16 7:10 ` annie li
2013-10-16 7:10 ` annie li
2013-10-16 8:46 ` Ian Campbell
2013-10-16 8:46 ` Ian Campbell
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=525EAB02.9050207@oracle.com \
--to=jianhai.luan@oracle.com \
--cc=Ian.Campbell@citrix.com \
--cc=annie.li@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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 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.