From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C6B2C433B4 for ; Mon, 10 May 2021 16:19:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C38E61165 for ; Mon, 10 May 2021 16:19:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231243AbhEJQUS (ORCPT ); Mon, 10 May 2021 12:20:18 -0400 Received: from foss.arm.com ([217.140.110.172]:33710 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230254AbhEJQUQ (ORCPT ); Mon, 10 May 2021 12:20:16 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C6F31168F; Mon, 10 May 2021 09:19:11 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.4.9]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 063FE3F73B; Mon, 10 May 2021 09:19:09 -0700 (PDT) Date: Mon, 10 May 2021 17:19:07 +0100 From: Mark Rutland To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, James Morse , Suzuki K Poulose , Alexandru Elisei , Eric Auger , Hector Martin , kernel-team@android.com Subject: Re: [PATCH v3 3/9] KVM: arm64: vgic: Be tolerant to the lack of maintenance interrupt Message-ID: <20210510161907.GD92897@C02TD0UTHF1T.local> References: <20210510134824.1910399-1-maz@kernel.org> <20210510134824.1910399-4-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210510134824.1910399-4-maz@kernel.org> Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, May 10, 2021 at 02:48:18PM +0100, Marc Zyngier wrote: > As it turns out, not all the interrupt controllers are able to > expose a vGIC maintenance interrupt as a distrete signal. > And to be fair, it doesn't really matter as all we require is > for *something* to kick us out of guest mode out way or another. > > On systems that do not expose a maintenance interrupt as such, > there are two outcomes: > > - either the virtual CPUIF does generate an interrupt, and > by the time we are back to the host the interrupt will have long > been disabled (as we set ICH_HCR_EL2.EN to 0 on exit). In this case, > interrupt latency is as good as it gets. > > - or some other event (physical timer) will take us out of the guest > anyway, and the only drawback is a bad interrupt latency. IIRC we won't have a a guaranteed schedular tick for NO_HZ_FULL, so in that case we'll either need to set a period software maintenance interrupt, or reject this combination at runtime (either when trying to isolate the dynticks CPUs, or when trying to create a VM). Otherwise, it's very likely that something will take us out of the guest from time to time, but we won't have a strict guarantee (e.g. if all guest memory is pinned). Thanks, Mark. > > So let's be tolerant to the lack of maintenance interrupt, and just let > the user know that their mileage may vary... > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/vgic/vgic-init.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c > index 2fdb65529594..9fd23f32aa54 100644 > --- a/arch/arm64/kvm/vgic/vgic-init.c > +++ b/arch/arm64/kvm/vgic/vgic-init.c > @@ -524,11 +524,6 @@ int kvm_vgic_hyp_init(void) > if (!gic_kvm_info) > return -ENODEV; > > - if (!gic_kvm_info->maint_irq) { > - kvm_err("No vgic maintenance irq\n"); > - return -ENXIO; > - } > - > switch (gic_kvm_info->type) { > case GIC_V2: > ret = vgic_v2_probe(gic_kvm_info); > @@ -552,6 +547,11 @@ int kvm_vgic_hyp_init(void) > if (ret) > return ret; > > + if (!kvm_vgic_global_state.maint_irq) { > + kvm_err("No maintenance interrupt available, fingers crossed...\n"); > + return 0; > + } > + > ret = request_percpu_irq(kvm_vgic_global_state.maint_irq, > vgic_maintenance_handler, > "vgic", kvm_get_running_vcpus()); > -- > 2.29.2 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DC60C433ED for ; Mon, 10 May 2021 16:19:18 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id A468F61165 for ; Mon, 10 May 2021 16:19:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A468F61165 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id F1F344B415; Mon, 10 May 2021 12:19:16 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RWsCjc6IwFoQ; Mon, 10 May 2021 12:19:15 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 7E2164B41A; Mon, 10 May 2021 12:19:15 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id F16954B413 for ; Mon, 10 May 2021 12:19:13 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M+HRiD8uxSKn for ; Mon, 10 May 2021 12:19:12 -0400 (EDT) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 6A2DB4B410 for ; Mon, 10 May 2021 12:19:12 -0400 (EDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C6F31168F; Mon, 10 May 2021 09:19:11 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.4.9]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 063FE3F73B; Mon, 10 May 2021 09:19:09 -0700 (PDT) Date: Mon, 10 May 2021 17:19:07 +0100 From: Mark Rutland To: Marc Zyngier Subject: Re: [PATCH v3 3/9] KVM: arm64: vgic: Be tolerant to the lack of maintenance interrupt Message-ID: <20210510161907.GD92897@C02TD0UTHF1T.local> References: <20210510134824.1910399-1-maz@kernel.org> <20210510134824.1910399-4-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210510134824.1910399-4-maz@kernel.org> Cc: kvm@vger.kernel.org, kernel-team@android.com, Hector Martin , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Mon, May 10, 2021 at 02:48:18PM +0100, Marc Zyngier wrote: > As it turns out, not all the interrupt controllers are able to > expose a vGIC maintenance interrupt as a distrete signal. > And to be fair, it doesn't really matter as all we require is > for *something* to kick us out of guest mode out way or another. > > On systems that do not expose a maintenance interrupt as such, > there are two outcomes: > > - either the virtual CPUIF does generate an interrupt, and > by the time we are back to the host the interrupt will have long > been disabled (as we set ICH_HCR_EL2.EN to 0 on exit). In this case, > interrupt latency is as good as it gets. > > - or some other event (physical timer) will take us out of the guest > anyway, and the only drawback is a bad interrupt latency. IIRC we won't have a a guaranteed schedular tick for NO_HZ_FULL, so in that case we'll either need to set a period software maintenance interrupt, or reject this combination at runtime (either when trying to isolate the dynticks CPUs, or when trying to create a VM). Otherwise, it's very likely that something will take us out of the guest from time to time, but we won't have a strict guarantee (e.g. if all guest memory is pinned). Thanks, Mark. > > So let's be tolerant to the lack of maintenance interrupt, and just let > the user know that their mileage may vary... > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/vgic/vgic-init.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c > index 2fdb65529594..9fd23f32aa54 100644 > --- a/arch/arm64/kvm/vgic/vgic-init.c > +++ b/arch/arm64/kvm/vgic/vgic-init.c > @@ -524,11 +524,6 @@ int kvm_vgic_hyp_init(void) > if (!gic_kvm_info) > return -ENODEV; > > - if (!gic_kvm_info->maint_irq) { > - kvm_err("No vgic maintenance irq\n"); > - return -ENXIO; > - } > - > switch (gic_kvm_info->type) { > case GIC_V2: > ret = vgic_v2_probe(gic_kvm_info); > @@ -552,6 +547,11 @@ int kvm_vgic_hyp_init(void) > if (ret) > return ret; > > + if (!kvm_vgic_global_state.maint_irq) { > + kvm_err("No maintenance interrupt available, fingers crossed...\n"); > + return 0; > + } > + > ret = request_percpu_irq(kvm_vgic_global_state.maint_irq, > vgic_maintenance_handler, > "vgic", kvm_get_running_vcpus()); > -- > 2.29.2 > _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65A6FC433B4 for ; Mon, 10 May 2021 16:21:16 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1917161165 for ; Mon, 10 May 2021 16:21:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1917161165 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=65qvGDGNI2DVYNfAtCKgBmbKWs43xDmVTKjgsot2ql8=; b=o5gv2N0/G++4WaIBc1Mpjn8TL vBQDQgHtxpfTFb93il9YnfX+UHfj9K17tvdyTxc5rgewC7H7XR937jv8o7XHSigEBNTlvfF5dIKOw ZIytC6+U7s7k94ElrVhaZQ65wtih7hfJNetUIdb7CUQSYkDnuiy3I7cTGyzmaY0lkLESdoAlG/4qY VcCMGf0pZK2UcaAx50z7QsKCf300vlIEmaJABlzo5xoN7iidkbB+nfbYpYaV83/i0ThVimuHps0Ak qE2g0kK8Yhb91LABjC6DkxQQmaLfHjub5dYcWcJ5RPcNShFAjpYug0blr1lI5qpsCS/hoXXfWm4ar hG2yw0NMQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg8cq-00Ew2C-4C; Mon, 10 May 2021 16:19:20 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg8cn-00Ew1p-8i for linux-arm-kernel@desiato.infradead.org; Mon, 10 May 2021 16:19:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=7c+f38AUP8BmU7/htFI1X6UjKr2VXfhnzMLJguXJaL4=; b=O16FXg9om65CjndTk1Eu8Iq3kz QFR27V0rUQ7RSGEz/yXCubdFuJh0atva+HwJbdrgS3b9zAa66Vs0VD9IoMI8/EU4ufXFFeEqJ7iHY bHcJAhs3IeSv0qJ7sX8YRsI431PvxObEzx0De9UVpieCRF8d7LUoOHlcoZOTTBEHCTzhqG7kKIQXo ldaeQm9Ke2/RwrgaoaDMLEWYKVLxUPrC5r44wwSUKCf4KV9s5/RTmfGI94TtAV/1L0qx2gab2An6U AOXaeYxXS/nKuk5MdwFpry8o7B7gIuS8g37G4P0Pge/lpx536HrHfKwxRGGsrxhOugvRN04PAYQU4 +L1+wSMg==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg8ck-008ufk-Cm for linux-arm-kernel@lists.infradead.org; Mon, 10 May 2021 16:19:16 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C6F31168F; Mon, 10 May 2021 09:19:11 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.4.9]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 063FE3F73B; Mon, 10 May 2021 09:19:09 -0700 (PDT) Date: Mon, 10 May 2021 17:19:07 +0100 From: Mark Rutland To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, James Morse , Suzuki K Poulose , Alexandru Elisei , Eric Auger , Hector Martin , kernel-team@android.com Subject: Re: [PATCH v3 3/9] KVM: arm64: vgic: Be tolerant to the lack of maintenance interrupt Message-ID: <20210510161907.GD92897@C02TD0UTHF1T.local> References: <20210510134824.1910399-1-maz@kernel.org> <20210510134824.1910399-4-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210510134824.1910399-4-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_091914_501577_EA38026D X-CRM114-Status: GOOD ( 27.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, May 10, 2021 at 02:48:18PM +0100, Marc Zyngier wrote: > As it turns out, not all the interrupt controllers are able to > expose a vGIC maintenance interrupt as a distrete signal. > And to be fair, it doesn't really matter as all we require is > for *something* to kick us out of guest mode out way or another. > > On systems that do not expose a maintenance interrupt as such, > there are two outcomes: > > - either the virtual CPUIF does generate an interrupt, and > by the time we are back to the host the interrupt will have long > been disabled (as we set ICH_HCR_EL2.EN to 0 on exit). In this case, > interrupt latency is as good as it gets. > > - or some other event (physical timer) will take us out of the guest > anyway, and the only drawback is a bad interrupt latency. IIRC we won't have a a guaranteed schedular tick for NO_HZ_FULL, so in that case we'll either need to set a period software maintenance interrupt, or reject this combination at runtime (either when trying to isolate the dynticks CPUs, or when trying to create a VM). Otherwise, it's very likely that something will take us out of the guest from time to time, but we won't have a strict guarantee (e.g. if all guest memory is pinned). Thanks, Mark. > > So let's be tolerant to the lack of maintenance interrupt, and just let > the user know that their mileage may vary... > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/vgic/vgic-init.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c > index 2fdb65529594..9fd23f32aa54 100644 > --- a/arch/arm64/kvm/vgic/vgic-init.c > +++ b/arch/arm64/kvm/vgic/vgic-init.c > @@ -524,11 +524,6 @@ int kvm_vgic_hyp_init(void) > if (!gic_kvm_info) > return -ENODEV; > > - if (!gic_kvm_info->maint_irq) { > - kvm_err("No vgic maintenance irq\n"); > - return -ENXIO; > - } > - > switch (gic_kvm_info->type) { > case GIC_V2: > ret = vgic_v2_probe(gic_kvm_info); > @@ -552,6 +547,11 @@ int kvm_vgic_hyp_init(void) > if (ret) > return ret; > > + if (!kvm_vgic_global_state.maint_irq) { > + kvm_err("No maintenance interrupt available, fingers crossed...\n"); > + return 0; > + } > + > ret = request_percpu_irq(kvm_vgic_global_state.maint_irq, > vgic_maintenance_handler, > "vgic", kvm_get_running_vcpus()); > -- > 2.29.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel