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=-8.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 F2CA4C4727E for ; Wed, 30 Sep 2020 12:36:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B89242071E for ; Wed, 30 Sep 2020 12:36:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729905AbgI3Mgu (ORCPT ); Wed, 30 Sep 2020 08:36:50 -0400 Received: from foss.arm.com ([217.140.110.172]:35376 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728235AbgI3Mgu (ORCPT ); Wed, 30 Sep 2020 08:36:50 -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 5FFC530E; Wed, 30 Sep 2020 05:36:49 -0700 (PDT) Received: from [192.168.0.110] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6EF553F6CF; Wed, 30 Sep 2020 05:36:47 -0700 (PDT) Subject: Re: [PATCH v7 5/7] KVM: arm64: pmu: Make overflow handler NMI safe To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com, sumit.garg@linaro.org, maz@kernel.org, swboyd@chromium.org, catalin.marinas@arm.com, Julien Thierry , Julien Thierry , Marc Zyngier , Will Deacon , James Morse , Suzuki K Pouloze , kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu References: <20200924110706.254996-1-alexandru.elisei@arm.com> <20200924110706.254996-6-alexandru.elisei@arm.com> <20200928175725.GB11792@willie-the-truck> From: Alexandru Elisei Message-ID: <6b1ecdef-3a42-c428-2309-753b1470e3de@arm.com> Date: Wed, 30 Sep 2020 13:37:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200928175725.GB11792@willie-the-truck> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Will, On 9/28/20 6:57 PM, Will Deacon wrote: > On Thu, Sep 24, 2020 at 12:07:04PM +0100, Alexandru Elisei wrote: >> From: Julien Thierry >> >> kvm_vcpu_kick() is not NMI safe. When the overflow handler is called from >> NMI context, defer waking the vcpu to an irq_work queue. >> >> A vcpu can be freed while it's not running by kvm_destroy_vm(). Prevent >> running the irq_work for a non-existent vcpu by calling irq_work_sync() on >> the PMU destroy path. >> >> Cc: Julien Thierry >> Cc: Marc Zyngier >> Cc: Will Deacon >> Cc: Mark Rutland >> Cc: Catalin Marinas >> Cc: James Morse >> Cc: Suzuki K Pouloze >> Cc: kvm@vger.kernel.org >> Cc: kvmarm@lists.cs.columbia.edu >> Signed-off-by: Julien Thierry >> Tested-by: Sumit Garg (Developerbox) >> [Alexandru E.: Added irq_work_sync()] >> Signed-off-by: Alexandru Elisei >> --- >> I suggested in v6 that I will add an irq_work_sync() to >> kvm_pmu_vcpu_reset(). It turns out it's not necessary: a vcpu reset is done >> by the vcpu being reset with interrupts enabled, which means all the work >> has had a chance to run before the reset takes place. > I don't understand this ^^ Marc had the same comment, I replied in his email. I thought about it and you're right, it doesn't make much sense. > > But the patch itself looks good, so I'm going to queue this lot anyway! Thank you for picking up the series! Thanks, Alex