Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp595280oof; Tue, 25 Sep 2018 01:59:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV63JHMJTN7VfXnW4+++M6JnOcNx4fJDaAyWP/99OynurqMm4PVA/wwi4qbVMOqlpVb4BkZGx X-Received: by 2002:aa7:800f:: with SMTP id j15-v6mr31090pfi.174.1537865953319; Tue, 25 Sep 2018 01:59:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537865953; cv=none; d=google.com; s=arc-20160816; b=jfF+saFwLrDV7rwhqsMH4jTq/ubqsYLbLu9FXUUSNk5cDpcNK9rHtVKh9arGYoFYsg 5o8ePaRnKxQjt2QStBRgAwxgJ5lRRP3hcxPtdQzgTD0iQfGr3jCxRWCOMYfM527uxPh8 tsQSmmg/GASyB+MJatjUZRj7yIBda+BMUu+d+JrBLJaAbNcIhcpzVQwxg6qjyCb4lxmu y4uvfyQFe04Z5kN7NOx0MvzOhXUu/7ZRndoUyYF8K1x3ZRdWddQB7yzlcwKIlmP8YRR/ 6coyW2QGgk/u2UB64Vbd19lUm6Tw79v2+uuj3uc98a6ZBsnq81HwZZmmvcFi5SkxFdbi YOfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticoutput:user-agent :in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:dkim-signature; bh=sqFwgsrL/2ERtaHZfSOnebpEG+bhCU91a4Zg4yjy4rM=; b=TLFMnZTw+KeT94hFbuJ0NdY4pkW6RTQ1w8rRjuUxY6cn6hht9sGURyb1Sp69CCMx4T 86OIu/xgdE8aDEOWoNJIJaEiaYc2E7Wtte6DxZIgunWVPYr6JMzSKOb/SJLJXGg8BxQn GYb7RlZefSPghoq+080wspGYO6+4Fk/XqX/M98V9v7/JKZghna3Q17htkOFdWzwZwp6z LhEfihxPBDem/Ir6II6fvd4xQd/XIq87ZtCMoQ+ZxnmFyWurpoXU4rju57rqjhYLtuEg uybEc29QW45JRBfCAS+m/c7pOL/V7KD5fbUpY4cUS8Jx3vRYJ5aBlFNZn3caHiurTydW Unzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=T4dKWCXM; 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=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7-v6si1874691pgh.359.2018.09.25.01.58.57; Tue, 25 Sep 2018 01:59:13 -0700 (PDT) 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=@virtuozzo.com header.s=selector1 header.b=T4dKWCXM; 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=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728488AbeIYPEj (ORCPT + 99 others); Tue, 25 Sep 2018 11:04:39 -0400 Received: from mail-db5eur01hn0217.outbound.protection.outlook.com ([104.47.2.217]:9069 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726660AbeIYPEj (ORCPT ); Tue, 25 Sep 2018 11:04:39 -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:X-MS-Exchange-SenderADCheck; bh=sqFwgsrL/2ERtaHZfSOnebpEG+bhCU91a4Zg4yjy4rM=; b=T4dKWCXMMlkmrqgmWCwLbjCoIEFm69pn4/1RSzMFaYQhOZ1lqpbToVqRjz2Ql2dTJXZj9E+JJFv1lUUE7U5xLGGvShBtVIJlklC4kLD7fAijlXASSia+/LPtXin/j1azMH+RXgga9audFL5CCBv+M049uz+QNwvnasBa2gs7yu8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (185.231.240.5) by VI1PR08MB3599.eurprd08.prod.outlook.com (2603:10a6:803:85::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.22; Tue, 25 Sep 2018 08:57:57 +0000 Date: Tue, 25 Sep 2018 11:57:52 +0300 From: Roman Kagan To: Paolo Bonzini Cc: Vitaly Kuznetsov , kvm@vger.kernel.org, Radim =?utf-8?B?S3LEjW3DocWZ?= , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Wanpeng Li , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 RESEND 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() in kvm_hv_flush_tlb() Message-ID: <20180925085752.GA5391@rkaganb.sw.ru> Mail-Followup-To: Roman Kagan , Paolo Bonzini , Vitaly Kuznetsov , kvm@vger.kernel.org, Radim =?utf-8?B?S3LEjW3DocWZ?= , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Wanpeng Li , linux-kernel@vger.kernel.org References: <20180822101832.31763-1-vkuznets@redhat.com> <20180822101832.31763-4-vkuznets@redhat.com> <8da03d2a-5405-f363-f081-e4bc46b106e3@redhat.com> <87r2hs7cco.fsf@vitty.brq.redhat.com> <87zhw62797.fsf@vitty.brq.redhat.com> <74055c3b-be66-4ce6-e727-a155f18a0ba1@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <74055c3b-be66-4ce6-e727-a155f18a0ba1@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR06CA0141.eurprd06.prod.outlook.com (2603:10a6:7:16::28) To VI1PR08MB3599.eurprd08.prod.outlook.com (2603:10a6:803:85::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 182afaee-0059-4e13-d38b-08d622c4fd9e X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1PR08MB3599; X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB3599;3:lOmcwOQ3b2MYFxKIAE8uIzu5EJ0wB3eXL2E1frWvRDuXqOcbB4jxRWGJlKJ/yXyBhCUGzDzxlbrDjUbhjToyFPzNvQpTPA+kBE68tVkKzjf5ZR+elRVO5GtRliSKX1rugiHVBI8+XaPRK2qGV1WsL7zg3u+VlACxiQcJN5rf48LYDPLKFSMgrlMIAx1kNwoy78X0Jqf0KhIEnZyaX8BiISWXi+bNFlNGYIteZjAeY08/RgNCyMNwL6HyjjPnPkME;25:j/T9WH4gO9S3iG2/rNdoF/K9XuxFlJTVLGOsAlHsvPXVgYsV40QIvWofcZit6tmFQsTwQhFNqujho49uAdZg3+b+LeEa60BoKXwkEiQrgM5mVQLK3U386/2uRCQeZosEKhyo4sHQRndLffSmkp7mKSZbmPc45DhVMrpjK52w9dqUFHNZfE9Am9xZejPAE7/37wS16SGPUwWECKKIGU0++wnVOvj4Osrfjzfo1O8H+ldDmUBHzTS+hI1dA7SnOGIEuZH6SeVI01GMdVfcPM0++H8Q6hmnVnqJPYtg3K2NCt/9qqjbFwwNbEggrB1bUJc/X2MfJ+X2vPFY2P3NaIcNbA==;31:ZU1z+Ozkefk8CA8sxbMAjLUCs1+An8pRS52y1rBb5M85dHjLuhfOJu8+HPj9IpvZlFLCA6Fsk90sK8bP4hYbxoPFlNdgpQlUOiWNryxz/REtQEiuq26fwjeXniliLG6zNRs/VMC59VDalHAn+VQtp8OmyzSKw8K/eXL8095rOA/bvTv4TwvuS2rLPNqzpCzxprl3kjtntPovJFBpGpsKISzVAThrr7CUs409CNWj1q0= X-MS-TrafficTypeDiagnostic: VI1PR08MB3599:|VI1PR08MB3599: X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB3599;20:cS/fsDmKiJ588BDqL7bwndYANLqWheq+4KT4mVxq+i8hlNXCXW8XmmcaUbPlOioMsm8HR0P47bM8uoHUJFO9tUc95yRMKAPV9hFtVGrcrXme2tBMtz/3sBW9rvEW8ajXfUd2cVi8Hrj9n9Q9BSjF9gv+8HVOLs6aN+9Ro4NVK8IozlhUkdabK0SNC9R6X47gPiGwoO49sKSQGeOAeJypQ7rxQBr3jq1CX/lYW32CXkC2FOsQGoftKmAAENh0qWXj1E1DVK2/vE9E+JaG5yBok65qla6kuPuvUhHvc9b4YTaksjP34lz6MZXg7bJGDDL5jlgYr/QqUI7+3PgJTP21apBmbprCZAmKDXvQbHp0ByXo38Gr7I+n/zn3WeIQKspbUi+U2D+D20xDk/71+ZDoWvuHiPIpEgP/uSm4wwTG9MJ8EF99YlET09RgQH/ejWIeTmZXH1ZtUhlx+gIzQ8AMAuMyXxZeiK59lHCRDGm5GV3TLkdW4RAV5M8TwfhTBpLh;4:Qsd1TzExE0m3+eiTreUSqEEfIFucrvkjcuJiZ7uPTGVKnGiQaz0TA7vDQkm1wKPU7Sro0K/yVOW7sl6xsBEhwa+d6na2IUrddyYeZ2pnF3WItsCT3yMuRVXL+IK7lSbOl5kiplEp/tn7BPqEwvM8sGvDuLFu1zpTEtxyGMTAtrrlWSqVN9vb43NrY3o6HpO5Q5ZZWYq5l95cqK/yZsJnQQaHUbkgNGfof5vDEI/Z40dXmIVCVx5qoFvIZiS3OlDIrKXeCY12e5+XPCuV8sChLA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231355)(944501410)(52105095)(10201501046)(3002001)(149066)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051);SRVR:VI1PR08MB3599;BCL:0;PCL:0;RULEID:;SRVR:VI1PR08MB3599; X-Forefront-PRVS: 08062C429B X-Forefront-Antispam-Report: SFV:SPM;SFS:(10019020)(396003)(39850400004)(366004)(136003)(346002)(376002)(199004)(189003)(57704003)(69596002)(6916009)(8676002)(6666003)(486006)(11346002)(81156014)(446003)(478600001)(476003)(47776003)(956004)(7696005)(86362001)(52116002)(97736004)(8936002)(93886005)(6506007)(316002)(81166006)(76176011)(53546011)(2906002)(5660300001)(6246003)(53936002)(26005)(106356001)(16526019)(4326008)(39060400002)(25786009)(386003)(305945005)(7736002)(54906003)(7416002)(16586007)(1076002)(6116002)(58126008)(3846002)(36756003)(53416004)(229853002)(68736007)(50466002)(105586002)(186003)(33656002)(66066001)(9686003)(23726003)(55016002)(30126002)(18370500001);DIR:OUT;SFP:1501;SCL:5;SRVR:VI1PR08MB3599;H:rkaganb.sw.ru;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR08MB3599;23:4pjTGjibMWEcJlDsUK3a9bEVWh4g+WHTYz6daBpfE?= =?us-ascii?Q?b11RWQVla8XkJKRjttqctphFdOzZhmCNgGOgI5SyUQSs/cEB5abCoHXS48Yd?= =?us-ascii?Q?ccXK5cWkLg4T+QVJ2/3y2e/D8/fOyyyTwr7k6RMxcyf4UCFUYUhA+b/X4p4A?= =?us-ascii?Q?j7RteFulic7Y6xe5iEjeBKidCac0/cuxqrHR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F61yb4XFMNGFqsEEs2HyLEyee68YX6wi326k2/D2KcVtNwE0PJTVYdx2xFnEIytnARC8dQezdiPA+B/9olcfQu6Pp0NT+3Y2gx5nSdDhWZxDe55yTBDhYyDZyXxo3cXGsg6PZbK+/8429TOteWQN5+iVkklhfVpV;20:uPVPk2Towkb4Kl0UlVLFFHacXPgSoaNrzqW7qdHOD9pX9OiE9ytw/jea5TFHyePHtHofpuqpEf7bL5IYf+PXoGrPzKSz11P7OV2NK5pzguGh6kh8so3kbIoB61f/McX23gOEVVzjxnoqonVEBHDlue17ZTkwtT/84xSqZXhMjs8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2018 08:57:57.2545 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 182afaee-0059-4e13-d38b-08d622c4fd9e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3599 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 24, 2018 at 06:55:28PM +0200, Paolo Bonzini wrote: > On 24/09/2018 18:24, Paolo Bonzini wrote: > > Hi Paolo, > > > > could you please clarify what needs to be done to get this merged? In > > particular, are you OK with my comment above or do we need to do > > something with it (e.g. get back to the 'logarythmic search' from v2)? > > > > In kvm/queue I can see only 'x86/hyper-v: rename ipi_arg_{ex,non_ex} > > structures' patch from this series applied. > > Hi, > > my plan was to apply only 1/2/5 for now. I singled out the rename patch > because that one could be included in 4.19-rc kernels as a cleanup. Is this supposed to mean you're not happy with the approach taken in Vitaly's patch? Can you explain why? I take my part of guilt for it so I'd like to know, too. Speaking of the options we have, the choice depends on the assumptions we take. (And I guess when you spoke of quadratic complexity you referred to the algorithm to convert the vp_index mask into the KVM cpu mask.) If we can assume that in all relevant cases vp_index coincides with the cpu index (which I think we can) then Vitaly's approach is the most efficient. If, on the opposite, we want to optimize for random mapping between vp_index and cpu index, then it's probably better instead to iterate over vcpus and test if their vp_index belongs to the requested mask. Neither of the above is quadratic. Dunno if we need to specifically consider intermediate situations. Anyway using a havier vp_index -> cpu index translation looks like an overkill to me. What do you think? Thanks, Roman.