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=-9.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,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 5C4D9C2D0A8 for ; Mon, 28 Sep 2020 17:58:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 E7B25208D5 for ; Mon, 28 Sep 2020 17:58:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="s+WU4oNe"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="UgVhqWZr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7B25208D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=Ug2AMJocvoE4Zz/ABnaT9mMgks8aBVrCpobWfpzxUTk=; b=s+WU4oNe0WeJaf7cG9oC0xEr2 Iso0y/vqxtdD8a0JAp0BoQC9HylawG68dO4QcClSLMK8Z5cvXAIBobDhpK/jRcm0aaPDqPzxQc0G+ fEUzBvPPMUM0J1ZOS0Nsv3kxv2BlFMrLU3Q9IIFogrdORtT8QQ5+gZ3Gq7hu3321oMu9N46XB/VLX TjYN/a4V10W8lMP/zt0DOo1eCUiYOJgQ+FHpwl6rj25WZyQjE/r5SGikFv4dkKWB/yABPo1fZCU1F RCUKaVKZLVOMXDtaYPabzPqmw5MmO9wLqdcXqRY3fDOUjNqZ0QNg53VjFtQQEJpsO9AyPVoHjvmc7 6Ow6XFm4A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMxP5-0002VF-6p; Mon, 28 Sep 2020 17:57:35 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMxP3-0002UY-2t for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 17:57:33 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5277121548; Mon, 28 Sep 2020 17:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601315851; bh=FiszVX2X8aJ3JQctQxAoRVYSBkNKuAV65IqHDIVEDrc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UgVhqWZrdi8d79p/SWmzNIKWAx9QY2xxFutpMs2SAKlkY/0GIzKc+JxKnxdBuFB6x 9OT11LaaBlPGY87mYS0o64wfRW1lATLgsh5WOGTW9SBu2UE75JH+0WdgGGqPWROjxA cYdRwSOinofw/TDgdBAoCMVzsDC5BTKWRj/BAdJI= Date: Mon, 28 Sep 2020 18:57:25 +0100 From: Will Deacon To: Alexandru Elisei Subject: Re: [PATCH v7 5/7] KVM: arm64: pmu: Make overflow handler NMI safe Message-ID: <20200928175725.GB11792@willie-the-truck> References: <20200924110706.254996-1-alexandru.elisei@arm.com> <20200924110706.254996-6-alexandru.elisei@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200924110706.254996-6-alexandru.elisei@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200928_135733_205160_35892741 X-CRM114-Status: GOOD ( 18.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, sumit.garg@linaro.org, kvm@vger.kernel.org, Julien Thierry , Marc Zyngier , maz@kernel.org, Suzuki K Pouloze , Will Deacon , linux-kernel@vger.kernel.org, swboyd@chromium.org, James Morse , Julien Thierry , catalin.marinas@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org 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 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 ^^ But the patch itself looks good, so I'm going to queue this lot anyway! Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel