Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3408664ybg; Mon, 28 Oct 2019 12:20:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0jOLds0UFCUYtUoVtqeOCR/EfTrnyn1EXpjqZ/th0d8CPUcTl9e96541LX6U6SZD6Ep65 X-Received: by 2002:a17:906:73d4:: with SMTP id n20mr18587630ejl.45.1572290404601; Mon, 28 Oct 2019 12:20:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1572290404; cv=pass; d=google.com; s=arc-20160816; b=hy5Z9J4XAXT51u/a3SG4IKIBvFUbT+wxzoDEvzUtKqXbJw9/pGdnDI6bVK0ECHgNK6 uArX//p/V9QJxlFdyaUn7IHOS92tyHq0MuJhCHpjn1ByI9JH4j6ujwiLpFJv7AovLgbr swMPJc3FAOuIfuDAqUSvK9jBjL4dPfZt7zV83zA1G1qEd9ECRT0Wfc5kxWpLdGlfI0F/ YXttwxtN1yQemZTtjoeTasW+HbATZN4yBoSLZ8jowjcoLLBt8BMujIesjihjf4deDben /AhsgFPpmeuNXC4td93Ukl2xHZaEDvjQ9ea2HoO2j1ZH7eubM65ZLxxTcvfXPnVEmUgw kBHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-id:mail-followup-to :user-agent:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=4mZ2pbAiNkn29N79VMvYN8z+gNxLUsGCv4WxtPLhRho=; b=RzVzu5yyRZqV02IvQ8TzBFMh5WxU1IjIEaFJe0PqJY+Dy+g55sCgN+ItwQfmSs/qSF pe/uM5Eo2Y2617/ETa5bKIdjSs66jQ4L0mo+dgT/Wr51adhM2lXGwBfdKobY6idazyWl Du5MFdpQ/GP8mjl3vGumI+HXvqhx9OxPlsqXxYUc97U3wL3EqVUMtvU2usJrR4R6VQob Mr9vHqt+3D/ZCluEhkE9Z517l5uGdEs9i+zF0xF+0a5rZI1kcDTEuae/qD1cUR4J2PuS MfQBD18FmhnlHiSVn9EZFF3OntZ3KIYRm16T2b40yA37f3XFkb0FxAGpfBEtDVvCkiSV dRrQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector2 header.b=a4LHDuf8; arc=pass (i=1 spf=pass spfdomain=virtuozzo.com dkim=pass dkdomain=virtuozzo.com dmarc=pass fromdomain=virtuozzo.com); 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 v20si6717024ejq.300.2019.10.28.12.19.40; Mon, 28 Oct 2019 12:20:04 -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=selector2 header.b=a4LHDuf8; arc=pass (i=1 spf=pass spfdomain=virtuozzo.com dkim=pass dkdomain=virtuozzo.com dmarc=pass fromdomain=virtuozzo.com); 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 S2387792AbfJ1Jfr (ORCPT + 99 others); Mon, 28 Oct 2019 05:35:47 -0400 Received: from mail-bgr052101130089.outbound.protection.outlook.com ([52.101.130.89]:46995 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732678AbfJ1Jfq (ORCPT ); Mon, 28 Oct 2019 05:35:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CVbkzNoyEpldP/I24Dr+EaaYBAAUwXDeRLiMo7DkkbkIoAmcXzC+vEIF24nk2RIHKvHwgLL+adxk4saO0jtUxetYFJGEce7u/zek2MxNodK/hQQBeOf8bPe/9zgYGMBp7vZ8TfwkWsvpF8hLd+KS9IHNkukEoElyAWCd6A3MhbkQbwhOVQ66QxBV3xfOUUOu8GwBbQ9w28QxadZpdfkaYkidNcmDpjjMr1v0F/506CXVO2sbnom3znusH4WnDYoh21FIS29qVHIem2ln/hBz7XG0zPv/WZv78pgQJKeb0fcp8MPXycuouYvf48vgsBrUySH0IXsNHUwCO88eHp+1Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4mZ2pbAiNkn29N79VMvYN8z+gNxLUsGCv4WxtPLhRho=; b=YJ74TeNYrzWFuWyMRh3fs7hVIswsUgGgk7wzJ5jSFpv6XYXjnUzfegkEpy/dofCGVFSEoiGrlYbrgzOofrcr+6OhAg5utXB80vs2vHVsghCnPv6ey0ou2mQYZKUXWhp9oA3OTd8DCin15jRfXOLqf1TVCwVvrIosNQCNsd0WM4e8e3tGqrWcqeJWSOOYQcPr7AIU0ydQK0Q9dLEN74mw7lzOCr0uOY2N9EiElQQ1h7am/0nIVEqARwUBCgMQI2SysmjYaJWOVzFBWA7pELE2s21U+azOmhsD/kbgPP1R7CLHzHxjF/GW/Ip9WvvZCMJ0YL6g6LlShBCzdZt/b3ugWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4mZ2pbAiNkn29N79VMvYN8z+gNxLUsGCv4WxtPLhRho=; b=a4LHDuf80w7da4LpD64fuYG8pf12kksHpkGfsTXZm4RQFzdr59J3lL7BSwpQfT+PRMAWD/GvkB7ZnAXHjHVQ2dgzjaQ7mxiaNIuLtrOABrqcLoxiaV8LTi9yDHrxDkA1yDL5R5fmXOI4d7TKSbjCTsbT0NbUqx3nvI5j70Ar0CE= Received: from AM4PR0802MB2242.eurprd08.prod.outlook.com (10.172.218.15) by AM4PR0802MB2276.eurprd08.prod.outlook.com (10.172.218.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.25; Mon, 28 Oct 2019 09:35:43 +0000 Received: from AM4PR0802MB2242.eurprd08.prod.outlook.com ([fe80::9c3e:dc5:e056:9f89]) by AM4PR0802MB2242.eurprd08.prod.outlook.com ([fe80::9c3e:dc5:e056:9f89%12]) with mapi id 15.20.2387.023; Mon, 28 Oct 2019 09:35:43 +0000 From: Roman Kagan To: Vitaly Kuznetsov CC: "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Sasha Levin , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Michael Kelley , Joe Perches Subject: Re: [PATCH v3] x86/hyper-v: micro-optimize send_ipi_one case Thread-Topic: [PATCH v3] x86/hyper-v: micro-optimize send_ipi_one case Thread-Index: AQHVjNn473X+0wGhnUOCRzZ/uvX6C6dvzGgA Date: Mon, 28 Oct 2019 09:35:42 +0000 Message-ID: <20191028093538.GA9711@rkaganb.sw.ru> References: <20191027151938.7296-1-vkuznets@redhat.com> In-Reply-To: <20191027151938.7296-1-vkuznets@redhat.com> Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mutt/1.12.1 (2019-06-15) mail-followup-to: Roman Kagan , Vitaly Kuznetsov , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Sasha Levin , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Michael Kelley , Joe Perches x-originating-ip: [185.231.240.5] x-clientproxiedby: HE1PR07CA0035.eurprd07.prod.outlook.com (2603:10a6:7:66::21) To AM4PR0802MB2242.eurprd08.prod.outlook.com (2603:10a6:200:5f::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 395f6612-ea38-494f-386c-08d75b8a33ac x-ms-traffictypediagnostic: AM4PR0802MB2276: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 0204F0BDE2 x-forefront-antispam-report: SFV:SPM;SFS:(10019020)(136003)(376002)(346002)(396003)(366004)(39840400004)(199004)(189003)(71190400001)(71200400001)(186003)(26005)(11346002)(6506007)(446003)(486006)(25786009)(476003)(102836004)(478600001)(33656002)(386003)(81166006)(66066001)(5660300002)(1076003)(4744005)(66946007)(66446008)(64756008)(66556008)(14454004)(52116002)(66476007)(76176011)(99286004)(6116002)(36756003)(4326008)(8936002)(86362001)(3846002)(6916009)(54906003)(58126008)(316002)(7416002)(7736002)(14444005)(256004)(6512007)(6246003)(9686003)(305945005)(8676002)(6436002)(6486002)(81156014)(2906002)(229853002)(30126002);DIR:OUT;SFP:1501;SCL:5;SRVR:AM4PR0802MB2276;H:AM4PR0802MB2242.eurprd08.prod.outlook.com;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-ms-exchange-transport-forked: True x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: f+BlratBuPpvYCO8uSJWZ1dVMNt78bi0UsXWPOGrINwAJ0vaTOY/9DqmgM+5NB65wOr0zJEU173jPpT3B7DONevbOdLFPT4hVHN+vpvCjAvQrn2gzj5w7NEjNvJcEzsCT8r5UpVR41a1Z7xp2HwQpV1ajA/o0IfmP4+3MeKLqsZzlhI6NDT2xTkzxZqWATQf2IlSstCSEzu0ndCXNU7Dt4wgUQOfhnIlyykV5vIiOkW7ULe8koycgadfXmIYIQOBryxAFf0/fLddSpn/GL0fxR9Z3dwe3HLdRHrZLSYRniQzvDW/vGHn8DQC7O7fDxpA+GO3fMSdN0IcuI1+Mn/Wi4nK44EdMXSA7yhcl/4diK8pfe0wFn7I8XgOkVPwgWan Content-Type: text/plain; charset="us-ascii" Content-ID: <89B8387013B49445A75278895B07D0C5@eurprd08.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 395f6612-ea38-494f-386c-08d75b8a33ac X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Oct 2019 09:35:42.9032 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: +M2mNKIsBakrUX6Y4kq5ksbs2Mbn7CpQKJo6W/hlzqu/Axs3EbdHHhnuKKvVujinkYKoXHJiHQKQfuuKLVwmnA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0802MB2276 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 27, 2019 at 04:19:38PM +0100, Vitaly Kuznetsov wrote: > When sending an IPI to a single CPU there is no need to deal with cpumasks. > With 2 CPU guest on WS2019 I'm seeing a minor (like 3%, 8043 -> 7761 CPU > cycles) improvement with smp_call_function_single() loop benchmark. The > optimization, however, is tiny and straitforward. Also, send_ipi_one() is > important for PV spinlock kick. > > I was also wondering if it would make sense to switch to using regular > APIC IPI send for CPU > 64 case but no, it is twice as expesive (12650 CPU > cycles for __send_ipi_mask_ex() call, 26000 for orig_apic.send_IPI(cpu, > vector)). > > Signed-off-by: Vitaly Kuznetsov > --- > Changes since v2: > - Check VP number instead of CPU number against >= 64 [Michael] > - Check for VP_INVAL > --- > arch/x86/hyperv/hv_apic.c | 16 +++++++++++++--- > arch/x86/include/asm/trace/hyperv.h | 15 +++++++++++++++ > 2 files changed, 28 insertions(+), 3 deletions(-) Reviewed-by: Roman Kagan