Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp762238ima; Fri, 1 Feb 2019 10:33:16 -0800 (PST) X-Google-Smtp-Source: ALg8bN7TMoNnD8h8V7UCA4J4a8FX8mFcFCIAyAJkOadwgtHsZNqcSft7tsuyJ/K4bDbMv1eGYaFU X-Received: by 2002:a63:4566:: with SMTP id u38mr36402312pgk.4.1549045996493; Fri, 01 Feb 2019 10:33:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549045996; cv=none; d=google.com; s=arc-20160816; b=BulE5inSC2+PHO2RSZoa3WpaAJmut3IMinXIt0KsBuP7LVB0siDG60/JdGImum2NIE dOtujpL4vkR2HWoJBn5NX3oWujEgjwDOF+4V5Oc5/eJzPXymRIWhnhbIvndPBCZoyWew 9qs7eRQVy8lygZWPMNWhEgsqfl9C0kdNhTEJeoouQGfpLRCUcYx8tYUsKA8EdRi8GvHH 7TMhWLZhziaq8lad0jm6FF4UOgQFMvKo/3LuBCWLYjkhLl6CDqSEEnzYd9DEhB7YN/yR oq7+BitlscLNW0DwhsXD5W1zrHyMTbd+g5H57quythl8iMzcpbT9eUOoW93F6tJuTLN8 GRNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=6NCs0+tF043EbBCcrooP66jL9nAMH8nho5hDICfuxl4=; b=Gr+d9Cqv9P8q46DxEfSHVUZ/5RXvefPU3yfwa0o7qimmEjTYAVF4NrYQAySgX7sGxY l/TYi9hb3gdDqmkjHOqyeftJi3FnDkzuZVrGELH0C35TaKDCDZF/FwoWd+M34VxZR5vs MKDxpvzMfMCE+fVBKQzSYtdCdgDCxkIdLNTh93nR7X6+DfCArHL4Yi4CG4/swbqbzUjS 34tLqrIlFQTtuPVDaqE2UIu5DQriYnOFXg1MQg0htgGCVxatWyGD1WhxxEyyVyJG9tvC rRTkJ8rDKNvjhAI8LLlM1jnuqfYgsCW1aTLLYqRJEypTg+C5OXZNPjlzPY3ZP3hNRft1 UZYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Fel+8T2a; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p185si8450260pfg.112.2019.02.01.10.33.01; Fri, 01 Feb 2019 10:33:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Fel+8T2a; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730903AbfBASYg (ORCPT + 99 others); Fri, 1 Feb 2019 13:24:36 -0500 Received: from mail-eopbgr1310104.outbound.protection.outlook.com ([40.107.131.104]:29088 "EHLO APC01-SG2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730235AbfBASYf (ORCPT ); Fri, 1 Feb 2019 13:24:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6NCs0+tF043EbBCcrooP66jL9nAMH8nho5hDICfuxl4=; b=Fel+8T2aFH20RAtpbjpTV0MIWGvNykyxBWSSCIWk6TwPboIC9x65qWc1UNP0L2R3hab0P/RvL/MLaEOmICl0oUPPBwt2pMVP4NVlSzSTB24MxjnO7mQI3Sbu5W1xwq/J2GwMsJ8AxFpgp4MDRBzJxONjAs5/N9g7SZ+DNt8MiPc= Received: from PU1P153MB0169.APCP153.PROD.OUTLOOK.COM (10.170.189.13) by PU1P153MB0106.APCP153.PROD.OUTLOOK.COM (10.170.188.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.7; Fri, 1 Feb 2019 18:24:25 +0000 Received: from PU1P153MB0169.APCP153.PROD.OUTLOOK.COM ([fe80::7822:a20:e63c:de2f]) by PU1P153MB0169.APCP153.PROD.OUTLOOK.COM ([fe80::7822:a20:e63c:de2f%9]) with mapi id 15.20.1601.011; Fri, 1 Feb 2019 18:24:25 +0000 From: Dexuan Cui To: kimbrownkd , Michael Kelley CC: Sasha Levin , Long Li , Sasha Levin , Stephen Hemminger , KY Srinivasan , Haiyang Zhang , "devel@linuxdriverproject.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] Drivers: hv: vmbus: Add mutex lock to channel show functions Thread-Topic: [PATCH] Drivers: hv: vmbus: Add mutex lock to channel show functions Thread-Index: AQHUsfdSwFQKguS0PEqWQ+jwS7iPOKW6o/swgAAzdACAAAXaYIAKRoiAgAAQ2xCABIFoHYABmzrw Date: Fri, 1 Feb 2019 18:24:24 +0000 Message-ID: References: <20190122020759.GA4054@ubu-Virtual-Machine> <20190122064246.GA28613@ubu-Virtual-Machine> <20190128195845.GA3723@ubu-Virtual-Machine> <20190131151958.GT3973@sasha-vm> <20190131174707.GA2055@ubu-Virtual-Machine> In-Reply-To: <20190131174707.GA2055@ubu-Virtual-Machine> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=decui@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2019-02-01T18:24:22.8276421Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=7e63ff4b-0a0e-4ade-bc16-e414040cc230; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic authentication-results: spf=none (sender IP is ) smtp.mailfrom=decui@microsoft.com; x-originating-ip: [131.107.174.220] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;PU1P153MB0106;6:xQi1Cxz4IjzzioIRNTHztwRCBtNsR/9LjQNjlJjzLgJck7vMG3w1s3ySZ5ZJWRn8YQKSSQVmL/pPIZlojG2LTr6h4ybsrabUMvaQAl7kHNzcNDbyA80gG1BUiaNTR9E/zFz2llkvG5K5txRTu1iBZ0IPd1qCqUwO7mZjMNWM+W2DlF4XogbygzlQOVfAUe+LqrmN94+Ufm1rWpdsOSRqXS9oLeGCoy7tIPK2dm802zAw44Qf2nkDAY4X/FCgogsllHz6YjKlmm385dV6QOZxzCzOsQ3/Pni7ZXYo3fa/LDwIo4FU9x7rkI9WATn6UtBV1OsUf2nrDWYcjXcqk3c6havC3faoVKYWZB4fJyKfvR9v4/E8BVLVc25Vo3GifU4WXXWkyn6G4aAFQieanqUkAxgJS8HhY3RrGvjPm4SZ02tdakfmGZN0YPPWy2Xog5yW8dIub+cfb7itEU1zsa1TBQ==;5:Fj6/wLE7LicZ7P0sfbHAOWDAk9FfBoF0RaF/AaB6vvCANXqb7OKcFh5rB+Pvg1R6zWbh4IxzNXhcgaFfEAV5HUFcbrvqRrmw4dUWFrrMu2AO33rKs7hL9iph9wx1i8DRwv/O3RzZiu/eBeVGT+AfdnbU0EpZzDdw/nRscfSOwlHG8vLCVHri9iH++8VGXdI/iDn3C2BQRrNwjsZ0DwRGug==;7:GevPZayVcVcQxmY2qoYsewdAqrvfqxEFw9oQQr/JnBqJv3MYRIWmOqgUvXb5E4/OrkBZIJi2iIOPgnqg6PZKA1KkjrqPa+cexQ0eWc1Kac+KyiiiwDXvcJqALnec1Jj2G9B0D0G/rc42gapIkKxOiA== x-ms-office365-filtering-correlation-id: b40b5798-082c-43d4-df33-08d688727ed4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600126)(711020)(4605077)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:PU1P153MB0106; x-ms-traffictypediagnostic: PU1P153MB0106: x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-microsoft-antispam-prvs: x-forefront-prvs: 09352FD734 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(136003)(39860400002)(366004)(346002)(376002)(199004)(189003)(66066001)(186003)(39060400002)(6246003)(33656002)(478600001)(7736002)(99286004)(26005)(10290500003)(110136005)(229853002)(486006)(54906003)(256004)(14444005)(10090500001)(476003)(53936002)(55016002)(9686003)(25786009)(6436002)(446003)(4326008)(2906002)(93886005)(106356001)(6636002)(11346002)(105586002)(14454004)(74316002)(6116002)(81166006)(81156014)(3846002)(71190400001)(71200400001)(8936002)(7696005)(76176011)(22452003)(316002)(6506007)(86612001)(305945005)(102836004)(8676002)(1511001)(8990500004)(86362001)(97736004)(68736007);DIR:OUT;SFP:1102;SCL:1;SRVR:PU1P153MB0106;H:PU1P153MB0169.APCP153.PROD.OUTLOOK.COM;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 87ByPCEVZpfaOugQpKazJ8uffnrFP9p1iKFZhEDFQHqPngehypKc0Yz8XeLPMWe8dtKEByGf2qucM8ZHYAtXmlm+LvLsRg37tLAQgsgDjfl3abQ8mdiFGbO30MAKhNphG7xOPc7gbDEora2FtrL0jTNl6PQa0OiO1czaqXoxu4rxeO2qAPqB5y1Kxgw/g0iRR25POM9GtoOCkciBOpk/STkoySPqfWhymxEEXQq6oIwLdRy2ExUztgrs+4Xfow5KhfqR8aSJD+RiDgLiXNBlY24ERbuWWi+QOEtTQSCF4vdMT22kBykTCwxwC/fN2YuFRzyjsj+mB5vO3e6LMSB3oul5FQtnkM2IQkuLuvjqwMkmUY5n7jH6yWfA+As7ZhmqUdyAJoZaCXWhI/cDm1fiNR0XfMNTp8nzcgWzKChzduA= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: b40b5798-082c-43d4-df33-08d688727ed4 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Feb 2019 18:24:25.0065 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: PU1P153MB0106 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Kimberly Brown > Sent: Thursday, January 31, 2019 9:47 AM > ... > 2) Prevent a deadlock that can occur between the proposed mutex_lock() > call in the vmbus_chan_attr_show() function and the sysfs/kernfs function= s. Hi Kim, Can you please share more details about the deadlock?=20 It's unclear to me how the deadlock happens. > I've identified two possible solutions to the deadlock: >=20 > 1) Add a new mutex to the vmbus_channel struct which protects changes to > "channel->state". Use this new mutex in vmbus_chan_attr_show() instead of > "vmbus_connection.channel_mutex". >=20 > 2) Use "vmbus_connection.channel_mutex" in vmbus_chan_attr_show() as > originally proposed, and acquire it with mutex_trylock(). If the mutex > cannot be acquired, return -EINVAL. It looks more like a workaround. IMO we should try to find a real fix. :-) =20 > I'm leaning towards (2), using mutex_trylock(). > "vmbus_connection.channel_mutex" > appears to be used only when a channel is being opened or closed, so > vmbus_chan_attr_show() should be able to acquire the mutex when the > channel is in use. >=20 > If anyone has suggestions, please let me know. >=20 > Thanks, > Kim Thanks, -- Dexuan