Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933103AbbBBKNc (ORCPT ); Mon, 2 Feb 2015 05:13:32 -0500 Received: from mail-by2on0139.outbound.protection.outlook.com ([207.46.100.139]:54579 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754028AbbBBKNa (ORCPT ); Mon, 2 Feb 2015 05:13:30 -0500 From: Dexuan Cui To: Jason Wang CC: "gregkh@linuxfoundation.org" , "linux-kernel@vger.kernel.org" , "driverdev-devel@linuxdriverproject.org" , "olaf@aepfle.de" , "apw@canonical.com" , KY Srinivasan , "vkuznets@redhat.com" , Haiyang Zhang Subject: RE: [PATCH v2 2/3] hv: vmbus_post_msg: retry the hypercall on some transient errors Thread-Topic: [PATCH v2 2/3] hv: vmbus_post_msg: retry the hypercall on some transient errors Thread-Index: AQHQPsx46ni8vwzZPUeWm3VtuBS2pZzdI0qQ Date: Mon, 2 Feb 2015 10:13:07 +0000 Message-ID: References: <1422851763-2391-1-git-send-email-decui@microsoft.com> <1422870076.7028.6@smtp.corp.redhat.com> In-Reply-To: <1422870076.7028.6@smtp.corp.redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [141.251.55.68] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-EOPAttributedMessage: 0 Authentication-Results: spf=pass (sender IP is 206.191.230.4) smtp.mailfrom=decui@microsoft.com; redhat.com; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:206.191.230.4;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(51704005)(54534003)(24454002)(13464003)(377454003)(41574002)(33656002)(106466001)(50986999)(54356999)(76176999)(104016003)(46102003)(50466002)(77156002)(62966003)(2920100001)(2950100001)(110136001)(66066001)(2900100001)(106116001)(55846006)(47776003)(102836002)(6806004)(22756005)(19580405001)(22746005)(19580395003)(23676002)(2656002)(87936001)(92566002)(86612001)(86146001)(79686002);DIR:OUT;SFP:1102;SCL:1;SRVR:BN3PR0301MB0835;H:064-smtp-out.microsoft.com;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BN3PR0301MB0835; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004);SRVR:BN3PR0301MB0835; X-Forefront-PRVS: 0475418F50 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BN3PR0301MB0835; X-OriginatorOrg: microsoft.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2015 10:13:26.2616 (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.230.4] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0301MB0835 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id t12ADc82002335 Content-Length: 3534 Lines: 103 > -----Original Message----- > From: Jason Wang [mailto:jasowang@redhat.com] > Sent: Monday, February 2, 2015 17:41 PM > To: Dexuan Cui > Cc: gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org; driverdev- > devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com; KY > Srinivasan; vkuznets@redhat.com; Haiyang Zhang > Subject: Re: [PATCH v2 2/3] hv: vmbus_post_msg: retry the hypercall on some > transient errors > > On Mon, Feb 2, 2015 at 12:36 PM, Dexuan Cui wrote: > > I got HV_STATUS_INVALID_CONNECTION_ID on Hyper-V 2008 R2 when > keeping > > running > > "rmmod hv_netvsc; modprobe hv_netvsc; rmmod hv_utils; modprobe > > hv_utils" > > in a Linux guest. Looks the host has some kind of throttling > > mechanism if > > some kinds of hypercalls are sent too frequently. > > Better to clarify this kind of throttling. Looks like it only affects > HVCALL_POST_MESSAGE. Other looks good. I'm not sure about the details either. And it may be pretty host-specific, e.g., I can only get the error code on Hyper-V 2008 R2, but can't get it on 2012 R2. > Reviewed-by: Jason Wang Thanks! > > > > Without the patch, the driver can occasionally fail to load. > > > > Also let's retry HV_STATUS_INSUFFICIENT_MEMORY, though we didn't get > > it > > before. > > > > Removed 'case -ENOMEM', since the hypervisor doesn't return this. > > > > CC: "K. Y. Srinivasan" > > Signed-off-by: Dexuan Cui > > --- > > > > v2: > > updated the subject and changelog > > on HV_STATUS_INVALID_CONNECTION_ID: ret = -EAGAIN; > > added HV_STATUS_INSUFFICIENT_MEMORY > > removed unreachable -ENOMEM > > changed the delay from 100ms to 1000ms > > > > arch/x86/include/uapi/asm/hyperv.h | 2 ++ > > drivers/hv/connection.c | 11 +++++++++-- > > 2 files changed, 11 insertions(+), 2 deletions(-) > > > > diff --git a/arch/x86/include/uapi/asm/hyperv.h > > b/arch/x86/include/uapi/asm/hyperv.h > > index 90c458e..ce6068d 100644 > > --- a/arch/x86/include/uapi/asm/hyperv.h > > +++ b/arch/x86/include/uapi/asm/hyperv.h > > @@ -225,6 +225,8 @@ > > #define HV_STATUS_INVALID_HYPERCALL_CODE 2 > > #define HV_STATUS_INVALID_HYPERCALL_INPUT 3 > > #define HV_STATUS_INVALID_ALIGNMENT 4 > > +#define HV_STATUS_INSUFFICIENT_MEMORY 11 > > +#define HV_STATUS_INVALID_CONNECTION_ID 18 > > #define HV_STATUS_INSUFFICIENT_BUFFERS 19 > > > > typedef struct _HV_REFERENCE_TSC_PAGE { > > diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c > > index c4acd1c..af2388f 100644 > > --- a/drivers/hv/connection.c > > +++ b/drivers/hv/connection.c > > @@ -440,9 +440,16 @@ int vmbus_post_msg(void *buffer, size_t buflen) > > ret = hv_post_message(conn_id, 1, buffer, buflen); > > > > switch (ret) { > > + case HV_STATUS_INVALID_CONNECTION_ID: > > + /* > > + * We could get this if we send messages too > > + * frequently. > > + */ > > + ret = -EAGAIN; > > + break; > > + case HV_STATUS_INSUFFICIENT_MEMORY: > > case HV_STATUS_INSUFFICIENT_BUFFERS: > > ret = -ENOMEM; > > - case -ENOMEM: > > break; > > case HV_STATUS_SUCCESS: > > return ret; > > @@ -452,7 +459,7 @@ int vmbus_post_msg(void *buffer, size_t buflen) > > } > > > > retries++; > > - msleep(100); > > + msleep(1000); > > } > > return ret; > > } > > -- > > 1.9.1 > > ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?