From patchwork Wed Jun 21 16:24:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 9802275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4683560329 for ; Wed, 21 Jun 2017 16:36:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31F3F205F8 for ; Wed, 21 Jun 2017 16:36:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26483284FF; Wed, 21 Jun 2017 16:36:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3A539205F8 for ; Wed, 21 Jun 2017 16:36:37 +0000 (UTC) Received: from localhost ([::1]:55081 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNicO-0007WA-7R for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Jun 2017 12:36:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNiRh-0006j1-UT for qemu-devel@nongnu.org; Wed, 21 Jun 2017 12:25:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dNiRf-0004T8-8A for qemu-devel@nongnu.org; Wed, 21 Jun 2017 12:25:33 -0400 Received: from mail-ve1eur01on0090.outbound.protection.outlook.com ([104.47.1.90]:60077 helo=EUR01-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dNiRe-0004Si-My for qemu-devel@nongnu.org; Wed, 21 Jun 2017 12:25:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=03xS7okA3K+OCQDS5HCrfMR51Eic2fxrY4vwjA9fjS0=; b=LCwHhSrPW/LiD9dgsJqzzfp59MTT57JR+mZZaS2gkEyOwIL2w35GCrn1e/+ktDBp+Hx5XbwWKFF7+uI+qcRWDlsOsrIDolJIkHF9n/X316jOENEzNjo/Bj+V5MSJWw8bYPa/uny1sHsNfZc4liC8urJfVOEhLNgIrU1C6hS6UxM= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from rkaganb.sw.ru (195.214.232.6) by HE1PR08MB0842.eurprd08.prod.outlook.com (2a01:111:e400:59b2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1178.14; Wed, 21 Jun 2017 16:25:23 +0000 From: Roman Kagan To: qemu-devel@nongnu.org, Paolo Bonzini , Eduardo Habkost Date: Wed, 21 Jun 2017 19:24:08 +0300 Message-Id: <20170621162424.10462-8-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170621162424.10462-1-rkagan@virtuozzo.com> References: <20170621162424.10462-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HK2P15301CA0022.APCP153.PROD.OUTLOOK.COM (2603:1096:202:1::32) To HE1PR08MB0842.eurprd08.prod.outlook.com (2a01:111:e400:59b2::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 73a0fe05-566f-4ba3-756f-08d4b8c220cf X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:HE1PR08MB0842; X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0842; 3:UUcPSaZesdu9Ig7ucGk0a62ngLMZo977AXVxYAPVQvppoCKl0bb/+HvLrcDJlVeMjgoKiDIe5WWsZ0gAr+8VCGL2hzHxE2NJp7cOW9crgPrPfVmIKb2JTdNdrb1+UbGTXV9j0FHwrMHChAFYoEzdfvuBDmGFDcEbJlPCt/HCXxn+D72zVXfdWkVkBzmLLUMU/l0Igd6SxOMllUcGzYHoal9g0TPADcJeFM+Ro4Us1Nl2NtomLyAiAQzE0joPpE1/gGL8s3jGJ4maMCeDPsvWoF/u7/kgDxrf+GFU5zmmvF4VugOZsIrZJ/ofs0Pfwjik8c57hNQvwVSwPHDbg/+fUg==; 25:fzheZsmj/7EHpQ0oeMsjwzlFgml4VdVbNQqV4+tZILQPzSR/txSG91C9gyKxdl72IhwF26EysgnQRknKW/TvjDpjdOZr/4ao+AHrXS/84FJKR0UO1XarLMbDM164HMoZs9dTSTxyVeHq+npOUyNLef1FaCuM23yAvd+Yo7qzTO4BKADFljq83XZhJWAlRk/EK22gajK1faxdqkXCJ2O8Bvcn26/8BoYdWKXshU3lvQkvzgzY9CtZ0UaeJ17LwULvYlDhoufHDhK/75bQtJqhOXnvrTsB7CE1EALwrae6kPHz+C7QHBdp8tib/0t/MWPyrFbyweZs5CNYi2TKUF+6F+ZhOiMsBwNfLcCqLk0UFRCHHDg0+p389nmZ8XO3GkRV99rpdgqJY/XjZTizCWD0mSi6xKf96Mlp7840c/LfN01gPzH7yU537Wp8TRT6QuTTHRiaB6hBA0Kqzv6GSo8uwHU70lY9nDMF1b2N1BPPf2A= X-MS-TrafficTypeDiagnostic: HE1PR08MB0842: X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0842; 31:GAhRMsZy6HNJsZDo2O7e/y6j2WY44mU37aAqGHtW4ZIfOXv8KtfqtrIXEag1kGe1vGJVlEvD1W2Yr6BVF4T78MYI+jNQF0glReUrgBBpTWONf6fULcVEHTslHTn1Qqo//b2tP7g4FaCBL4xRQN6f7K6ExHS79Am+cIrabkeOx6o8bPKnrDnTzB72UDV7YXjEaFSya/wMnXSJC8rIdBczgrx/6S/EqmvbXAfyvFW25Go=; 20:IfcsK+8EpI0v3+wP9tB0TGUYq5ea3RkvfdcxS7aHOGZepbRCUV76mYRsEZhNcmzVuBDg3ulqOqdXHEhk1/oQBl3J7dbM/YxFqWW0lbexSFyvgYwRqC1Dv5xQ9x4XMmppUwRkk3U293NSgvAN8QsM4QX/6xhyq0EDtpVMjWnvdpvln7pX3A7+R//VGWxOMzQiGavaUKEMRD7Dy712DT2kmnzEioqzmCouFLzhbR4DgheS0gFhN/938sZHirveC+N78NdHZqCshiBZPTAO3micBRawOmd2ExhIS/wi73imIZ0gWi3DToP9GQHpI3JpZSMLMveuRrQ8B7K9uav7e6KfkP/uZ45+ZGY5RsIHFEUWzN6eaKwp4fwtAwcQr+EUYQrKbVkc2MjZwkA4V67dKbsV5P17i5/2gE4YpouZM5iM5iM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6041248)(20161123555025)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:HE1PR08MB0842; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:HE1PR08MB0842; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR08MB0842; 4:EWs49sbJ5jPUBlMZOvYEyHVJHEJZCzFYK/NatSQmr3?= =?us-ascii?Q?hkILmKhP1lBqPeLxuT65gcuhfPFiBUBaj0EF34RGQwa3+QiqEj8Ka6s2Rehn?= =?us-ascii?Q?z1AfzroQMG1dqdXHIY5I3poz9ZlNewi9D5CO46boL1W/r7bhmpVhy5ntR+x4?= =?us-ascii?Q?IcYnH3qlPnd1Og+zRjngdB3sauQeY6d3dHdspeoqZQgCkdbTYohLcQdd9l0z?= =?us-ascii?Q?0IGGdJJxh0Q8ZGk/kT5R7J/eBHdUUbEyLVwDlONr+u+RPNUfYm16zK8q+UHq?= =?us-ascii?Q?Qc6YCL2YCRQIPbVitQxpxMPt6VA08v4hGk3xEL2hPxpYNPVSJBC+5QFtxwwl?= =?us-ascii?Q?tgj+yM0yHmc3bt1fC5AoH+BVnHBdWKFwxIss5Cqh38JqxW0LqriEzDVXktvV?= =?us-ascii?Q?riFxGWXLkcSz4OseM3ngiBs82ljLxCU5+1CQCZ8gkfR1PEUPUKQaeKMLOzop?= =?us-ascii?Q?qBA0thDqr7GBFwXbvUb9nmF6g1XR+FbwulLRvSksTU3fMMmfqEDUsTmtnR3P?= =?us-ascii?Q?mpm3aFgkkKrNzQyTmaeLNTHBGRlDJfatUbGLxiOdkbwcx+w/smr//9xnv7c8?= =?us-ascii?Q?WIkSyfpYSDD7d5XImfYlg7Z3gF/TRDxMpekMz2/e9WuFbnzmfkd9JQVd+gJy?= =?us-ascii?Q?IAGP2XWb3z67/ARgQhY3xoS/RH/8//W9Fjfs6K7+ZLJ3du68/iX2JMOa50VO?= =?us-ascii?Q?nQXgWx72Lw5P4bEAKXkVEjEKwskTSiwUROV/xRGuvpSuJyivxo15/UMd5FS7?= =?us-ascii?Q?bE0BzS8bsiSVisDo0m4DfOLGfE17gBYI7k4iF9hyqVKSVBkSOhh/sn+8Ubad?= =?us-ascii?Q?q/ONRTTU3H/i5D3ZmlQ8htAvkQfoyxyfnJzkvhtWnmEgJQh/M+BZAV2o64dR?= =?us-ascii?Q?V8ChDe1vmd5MBi/4v7Qw9JAIqaBMHlucmxWEBrVFmgNBmJMpzcv6tTn7ziCu?= =?us-ascii?Q?t06HWUN0iYmefNHD5tmRf49Zz2ESmKfhmFVAKUT0mS0/fqIXKdouOYAE9MF8?= =?us-ascii?Q?QSIl5meS29TewOSnZpOzYNwx+ccxtrlJZBLYuUX8mEC/wqG+gw2ss6A+nkBG?= =?us-ascii?Q?qiQKXoLixNlLNI8JwoUCFOYOjhzrNRQtzYaKk5V3Ka8elXRGv+NjaW5tEk+b?= =?us-ascii?Q?JCzhwg2RdRa4BPe4MHA1g7hfGRCtUQ?= X-Forefront-PRVS: 0345CFD558 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39450400003)(39840400002)(39410400002)(39400400002)(6666003)(4326008)(2950100002)(6512007)(6506006)(5003940100001)(42186005)(53416004)(54906002)(50466002)(86362001)(38730400002)(33646002)(478600001)(50986999)(76176999)(66066001)(53936002)(81166006)(7736002)(6486002)(189998001)(8676002)(50226002)(305945005)(36756003)(25786009)(5660300001)(1076002)(3846002)(6116002)(47776003)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR08MB0842; H:rkaganb.sw.ru; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR08MB0842; 23:J8eFrEGx4YsnJUmk9z72gy4ES8OS8iddqWNNpUt89?= =?us-ascii?Q?HrPY2Tb+N9n/P3H/X7XnaNHjux00NaPHdm4AFw/H0lKIgtUDUV//RQOzHqeu?= =?us-ascii?Q?o3yXzeHjx5jccXYQ5Z+HTFo6/CayzgXjH6+puhhVKZGjic/7kjFGnSVC6Pkc?= =?us-ascii?Q?cOOCVpt4YcmHal/AvRuFw4UuXo4z4M9eNepwCBg6447zWDPx2Y6n7MlEo2Z6?= =?us-ascii?Q?GaymVfkQxCaCzqzkGKrHLw3hGWH2KD0rijiOfs7QSv7Y/ijVbCK6iwXq3MZ/?= =?us-ascii?Q?VSQGXZzau2GN/1yupPl/ZJ6TtnXeGzWAiPyQX1g2RHfnmAOezStpUsKqB3iR?= =?us-ascii?Q?Oja6ZxBobs/Cx3ojW18kVYR83/AcTfqMhSzIuko3syJYmLXued6ji+ZAhesO?= =?us-ascii?Q?Ej1EAWrXwnEsmgwJibduxI5AmyuFuijDwI8RXqys6aYucI3NG62eHlz+vdag?= =?us-ascii?Q?Qtq0INxDYbk2CJHiriNR9/03yLkAxOteChOAnanzi4maspdJYg8yIamQLMLZ?= =?us-ascii?Q?gM6AxkOlf86k9lHbj6+Sp+0tomICj6MCQ+rtC/P78mgxETtuY1w8De2AFPU9?= =?us-ascii?Q?pJz7quUQeV9nP1Yuwyl9h9UXcjo7s7k0ZZbbTJhBcSmhrmtsgzo9SjjTysDw?= =?us-ascii?Q?H6Qq3WlduiIlawAi2flBG+B41UtCLuIl/aAQzqViF8DkDqQb8x4NPDCEgeqQ?= =?us-ascii?Q?ZY+3ER970ou1tTZzEmXMvisdPGEMfGG64bkD3NVsrqN2IqHWA7FDxog68BhO?= =?us-ascii?Q?g2thDMByMlwSp657dJUng96WEKxCI5tVyrCFRKoMc/qXvLEYCkIb4ml8QOQn?= =?us-ascii?Q?/+YrmIytI88cZzAn00oxNjEUrMCILIZAdjDaz75TvDLgv35GT0pSditkXkWQ?= =?us-ascii?Q?NLGtJ0zBgnFugr+YM/f9q5VhaCFljC34SPD5xc9KPYN+pwPylqakM216HNLc?= =?us-ascii?Q?uMTDHoVF42dcDvism9MOgHv1IPUTaQ+zk/oOcxDkDt0uqQeoMFbUyNxGth95?= =?us-ascii?Q?qU=3D?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR08MB0842; 6:kUtwPnl1E5s8NiilDPfBYbIndsV1Rqj+NJMEIW8+TO?= =?us-ascii?Q?wgNkhqlE//EEpbbW2qlyIfphOJ9II1dLnpDwNYjU0afKH/SyYKqnRjyInAMb?= =?us-ascii?Q?xos6UqeoAV9u3awwnX+vg9lwoaQjx/Um+iEAeDvb2g/Je5KicCQJek7OVxw0?= =?us-ascii?Q?L5BgnOpa7Pxbb7dN9Jc9lVPWmjE20vgtlTYgmzqugQWhnMinpzgbADrwXlEb?= =?us-ascii?Q?ml4wPkmr5//o/GaKidjdQJCXiceO0hAhvniXweRj1eWIeQc+nhSShBWBvfFi?= =?us-ascii?Q?boVv9kWxUvR4mGZOov6oekcwaPr7BnOThHIDTfpfke9yqhX/LAc+okEXchi+?= =?us-ascii?Q?RcTAlwa5HnPET3ySpQCP0CDUNjvJjhvc/Q5PQjC6riSC4ikIjqNo0IxqyWHH?= =?us-ascii?Q?VKnwwrxgfP7Z56FPuybsBZHwshBLVcufWolimCVE/vi0hvCMuraTzTThhBEw?= =?us-ascii?Q?2g79ASXPJzpTrkRAl0Vd4y195toAtkYXOmREMe3WP4HBBdA0SWkBNsoTzMo0?= =?us-ascii?Q?cUn38N0R6zMqAUMwp4OKkKH8e3v08mE//TaQ3RttQr66DxEXkwq3a4rIOwkf?= =?us-ascii?Q?GA64n78N/CcCj0Iigu1HWflr6TLcK255PBbwRD1SzIsGkBnSB7Ly3sMoDVzX?= =?us-ascii?Q?8Uyd0GIX/F1sDzTKtFEBj0l5BSJiLgIEPLCcNJ13Or+QqZ5NXa9NPdEx2ROA?= =?us-ascii?Q?zagVBV5Vj86Sv+a4WFZyhmxDViVUGFVrdG/oHkUQX3HYEL7wCr9EgVwr+HIJ?= =?us-ascii?Q?z7jBe3E7q3QPYVDu40gMRuuRYtoCjyvtFOqzaQ3EkV+wnq7v/azec5mZ8yxt?= =?us-ascii?Q?4iPnoEfWoLIUETUG5MjmczI3oWe0QebRe03TBl/+iibQcu4/FbCMNCnenew5?= =?us-ascii?Q?6M0wLGyOGuSvLAAWlIDOACuP82ZztWY4kwJJ/7QdwSX3bfLtBVhAoqIgNdvE?= =?us-ascii?Q?shHRokfW2/L+XHBJ1kaK562FSykv7gLvP82mZZVjx6Gq6KIgM97inqgJcQcJ?= =?us-ascii?Q?Y=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0842; 5:t+05GFL2oJYJctGryoo7rle7dwmXSKX5P5Lx8RGuXPX14lx0fRqgMwxtRSq+YDoXVHKkp3ycD0aM4lqQWTdJUsKZjX+2jPpICu4FSL0m2VZ8R24/1JeCQv6fwmYTewH53k9eA0wm8p2+lB4+XhGFRt1Oj69FBl6EDMy7BrHWVkcaH0pEQfhNYxXeHil2O1irugbm1X8A4eVsE7Bm2H3Xq463d9eFlRwuZ/aoCKcusxpik+xVduygLQUpNdeadLxv0oFI9scelENqlVfC6rIVSaVyQ9U4EZRiKVvoJR6H5y8TJoz4VNmF+3l3koapy5WfYb9s3Zq3MCgkwOPdUcaIcKOm31YOOQ6VS5qfOKQC+ABA0eOK0LuTBdvkNpqtKZVzvGDJw7+ozmiPjRyXr5Dl9Ypungn/fwcL6HtS0MTFgX1PAbmQOFgPqZEPLAcNYCRe4w2AJGMlhPECe6Nc3XDH7baMMaEZ82lCv6iwF+vLbze4NUBMCuIMDxxjscnspTMJ; 24:7pi2eKrUdeDrmCagSHiFdJuzSh1S6dJSGnHhPBRU6A/h7W3uiF+C8gpsDBQtPFlb7O0l5JKdud9/H42dJ3WrUzirm72xa4reI+IMoODQ+x8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0842; 7:+4/E64d647jTfpEbaa1EKFo5yiCj6eeHYLXYQHEyLD9gLYMqRL4k424zHqWm3074fJmoC6/iXCRVjJNPH6dwbJOQjNorh/bWyj53NPpfKdNaZuE5sDkO9jNPIreYLB0wZQM60KhEzAlLsYBVAWbdp53fBtYxhrXyIoV0U9CHzDuALUsKdOiSFdJgziPQZQySjR8CyP4ohyGmJbzfq6G56jC2pZeyeMAo5P1Z6875e79mx/WwqK9i4VXEiUR0gsPgNWAstLLWbAxt8MFD6f2AcGzgHQmOcB+HY4i0+Xn6E2yJZaey+pSfPRgyeArNUI29KJktBadx0r+xUyPYaC3u1o89JoexYlezLzrehNYgJDlbwlkPvRX9G3Vs6A6HUrLZTB/CTjR7ZR38yDzFqKnBjLYPOou7oR0I9C21IJkrPOgYzX9vlxe7Kiy+CkrX94t4OoIp/wGDc/X1xwQu+1qgxRvhcxLniaNehONxU/B+ZkVvrt21V4tSsrQHqApGgeV/zyaftOJ1HCXRaYVKZRazgykd0OpXTE9oJ0etaSqzo/Li3RZwUP9u5LNVb/FXRNlOmlndyXHg0YGeZx6zLOjBIJqk6hQU58hyrptqiSpSsvKUw05+NaTHwUoz1DGWlGgPIkaSHM+WoAcPGIdPyWBc9SOZb76dA+ITlZf55wQ2M6HJezq9VcqNUvzCSbJ07GfAXO7V5yRYT81h47XIe8vrMmn4pLeEn9iocZVci8mf/0g3bi805Tt2YahTAjZHa/fwUu8FgO9BMeI91MbKqthSeAjRKuaX/NLjMlgT6k7tSr4= X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0842; 20:DBe8rNAcIPFm35vAT78SiBYk6VrqGck7t2UMluTliRE8wfvrpoEsj518wSoNMGBB3rZEwRS7U75EV1JA690XZqQf9cE+yWSsb2EoBVn8Hh+BuUrETs58br1V/l/LUZ1InfWLkXAfQ3BXgGoV9fCKaMnuyvjDocSjTYIvucBTmKQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2017 16:25:23.5651 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB0842 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.1.90 Subject: [Qemu-devel] [PATCH v2 07/23] hyperv: ensure VP index equal to QEMU cpu_index X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Denis V . Lunev" , Evgeny Yakovlev , Igor Mammedov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hyper-V identifies vCPUs by Virtual Processor (VP) index which can be queried by the guest via HV_X64_MSR_VP_INDEX msr. It is defined by the spec as a sequential number which can't exceed the maximum number of vCPUs per VM. It has to be owned by QEMU in order to preserve it across migration. However, the initial implementation in KVM didn't allow to set this msr, and KVM used its own notion of VP index. Fortunately, the way vCPUs are created in QEMU/KVM makes it likely that the KVM value is equal to QEMU cpu_index. So choose cpu_index as the value for vp_index, and push that to KVM on kernels that support setting the msr. On older ones that don't, query the kernel value and assert that it's in sync with QEMU. Besides, since handling errors from vCPU init at hotplug time is impossible, disable vCPU hotplug. This patch also introduces accessor functions to wrap the mapping between a vCPU and its vp_index. Besides, a few variables are renamed to avoid confusion of vp_index with vcpu_id (== apic_id). Signed-off-by: Roman Kagan --- v1 -> v2: - were patches 5, 6 in v1 - move vp_index initialization to hyperv_init_vcpu - check capability before trying to set the msr - set the msr on the usual kvm_put_msrs path - disable cpu hotplug if msr is not settable target/i386/hyperv.h | 5 ++++- target/i386/hyperv.c | 16 +++++++++++++--- target/i386/kvm.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 4 deletions(-) diff --git a/target/i386/hyperv.h b/target/i386/hyperv.h index 0c3b562..82f4757 100644 --- a/target/i386/hyperv.h +++ b/target/i386/hyperv.h @@ -32,11 +32,14 @@ struct HvSintRoute { int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit); -HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint, +HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index, uint32_t sint, HvSintAckClb sint_ack_clb); void kvm_hv_sint_route_destroy(HvSintRoute *sint_route); int kvm_hv_sint_route_set_sint(HvSintRoute *sint_route); +uint32_t hyperv_vp_index(X86CPU *cpu); +X86CPU *hyperv_find_vcpu(uint32_t vp_index); + #endif diff --git a/target/i386/hyperv.c b/target/i386/hyperv.c index 227185c..4f57447 100644 --- a/target/i386/hyperv.c +++ b/target/i386/hyperv.c @@ -16,6 +16,16 @@ #include "hyperv.h" #include "hyperv_proto.h" +uint32_t hyperv_vp_index(X86CPU *cpu) +{ + return CPU(cpu)->cpu_index; +} + +X86CPU *hyperv_find_vcpu(uint32_t vp_index) +{ + return X86_CPU(qemu_get_cpu(vp_index)); +} + int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit) { CPUX86State *env = &cpu->env; @@ -72,7 +82,7 @@ static void kvm_hv_sint_ack_handler(EventNotifier *notifier) } } -HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint, +HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index, uint32_t sint, HvSintAckClb sint_ack_clb) { HvSintRoute *sint_route; @@ -92,7 +102,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint, event_notifier_set_handler(&sint_route->sint_ack_notifier, kvm_hv_sint_ack_handler); - gsi = kvm_irqchip_add_hv_sint_route(kvm_state, vcpu_id, sint); + gsi = kvm_irqchip_add_hv_sint_route(kvm_state, vp_index, sint); if (gsi < 0) { goto err_gsi; } @@ -105,7 +115,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint, } sint_route->gsi = gsi; sint_route->sint_ack_clb = sint_ack_clb; - sint_route->vcpu_id = vcpu_id; + sint_route->vcpu_id = vp_index; sint_route->sint = sint; return sint_route; diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 2795b63..9bf7f08 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -86,6 +86,7 @@ static bool has_msr_hv_hypercall; static bool has_msr_hv_crash; static bool has_msr_hv_reset; static bool has_msr_hv_vpindex; +static bool is_hv_vpindex_settable; static bool has_msr_hv_runtime; static bool has_msr_hv_synic; static bool has_msr_hv_stimer; @@ -665,6 +666,43 @@ static int hyperv_handle_properties(CPUState *cs) return 0; } +static int hyperv_init_vcpu(X86CPU *cpu) +{ + if (cpu->hyperv_vpindex && !is_hv_vpindex_settable) { + /* + * the kernel doesn't support setting vp_index; assert that its value + * is in sync + */ + int ret; + struct { + struct kvm_msrs info; + struct kvm_msr_entry entries[1]; + } msr_data = { + .info.nmsrs = 1, + .entries[0].index = HV_X64_MSR_VP_INDEX, + }; + + /* + * handling errors from vcpu init at hotplug time is impossible, so + * disallow cpu hotplug + */ + MACHINE_GET_CLASS(current_machine)->hot_add_cpu = NULL; + + ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_MSRS, &msr_data); + if (ret < 0) { + return ret; + } + assert(ret == 1); + + if (msr_data.entries[0].data != hyperv_vp_index(cpu)) { + fprintf(stderr, "kernel's vp_index != QEMU's vp_index\n"); + return -ENXIO; + } + } + + return 0; +} + static Error *invtsc_mig_blocker; #define KVM_MAX_CPUID_ENTRIES 100 @@ -1013,6 +1051,13 @@ int kvm_arch_init_vcpu(CPUState *cs) has_msr_tsc_aux = false; } + if (hyperv_enabled(cpu)) { + r = hyperv_init_vcpu(cpu); + if (r) { + goto fail; + } + } + return 0; fail: @@ -1204,6 +1249,8 @@ int kvm_arch_init(MachineState *ms, KVMState *s) has_pit_state2 = kvm_check_extension(s, KVM_CAP_PIT_STATE2); #endif + is_hv_vpindex_settable = kvm_check_extension(s, KVM_CAP_HYPERV_VP_INDEX); + ret = kvm_get_supported_msrs(s); if (ret < 0) { return ret; @@ -1748,6 +1795,10 @@ static int kvm_put_msrs(X86CPU *cpu, int level) if (has_msr_hv_runtime) { kvm_msr_entry_add(cpu, HV_X64_MSR_VP_RUNTIME, env->msr_hv_runtime); } + if (cpu->hyperv_vpindex && has_msr_hv_vpindex && + is_hv_vpindex_settable) { + kvm_msr_entry_add(cpu, HV_X64_MSR_VP_INDEX, hyperv_vp_index(cpu)); + } if (cpu->hyperv_synic) { int j;