Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp748873img; Wed, 20 Mar 2019 10:03:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqxs172ueXbpgBvRkX2Csz3ayLAXzno3H6V+MIB6N8lXDvdRabqHEqjCPlV3YTVkdkhQ4GHE X-Received: by 2002:a65:534d:: with SMTP id w13mr29103379pgr.186.1553101430338; Wed, 20 Mar 2019 10:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553101430; cv=none; d=google.com; s=arc-20160816; b=HP0cz0MfZ4BxT8Rxim1CtXXNY5wR9of25krmTReg753A0l6Fmra5HsyihFDtjnsY6S G5QbFlnQv+eVDDKDKlDs7y4b2UhWVSDODbAPqwtigfRoW2+Pp8lSgoLSu7hJto61Nm8T oq6ep6oq3L5a8iXnyqSeY2cuJ797KcdKXkfQAlOvxniA0ht7V9La+ipzIBd8lRKsHDnP r8n1T1/4RQe51scJATY1BHrERIjm9DuqDhoaKtqgme9vkH2rLWAHIeGdo5+ovgt5U35J eovxQWDHFbH41nzqSwUJIgB/fCb/m2dCHHfkvjU/c7DbtSxhtQC6iji/H8pStUKpjvH9 3LNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=+dnH/K/tvIumz2pcPxt1rciOWX47j1pUE/tUQWJQ9IE=; b=zrVeXZBcJ6RRqTWpq79D9RHkz9qHj6ghzkLhXkxl17cht+qM2xRb8VJ4rnbo83yT+T Ip50Ax6NVbcs2HYkwCXaR4vGifBD+avKu1j6zOBypvgc2QvV7QqlorSU0Ra0TZurKBo1 L3v9qYP4YdntCVeOrxvUKfpdka7x7JFTDOYCr5yYb5sVcP7Fnnf+rDFXlVWJZyD6MTeq C1g58AmlbCqjL1FbuITV8OQ2dP5PcXy7DY0O1cy3wRwaOEx/2qJ+zymoAWkc7Cd2Ew30 8n1bfA45Xeef9eXK0VyZm4IRwXv/lQ3VNUTNcUjAk2kX/fCcMDDMRDQ8z9DF0MUAHZ47 MlJA== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t2si1910516pgp.444.2019.03.20.10.03.34; Wed, 20 Mar 2019 10:03:50 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727117AbfCTRC0 (ORCPT + 99 others); Wed, 20 Mar 2019 13:02:26 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:43084 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726647AbfCTRC0 (ORCPT ); Wed, 20 Mar 2019 13:02:26 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6B3C6A78; Wed, 20 Mar 2019 10:02:25 -0700 (PDT) Received: from why.wild-wind.fr.eu.org (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BAF7D3F614; Wed, 20 Mar 2019 10:02:23 -0700 (PDT) Date: Wed, 20 Mar 2019 17:02:19 +0000 From: Marc Zyngier To: "Tangnianyao (ICT)" Cc: , , , Linuxarm , guoheyi@huawei.com, Christoffer Dall Subject: Re: [RFC] Question about enable doorbell irq and halt_poll process Message-ID: <20190320170219.510f2e1e@why.wild-wind.fr.eu.org> In-Reply-To: <0fb3c9ba-8428-ea6c-2973-952624f601cc@huawei.com> References: <0fb3c9ba-8428-ea6c-2973-952624f601cc@huawei.com> Organization: ARM Ltd X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 19 Mar 2019 21:25:47 +0800 "Tangnianyao (ICT)" wrote: > Hi, all > > Using gicv4, when guest is waiting for irq, it sends wfi and traps to kvm. > When vlpi is forwarded to PE after its_vpe_deschedule, before halt_poll in > kvm_vcpu_block, halt_poll may increase latency for this vlpi getting to guest. > In halt_poll process, it checks if there's pending irq for vcpu using pending_last. > However, doorbell is not enable at this moment and vlpi or doorbell can not set > pending_last true, to stop halt_poll. It will run until halt_poll time ends, if > there's no other physical irq coming in the meantime. And then vcpu is scheduled out. > This pending vlpi has to wait for vcpu getting schedule in next time. > > Should we enable doorbell before halt_poll process ? Enabling doorbells can be quite expensive. Depending on the HW, this is either: - a write to memory (+DSB, potential cache maintenance), a write to the INVLPI register, and a poll of the SYNC register - a write to memory (+DSB, potential cache maintenance), potentially a string of DISCARD+SYNC+MAPI+SYNC commands, and an INV+SYNC command Frankly, you want to be careful with that. I'd rather enable them late and have a chance of not blocking because of another (virtual) interrupt, which saves us the doorbell business. I wonder if you wouldn't be in a better position by drastically reducing halt_poll_ns for vcpu that can have directly injected interrupts. In any case, this is something that we should measure, not guess. Thanks, M. -- Without deviation from the norm, progress is not possible.