Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755114AbcLBTeG (ORCPT ); Fri, 2 Dec 2016 14:34:06 -0500 Received: from mail-db5eur01on0066.outbound.protection.outlook.com ([104.47.2.66]:46005 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750842AbcLBTeC (ORCPT ); Fri, 2 Dec 2016 14:34:02 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=cmetcalf@mellanox.com; Subject: Re: Questions on the task isolation patches To: yunhong jiang References: <20161201142812.369f23f8@jnakajim-build> CC: "linux-kernel@vger.kernel.org" , "Paolo Bonzini" From: Chris Metcalf Message-ID: <5dd4cbf7-d0c0-074a-c5bc-e2e09ec3dc75@mellanox.com> Date: Fri, 2 Dec 2016 13:58:08 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161201142812.369f23f8@jnakajim-build> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [12.216.194.146] X-ClientProxiedBy: BN6PR01CA0058.prod.exchangelabs.com (10.172.194.148) To DB6PR0501MB2759.eurprd05.prod.outlook.com (10.172.226.11) X-Microsoft-Exchange-Diagnostics: 1;DB6PR0501MB2759;2:vpQcdb/sAW/QTpez4mPStD142rXcma8cQjlgceIEBA1Ulk/GEBv/NmVZkyPjsr3V3gPVbSjbCUYZU42n36SE2yDDOjZBPLUSy3Peu6Qhm4luNHCr4y/KK7Q4zj8qtT0HCafR97X7AFwuaiBIoK7hf5BcT9cKM7ZxQgblj7YCu2A=;3:BEX3GQTcx4dgB7MgnhBk/M9ZGRKye4UMNTDjH9tP6b1Mzs3T1huElK+mlBFwL+wJH5J5oiNlq5Dh1XG2keyP4PH76uUk4+QHFzACuGUKbKPuGDDTruCrwl6QXHTYpHe7a+KBKYQWASMuQ7/mmLLvZ5EMfK2v1kKH+LWSLFFMFIk= X-MS-Office365-Filtering-Correlation-Id: 7db3cb5d-b144-4a24-6bae-08d41ae52dea X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DB6PR0501MB2759; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0501MB2759;25:55d5YcHi7blbeEpkLRvqYM+nyYr52Es0AQ4HURZqlAjDxko+4hv//qo5tMYN970ysxacGe/tMw1feh6+2ghEIk3m77X+IB9nMQjrXblwvKy8qG/W0TAypi7OzDWOd4bMll8kCCtxgIuJslPwqYDG/stxMyA/qZISE8AOJVvbPfF+XHqqsGArKUwpWoM+X6McERGP7JIkCW1HXCXLU9xZd4yzyes/pIAfEqOqF4HI94U688EfGNb1s5Icf1eMLQkXUmNaLf4eJ3AIO12WEuuwpwUB2bfEjEbXxAc4o3OxR2H8lMTP3RnPrJb2PIOuWdtmwD2xb580I08A8pVMakx4bMvPALQ2WstAer+TPPLksUrwwINo7/n6um368YNl5XVjdAilEGVZFiAn224dP/cThcEU2fsf5FjJZGUvRGNzv8Zqd3Nt+h0L/egVzSKBB78AlIh4L8TSD+DB8H77SKXYn9wmXUQtH6rVr+enwnIQvMukKVQL8Eyy8YwpvhNaY98gDfKh69L7aVm1UZGWZgXlgEj7iT8cjKgfxwGVb+caC2LefL5Ipr2zlbwlGw73nTxwCX56cax82ypM5l8BlkNjlsfrNNw93IRxVUlEkEB8I9xFlTrX++pqel+j+Cgr3xKH/J634quI8dGegUXIIEFBMmE3N6tNS8KS98ZTEh5+1dxU3VOM3FLHqTZ85otW0L13i3R1MPBHakUq2q70KL+zJOIgiuB2XFAyILn3hlIlAW2MkYDS3I+bvG0oHYmehCBgX3D1xBJTT6H/pBF/1GXK4epvVYtrFVPf7agbmkfALzLMwgpVxXoHBj+bK7tNV0X0FoEO3UbAXWrrguNeXFu4b6pBxr0h7olhmLlTjemsayHBjBeKbPxWZtnP42cqFQhs/qXS7UURFR+tGQ+koTdXsw== X-Microsoft-Exchange-Diagnostics: 1;DB6PR0501MB2759;31:kuQDF8SbrLDFIIJet/fveJUCw9OblnGJ/iUzeduiysWNMYWKTo7f5fdyzlqZ17sOIhmU1egfGrpO4zAMShNe0ywSdBzsPquQ706tKtsLcwaICF+XjSYSjpWttgHbSV/JwYOWToqrFqLy4WaSKzeLvBWIQ8pBkqjq+s4HdbWYgcmWiTqPXQiRu4bNtDND6YbzgB2iCM72jbB1BYLgBiPRftcVZs+s8y6eevevMfqO4kcWxly6Jxj8V3p2eC0B+Wr1capyUeC1qisinBbXnW322w==;20:OhcwtwKOZ1ty504UG5sle/g0xo0GlVHHUB6UsMIIYBXlENpHfYbYM+6lzqAvqKiVe3cSAqa5S/ZsjqGM1mddhXzqTwEVSyl8Y/3XCAzyFnBNW17AUeapgDohVpKWXPyqErfcmx2yHh6cJ74CSr8r76d1Y+bE3oX9cxrf8OP81cM6N+pA22F/3W/r88lrJ9eYJ/MdylaFR6yoxYrnB0KzRRaGdKnvrEIIZHeo+2nGpn8iLdSQuQh+0hbBKCGmPRShzUtmHhzD6WH4bX+4ws9dViyu8+3mp56cOaG3tNUOz1Nct9Kj9HjVTFTP0PCvhUGPJakV/4DDdmsr0rglI2MK0WDmTUkwh275PjAboHqbuCq0mfmqLN683XVNp8in+0s4LgU9ewJQkrg0YQh6zSa0khSo+AwcyXBid8LJOB4+Di3zxLFTaiijSaQY2Se10wokYmxEe+3CFoZQpkmwIX3W0WDcfyyLzDqF/Lgr1wEFzKXlAQWF6qlWyFiR3YkfWBuu X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(171992500451332); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123558021)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6042181);SRVR:DB6PR0501MB2759;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0501MB2759; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0501MB2759;4:hLV2/Q6cQ2pXwTPyE7I1o3yv+ZJOIAZFxGTTIeH1lHnlP0FlL4edOmKH04CSc4izYHTFYair+HuoR1z2nS8WtaFTrv56WWg31fo4Q5Ykd5+fU3u3jlY3jIyFII6JTYcyf12rpoi/tNCCFl5K71oc/fxl9HWKfFzgrcuGsqRrOyN+hxGVosHqsFOhkCkbzc3cKw1iEObKya0vLx3f5FmZEz4U2zFSpWmUpicN8LB8MLC+/mBDtQ8AIcMxtylx3yfXI8Y38+DCTDmkTjQIai146xytMh6D3qVZFam3rBR08gW1m+nTaSJPeUkNHwchmWHOyBLKwRxVxj2zz105TgiMO172xN12SasRVkd7Rc4D/TIBidB1KmdQ2YINPX0b5SgxnRQzd8e1ZazXNB5ySrEsLOzby0Uhs6BaYtg7THxvqR4nDKMT1wUiTP8HC066Yh93JTkXBZUVsh50cdyVfrKUHSwDe3b8l6xMjULzKQWcKydnwgLFKt9Q9Z65Hmxc8aQWkbRGxP9U1KJtRo2z1efQPIWrQI3qZewBuepbak9caWSQGUUnxDMRZePIq+e1P0MPZ52l59wJ3MvQ7Fm1kpo+Sh2/Bw+zM06qmBwiwMb4qO80f4XCHwo0TICBQiCdF+Akg9EBJnnbWvJuBme8ebT16OkVMNa/3b60oDyIj0ZTwdE= X-Forefront-PRVS: 0144B30E41 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(24454002)(377454003)(199003)(189002)(51444003)(305945005)(76176999)(229853002)(6666003)(90366009)(38730400001)(68736007)(7846002)(81166006)(31696002)(77096006)(6486002)(65806001)(81156014)(65956001)(47776003)(230700001)(2950100002)(66066001)(23746002)(101416001)(42186005)(105586002)(64126003)(31686004)(6116002)(36756003)(92566002)(4326007)(6916009)(33646002)(83506001)(86362001)(2906002)(106356001)(7736002)(8676002)(54356999)(97736004)(50466002)(110136003)(733004)(50986999)(65826007)(5660300001)(4001350100001)(189998001)(3846002)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2759;H:[10.15.7.185];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DB6PR0501MB2759;23:FElsG49Q1AFJ/Z7zX6O2Kei4K3K+/iDADEL?= =?Windows-1252?Q?3XOsGhTz9ud4XIVlP8iSgzA0D5ccqkI8s14he/eRuMvEx+0FNkoMrLBZ?= =?Windows-1252?Q?4v8MBl2fcFXuHIKQ60LTlMtvpnyPt9MmNf1sYV1u934fkZj7LFX1N7J6?= =?Windows-1252?Q?3DBO1yGxDkG0XfhHiOsILTdzM/35DEuO+bWCigndx6zSTB4Lh0TgNbse?= =?Windows-1252?Q?BHQGVw5+v+mfNzduXiHakKFiTHRbYUfx+Cll1/ZqyniXgGBC2nHjVx0V?= =?Windows-1252?Q?iinM2lrrWFommWv6YaAIxhXhPml990JMQ5KT45GybUt1WpRBi4Towror?= =?Windows-1252?Q?V0sKBIDFPQOJyXJhyxE5H9KIkuMvDbzbYLEIt5TUaZJ48dfWpi0GUQK1?= =?Windows-1252?Q?Uq46a/sxOQu07oid+bftm1CKExrkl2b5c9oMv95ZJ2QKvLxPPbcmAoYy?= =?Windows-1252?Q?Mrtr8rXBBgPSNFEex/l5Bb4vNhdyy6IPw3/hv1TUyDAhs49b85WbMm8S?= =?Windows-1252?Q?sESIp0mzCmwtxgttgQpR8YY3IYxrETrrVFHwpxNGqUNAnhVnXC6LbHMz?= =?Windows-1252?Q?a4/v541AlfHVyb+uw7ydMOFdX8OKhKXXdsk/Hql/rWunE7YyN2H2BhEG?= =?Windows-1252?Q?ZD1xcqGmu9y3iHw4/5WJp4ZyGRTz2N8d0MQDTU8mHLGzwdT/E94G0AUo?= =?Windows-1252?Q?tKiMNQCuzy7q6xid7fGTrUnffwdWfTjrYJ487iaZYQmAzbpKsfSqKeZ0?= =?Windows-1252?Q?OIhq2s8+NrBdri3YcotQQll6qMm443uNuPjwpH52c+qswT0eKeAQSoNV?= =?Windows-1252?Q?fx13Ae0n5+c7afkmbceGBpGv/mMzaoCL8vzGdE4EOa9R/GW5jR5aSqH6?= =?Windows-1252?Q?Wxf74UxhuzjBFfrQfrMvLHyr+ZWyv4X7dzVqIofQ79h6qsW4GU51BB46?= =?Windows-1252?Q?lG9xQ8j6aJraMHlPYkLNUmiM/E5wlJx+JUjmzhX3JxdkmEOGwcJgP/xq?= =?Windows-1252?Q?G28l0K9/uQc5tWQbhfXNn8fpGfdtX3dsHJpQS1Jl3bDwCuT/Mlm3av5q?= =?Windows-1252?Q?4izxRxINajEEinlPeYD/S/esz4ONQ1kXf3KWPLZJ9WNNRQYaeWH8kcMN?= =?Windows-1252?Q?jVj8HznKIifJFawA1+adfRwqxf7r2VIo1jVYZid3zRMq7iJQ+Cvn18S6?= =?Windows-1252?Q?kHUIfEpWFwjSMIlGmac5yvVjybgik/ZD7xQr1VtYh7UwbSWO7LqAjGrX?= =?Windows-1252?Q?66+nXprb6WwfcGT5BUSrmJY4l+uzbwA0fEuSxKzq0SJJyeR4ic9W7llc?= =?Windows-1252?Q?Va1Nt3aH5xilHgeELBd4IKMZo/lHFmTd5DmLj3VJO5X3IG7mDcggxtiS?= =?Windows-1252?Q?M6vXK/GRVjfGnlJYFQapoI+OUICv5tsbC5oE+f06Bao8VB0ZmSbqWEAs?= =?Windows-1252?Q?grc4QLS6Em07ToZ1zc0sLNwl9/fDhwJ7++E1uNzBAkLqSV4rpjXKP+gK?= =?Windows-1252?Q?wz7sqlDfwO5q0p7jfxwdS5IkxsvudPk5byTxjjk1LiFyPsN5IKg=3D?= =?Windows-1252?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1;DB6PR0501MB2759;6:hnWWN6ouyYg/B/9b9uXbRT4t7IWxPEhCeHk/YlAPr0u/xUYaidn2sY6/yklTh0EnRKYrmd4/9UbEgpYE4XzpxwDXL2SrxMTdjyOyF3gEaPjsNQsN2HbXkzG4QxuBixY08NpU9QeVDh1k2agrxy/NBFwto8XAmLuhyqUuaJBAdObEC6jdwRhq9FiT2zQxX/GyGCC7/4e1dRlgzufWH0S7hj0ub2hmNPw7fTrns+UhJzA4AW3Thxn2O+3ZWSayK5W8Twe7xJT0ebj4sZCjJaTQ7ElmZeHXH96Q70DwZWvzrXnmIyGemgO/C+vNTasdWVqTrnKQemqoffEdlCRCjRyOb2Hxb4rXN+SCV4ES8MmfxjY=;5:pDvthUfhw6TyD2Rq9F5QeizdOFMH9+xvxj1NRznZkAdRpgMuuubnzXpTwR19zybzR7m/u/wWcKrUC+NrNegx3adYMTHdO9NMHooF/aoWv7lw//7Q0hPI3OkZ7m8VTMJK0euzWm2Zo/TT2hBg9j0wxw==;24:oPuMjzeXNHDoZGW9my+ERnFxPW7jMzMpoIGMySwmdwiZqLB81HLBmxfvyqMMkPHzLILk5wOe+Sc3Yrpga76B0AGXvrf9KxQ6x8HbPaEPa7M= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0501MB2759;7:9uvT5O/wCt6lxqLK7uut6DXCG8UCW1xb2cKViZeYVbHQqR7ZHpnCeF1WKL7d1CXE4IvXr06eyYRcXYb/p1ij82XoI43a3d9TqF/RG9qXv4ysQcVGQIAH8O2qpqdbXacq58/rzIjsE0mj0StgwOj0T5Zg7E7+1UZZDy9RuLxdLbZhhHQIVkfjuzlBapvgiGtifdookg4iqd7Qz3AV3TJ6uY8zHp4valCneYRoqzagc9Hx29YAWzsBc+ipf6JkmlAcKjIPf2GmPUBkoK3P7g+MfCUV/cIatbrDgEMKTwBZGRlDeiCVVjDJkVx719Qx8FfCWbIr10wCwKwhuAN421R2pl/sS7Be7EreUFlTjDXW1tQ= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2016 18:58:17.9977 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2759 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3283 Lines: 69 On 12/1/2016 5:28 PM, yunhong jiang wrote: > Hi, Chris > I noticed your task isolation patch set at > https://lkml.org/lkml/2016/8/9/759 . Thanks a lot for the great effort. > > I checked the patch and have some questions about how to use this > functionality on the NFV environment. In the NFV scenario, high speed network > code runs on a VM user space and the VM is hosted by KVM hypervisor. To achieve > the high speed network, not only the network code should be isolated, also the > vCPU thread. That's true. > I checked your patch to think how to isolate the vCPU thread, and I have > some questions and hope your hints: > > a) If the task isolation need prctl to mark itself as isolated, > possibly the vCPU thread can't achieve it. First, the vCPU thread may > need system service during OS booting time, also it's the application, > instead of the vCPU thread to decide if the vCPU thread should be > isolated. So possibly we need a mechanism so that another process can > set the vCPU thread's task isolation? These are good questions. I think that the we would probably want to add a KVM mode that did the prctl() before transitioning back to the guest. But then, in the same way that we currently allow another prctl() from a task-isolated userspace process, we'd probably need to allow a KVM exit from a guest to happen without triggering any task-isolation errors. Alternately, if we add the proposed NOSIG mode, then the hypervisor can use that, and simply stay in task-isolation mode no matter what system support is requested. Presumably in the guest, we'd run task isolation as well, but presumably we'd only exit to the hypervisor if we were already in the guest kernel? Although I guess you could image providing trapping mmio mappings to the guest's userspace process that caused a hypervisor exit. Perhaps we extend the hypervisor to know that a guest might support task isolation, and to generate a warning on behalf of the guest if the hypervisor sees an exit from the guest's userspace and the guest task is in task-isolation mode? > b) I noticed that curently the task_isolation_prepare() is invoked on > exit_to_usermode_loop(), while we may need such job on VM Exit procedure, or > interrupt handling during VM exit handling. Yes, something like that. I am not super-familiar with the KVM internals (I did a KVM port to the tile architecture a while back, but I'd have to swap all that memory back in before I could even have a half-educated opinion.) > Also, I'm also considering how to utilize this task_isolation for network > node which is not busy-loop, like the interrupt mode DPDK code. In the > interrupt mode DPDK code, the application may yield the CPU if there is no > network packet for a very long time and it will re-enter the busy loop mode > once new packet arrived. This interrupt mode will be helpful for both power > management and resource utilization. Per my understanding, the application > should turn off the task isolation before yield the CPU and the restart the > task isolation after the new packet, right? Yes, exactly. I am not likely to pursue KVM myself, at least until the basic patch series has been accepted upstream. -- Chris Metcalf, Mellanox Technologies http://www.mellanox.com