From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752694AbbC0MpM (ORCPT ); Fri, 27 Mar 2015 08:45:12 -0400 Received: from mail-bn1on0147.outbound.protection.outlook.com ([157.56.110.147]:9120 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752385AbbC0MpH convert rfc822-to-8bit (ORCPT ); Fri, 27 Mar 2015 08:45:07 -0400 X-Greylist: delayed 880 seconds by postgrey-1.27 at vger.kernel.org; Fri, 27 Mar 2015 08:45:07 EDT From: Dexuan Cui To: Haiyang Zhang , KY Srinivasan CC: "jasowang@redhat.com" , Haiyang Zhang , "driverdev-devel@linuxdriverproject.org" , "olaf@aepfle.de" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] hv_vmbus: Add gradually increased delay for retries in vmbus_post_msg() Thread-Topic: [PATCH] hv_vmbus: Add gradually increased delay for retries in vmbus_post_msg() Thread-Index: AQHQZ0SQTPupRFOh/E6WzUWf6GoQxZ0wRGPA Date: Fri, 27 Mar 2015 12:30:17 +0000 Message-ID: References: <1427324319-14211-1-git-send-email-haiyangz@microsoft.com> In-Reply-To: <1427324319-14211-1-git-send-email-haiyangz@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [141.251.58.4] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-EOPAttributedMessage: 0 Authentication-Results: spf=pass (sender IP is 206.191.229.116) smtp.mailfrom=decui@microsoft.com; linuxdriverproject.org; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:206.191.229.116;CTRY:US;IPV:NLI;EFV:NLI;BMV:1;SFV:NSPM;SFS:(10019020)(6009001)(438002)(13464003)(189002)(199003)(51704005)(108616004)(106466001)(50466002)(86146001)(46102003)(24736003)(19580395003)(77156002)(66066001)(97756001)(19580405001)(62966003)(2561002)(1511001)(23726002)(47776003)(76176999)(54356999)(50986999)(106116001)(86362001)(46406003)(2900100001)(2950100001)(102836002)(16796002)(2656002)(92566002)(87936001)(33646002);DIR:OUT;SFP:1102;SCL:1;SRVR:BN1PR03MB072;H:064-smtp-out.microsoft.com;FPR:;SPF:Pass;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR03MB072; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(5002010);SRVR:BN1PR03MB072;BCL:0;PCL:0;RULEID:;SRVR:BN1PR03MB072; X-Forefront-PRVS: 0528942FD8 X-OriginatorOrg: microsoft.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2015 12:30:23.9649 (UTC) X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=72f988bf-86f1-41af-91ab-2d7cd011db47;Ip=[206.191.229.116];Helo=[064-smtp-out.microsoft.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR03MB072 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: devel [mailto:driverdev-devel-bounces@linuxdriverproject.org] On Behalf > Of Haiyang Zhang > Sent: Thursday, March 26, 2015 6:59 > To: KY Srinivasan > Cc: jasowang@redhat.com; Haiyang Zhang; driverdev- > devel@linuxdriverproject.org; olaf@aepfle.de; linux-kernel@vger.kernel.org > Subject: [PATCH] hv_vmbus: Add gradually increased delay for retries in > vmbus_post_msg() > > Most of the retries can be done within a millisecond successfully, so we > sleep 1ms before the first retry, then gradually increase the retry > interval to 2^n with max value of 2048ms. Doing so, we will have shorter > overall delay time, because most of the cases succeed within 1-2 attempts. > > Signed-off-by: Haiyang Zhang > Reviewed-by: K. Y. Srinivasan > --- > drivers/hv/connection.c | 7 +++++-- > 1 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c > index 583d7d4..b27220a 100644 > --- a/drivers/hv/connection.c > +++ b/drivers/hv/connection.c > @@ -422,6 +422,7 @@ int vmbus_post_msg(void *buffer, size_t buflen) > union hv_connection_id conn_id; > int ret = 0; > int retries = 0; > + u32 msec = 1; > > conn_id.asu32 = 0; > conn_id.u.id = VMBUS_MESSAGE_CONNECTION_ID; > @@ -431,7 +432,7 @@ int vmbus_post_msg(void *buffer, size_t buflen) > * insufficient resources. Retry the operation a couple of > * times before giving up. > */ > - while (retries < 10) { > + while (retries < 20) { > ret = hv_post_message(conn_id, 1, buffer, buflen); > > switch (ret) { > @@ -454,7 +455,9 @@ int vmbus_post_msg(void *buffer, size_t buflen) > } > > retries++; > - msleep(1000); > + msleep(msec); > + if (msec < 2048) > + msec *= 2; > } > return ret; > } The patch is good to me. Reviewed-by: Dexuan Cui