Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751902AbcLLM2T (ORCPT ); Mon, 12 Dec 2016 07:28:19 -0500 Received: from mail-he1eur01hn0225.outbound.protection.outlook.com ([104.47.0.225]:59654 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750910AbcLLM2S (ORCPT ); Mon, 12 Dec 2016 07:28:18 -0500 X-Greylist: delayed 11635 seconds by postgrey-1.27 at vger.kernel.org; Mon, 12 Dec 2016 07:28:17 EST Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Date: Mon, 12 Dec 2016 14:27:47 +0300 From: Roman Kagan To: Paolo Bonzini CC: , , Subject: Re: [PATCH v2] KVM: hyperv: fix locking of struct kvm_hv fields Message-ID: <20161212112747.GA2087@rkaganb.sw.ru> Mail-Followup-To: Roman Kagan , Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, dvyukov@google.com References: <20161212091253.19780-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20161212091253.19780-1-pbonzini@redhat.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-Originating-IP: [195.214.232.10] X-ClientProxiedBy: AM5PR0701CA0004.eurprd07.prod.outlook.com (10.168.161.14) To DB6PR0802MB2469.eurprd08.prod.outlook.com (10.172.251.17) X-MS-Office365-Filtering-Correlation-Id: 4434ccb1-6da0-4c73-6262-08d42281e9de X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DB6PR0802MB2469; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0802MB2469;3:gFjYEv0sZhbjy1UEpGpH1+DBuhSKAdM7ycTDx7pU1uoNsX4oQFkPti7xfo0KI0kYxBmc0iywMHYlbBlBnz5p7fe6y1CRk/0sLgrHfFrfXV4kvlx4Ix35p5UI7sEc9vG0jpd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JNlpyUU9iFVXv8suOZhTneTCeMDxpWHxxzzMnPXV7gkx2BIZZYtkoDyxcHzMEd9B92AddNHhTFyR5GxZktl67Umux+B9UaJxlGv0D3Gwji85NFrMwu+rEyYWJr4uv7OOU/XQ1IjQA21YayGabCBjB+Q1NcdLeCH7BIQsZhEb3uQVD8qHmDnoYPbQN+RdL/HCvg/+Geg40j5XA==;20:nU8wlBsz7SuK3rGFxROFJx2YaQLcr/K5uNsOYCgXxNuv8jD34fB9YrZRK5fsec5z5s1Upv9c82mEVmhf2dP9/peHLun8+pxratZWa2opl58M+xf9MDWb9hG2ApVwS5n1AdvQCieL7TMBbMQSGX6s7B1RiZz/G8q1qgskG6FUQQrafKWFjLYpw8SG4ZmhPIJ3oDlGJDoXjrnpylAaI+46Qc47vk2K9wgOSdEP7VPoc9edrpmZpYfkVZtT4ac3XVgd X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(211936372134217); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(20161123558021)(6072148);SRVR:DB6PR0802MB2469;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0802MB2469; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0802MB2469;4:9GkrSobk6+d8cWOQQd2NLtnG+fCsn0nMH+G8cDgHh2F2uUEa1Ebk1T65HxRaf49mmsKNxvdBpwEaZksFgeC0YnPeiC4imfgESG/UztnLVJfNo2n/zBfitTSInP0/taWyBl1ygS+8euQ63NksKWh4aVtybhKuZNcQ8jiLZtEENu1t+bdjLrTqKKUVix4y8Dh313qyx8DG0OLnv6BKMl6G6DxnxKpG3yeS+XRqoEWEQueKjc0rtV4Zafa4GuOs/21CIck10ef1av8HgDVPYT1+LLIp5ii83L3z+Sp4GQAkZpYU0mraSiDbXC25u6bn+fua5L014QTMybMJZCb1LzAFYPjwuUhO0lJ1MLApVuT9YjjX5xta5pzYfvcerbyqkyLmXnrCvPaEh52oAJ4VgmHPZbeG38MMckzeRnDQMN1Bc/Qch5GgSlMCUwIvJgHtX4ZNkSNFI+8725KAVQGRcNjdWLsV0eezX8aHV/Z9h6PPo4h3pY0oTs18mFZU8A3nTHQIqfPAxzUL46p+5bMOKeKf4YSBYxx7lw0zmP9HGtfTgr0Vc8b6Y5hxRrW3CWfg0zesmCVMV6VvNiFkZGQ/w9eCeirVB7LEqHk4unC/T7hcyGZkNOk1dH/gGReuQfWNFARyiEcevBG6bOleuq1ZiPVhsQ== X-Forefront-PRVS: 0154C61618 X-Forefront-Antispam-Report: SFV:SPM;SFS:(10019020)(4630300001)(6009001)(7916002)(39450400003)(199003)(189002)(24454002)(2950100002)(5660300001)(6916009)(6666003)(110136003)(38730400001)(47776003)(81156014)(81166006)(8676002)(9686002)(23726003)(1076002)(6116002)(3846002)(6506006)(305945005)(229853002)(7736002)(83506001)(36756003)(50986999)(69596002)(4001350100001)(97736004)(189998001)(92566002)(54356999)(76176999)(46406003)(50466002)(42186005)(2906002)(66066001)(4326007)(33656002)(86362001)(106356001)(68736007)(105586002)(53416004)(97756001)(101416001)(30126002);DIR:OUT;SFP:1501;SCL:5;SRVR:DB6PR0802MB2469;H:rkaganb.sw.ru;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DB6PR0802MB2469;23:QxdoYiCYQg/I5CtqXbC61IJEYtwau/pcFxNOgQC?= =?us-ascii?Q?b5XGPhY8pAlCt4R9epMcA70Djv7/kMaNtWdwSjNhNpaMM4kYngZYUJXei4+d?= =?us-ascii?Q?aVIR7JLeeFOr9c7Df5XZbLwG/rZLcgDxvBbazOcO4xmZeTQEavqlvfLJH2zJ?= =?us-ascii?Q?aFc3PZVVGXVRWGfqbYj7dJZjIDHKtTYuE+qSECWvwGYIZtfwYgefNoPfZJu5?= =?us-ascii?Q?Bsb5kXpI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2X+L71TufstN+9ZIwjxHm7JC3d5c4neaVQl16zkQOoqlzuuS1aJD90S8UxWmnNXIkBepedCWB6XWAjX43BCr9HFgU7gn++G9XWJK+jOB4fIMcvai3sVbHbDgCsBMlCI+XKwKwt2s/Xy+IpOxfLI2pw420iU5IUNMEgu9Whfx4I2vP6nqaQvJt8yFJdhPQWDQSe0pApYRi43oVNc8RGmjrVL2iqdTtVgVPeniqqUnpOqEjA99TxaXYpzwbkE3K2f7Q8WQDVQly3csVzlCgiEdW2LzCoXqOo8EsskBSjLY0jnZiBF+X4FSrGkkBI+41+wZ/ZaMAivSHWrqg5ZX8zjLqvwW6EkWAlpOIQBgEYHjbSH3KIdax+L2RyY3qHijwyM/o7wrwC2g==;20:ZSZIgvfo57ixjsVdH8lfZ7IR4AkOJrhmIrpBB/XUYAol6UCSSNn9SUkCHQTpSvtmwiLF450fI3+aGcAYD0VdXuq/Wea6IksNUTMeY52vIMQpg8ttzkxMYq/vcz7Ws6su8c5z+W1v1WxAXRS7LNuAWyeBoXqTBq4P4T83MuV4cPg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2016 11:27:53.1439 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2469 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 702 Lines: 16 On Mon, Dec 12, 2016 at 10:12:53AM +0100, Paolo Bonzini wrote: > Introduce a new mutex to avoid an AB-BA deadlock between kvm->lock and > vcpu->mutex. Protect accesses in kvm_hv_setup_tsc_page too, as suggested > by Roman. > > Reported-by: Dmitry Vyukov > Cc: Roman Kagan > Signed-off-by: Paolo Bonzini > --- > Documentation/virtual/kvm/locking.txt | 8 ++++++-- > arch/x86/include/asm/kvm_host.h | 1 + > arch/x86/kvm/hyperv.c | 24 +++++++++++++++--------- > arch/x86/kvm/x86.c | 1 + > 4 files changed, 23 insertions(+), 11 deletions(-) Reviewed-by: Roman Kagan