Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752064AbdCAPLi (ORCPT ); Wed, 1 Mar 2017 10:11:38 -0500 Received: from mail-cys01nam02on0092.outbound.protection.outlook.com ([104.47.37.92]:26926 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751837AbdCAPLf (ORCPT ); Wed, 1 Mar 2017 10:11:35 -0500 From: Dexuan Cui To: Vitaly Kuznetsov CC: Stephen Hemminger , "gregkh@linuxfoundation.org" , Haiyang Zhang , "driverdev-devel@linuxdriverproject.org" , "Alex Ng (LIS)" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] Drivers: hv: util: on deinit, don't wait the release event, if we shouldn't Thread-Topic: [PATCH] Drivers: hv: util: on deinit, don't wait the release event, if we shouldn't Thread-Index: AdKQ6tkwTtFdGhZfTFStCsksqVH8PwA07UdhAAAoeIAAAEQ4sAADax9VADKiDSA= Date: Wed, 1 Mar 2017 14:34:29 +0000 Message-ID: References: <87k28av6nm.fsf@vitty.brq.redhat.com> <87fuiyv50n.fsf@vitty.brq.redhat.com> <878toqv1k8.fsf@vitty.brq.redhat.com> In-Reply-To: <878toqv1k8.fsf@vitty.brq.redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [2404:f801:9000:19::402] x-ms-office365-filtering-correlation-id: 953f2ee2-b622-442d-8657-08d460b011ec x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081);SRVR:CY4PR03MB2725; x-microsoft-exchange-diagnostics: 1;CY4PR03MB2725;7:BEi85ar3/EZdWAogeyVHC6E6tKq3jK29726FQzZDWLQu/1IZfbnKSHHr5paxp1yDq6qmmjJCz1JFnqEWyxnUB77A/8armH4mvuUDNMd6jRAoWXdp7HGmKCN3u4jGX/rkThqLGlu+r2xMoMkbcieaIug3NulPdjkcW9qwF4iQNPeODsliCKQrOdpBqMSuPdikp2d+7BODyfZv7CEBPBWR+LKizdyCzQ52EV49tQ6Ps8QfVvBn2SJjtLNWNB5FdZ3gK9ppp9Fj5P9yEo2klHXzxshgfB6qNVcEYShGA4RPFqQeBCnonhYTIuxX/CYB2NRzpKrNDCgiyj8rVsr5o7LBkqI361wlRdFvSYttEW8IXAA= x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(788757137089); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(20161123558025)(6072148);SRVR:CY4PR03MB2725;BCL:0;PCL:0;RULEID:;SRVR:CY4PR03MB2725; x-forefront-prvs: 0233768B38 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(39410400002)(39850400002)(39450400003)(39840400002)(39860400002)(92566002)(81166006)(8676002)(8990500004)(10090500001)(86362001)(76176999)(10290500002)(54356999)(33656002)(50986999)(8936002)(93886004)(189998001)(2906002)(5005710100001)(122556002)(3660700001)(229853002)(110136004)(38730400002)(6116002)(305945005)(5660300001)(7696004)(2900100001)(7736002)(6246003)(74316002)(53936002)(102836003)(3280700002)(4326008)(5890100001)(77096006)(6916009)(25786008)(2950100002)(6436002)(9686003)(55016002)(6506006)(54906002)(99286003);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR03MB2725;H:CY4PR03MB2662.namprd03.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2017 14:34:29.4834 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB2725 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 quoted-printable to 8bit by mail.home.local id v21FBfcH004127 Content-Length: 1121 Lines: 36 > From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com] (c) > >>> > > int (*on_msg)(void *, int); /* callback on new user message */ > >>> > > >>> > I think we can get away without introducing this new flag, e.g. if we > >>> > replace release_event with an atomic which will hold the state > >>> > (open/closed). This will also elimenate possible races above. I can try > >>> > prototyping a patch if you want me to. > >>> > -- > >>> > Vitaly > >>> > >>> Thanks for offering the help! Please do. :-) > >> > >> BTW, IMO I found another potential issue: > >> In hvt_op_open -> hvt_reset -> kvp_on_reset(), I think we should call > >> init_completion() instead of complete()? > >> > > > > To me it looks like we can do better with something different from > > struct completion, I'll take a look later today. > > Dexuan, > > please take a look at the attached patch. After looking at the code > again it occured to me that it's going to be easier to move release wait > to the transport itself. Lightly tested. > > Vitaly You made a neat patch, which can fix the bug. Thank you a lot! Thanks, -- Dexuan