From patchwork Wed Oct 7 13:30:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 11820615 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EBFD6CA for ; Wed, 7 Oct 2020 13:30:43 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 5855F21548 for ; Wed, 7 Oct 2020 13:30:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="TEdU2k07" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5855F21548 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.3508.10054 (Exim 4.92) (envelope-from ) id 1kQ9WL-0007qG-Kn; Wed, 07 Oct 2020 13:30:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 3508.10054; Wed, 07 Oct 2020 13:30:17 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kQ9WL-0007q9-Hm; Wed, 07 Oct 2020 13:30:17 +0000 Received: by outflank-mailman (input) for mailman id 3508; Wed, 07 Oct 2020 13:30:16 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kQ9WJ-0007q4-VW for xen-devel@lists.xenproject.org; Wed, 07 Oct 2020 13:30:15 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5771a15b-b98b-4cad-8cce-ad1e87e22a25; Wed, 07 Oct 2020 13:30:15 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 757FCB234; Wed, 7 Oct 2020 13:30:14 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kQ9WJ-0007q4-VW for xen-devel@lists.xenproject.org; Wed, 07 Oct 2020 13:30:15 +0000 X-Inumbo-ID: 5771a15b-b98b-4cad-8cce-ad1e87e22a25 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5771a15b-b98b-4cad-8cce-ad1e87e22a25; Wed, 07 Oct 2020 13:30:15 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1602077414; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A/ul8OKsqutALOib25CsZA6bXQqNHW0GneGeZqHG7q8=; b=TEdU2k071jf8kt1UTSAibopkjVoC1AFCBimdUlaguWnZ/OSyCXE/vMqE3ye6u+nlZBzIr3 EJvc4PEbA7d4Sqakuk2YxQXNpdFyYtT3LrlEiIufiegDeKc0eap+JumxzHIcNhnCajiZt9 eDofBqBFBltEK+umlJCJWiuwPpjk3v4= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 757FCB234; Wed, 7 Oct 2020 13:30:14 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [PATCH v2 2/2] xen/oprofile: use set_nmi_continuation() for sending virq to guest Date: Wed, 7 Oct 2020 15:30:11 +0200 Message-Id: <20201007133011.18871-3-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201007133011.18871-1-jgross@suse.com> References: <20201007133011.18871-1-jgross@suse.com> MIME-Version: 1.0 Instead of calling send_guest_vcpu_virq() from NMI context use the NMI continuation framework for that purpose. Signed-off-by: Juergen Gross --- xen/arch/x86/oprofile/nmi_int.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/oprofile/nmi_int.c b/xen/arch/x86/oprofile/nmi_int.c index 0f103d80a6..659e31fe19 100644 --- a/xen/arch/x86/oprofile/nmi_int.c +++ b/xen/arch/x86/oprofile/nmi_int.c @@ -83,6 +83,13 @@ void passive_domain_destroy(struct vcpu *v) model->free_msr(v); } +static void nmi_oprofile_send_virq(void *par) +{ + struct vcpu *v = par; + + send_guest_vcpu_virq(v, VIRQ_XENOPROF); +} + static int nmi_callback(const struct cpu_user_regs *regs, int cpu) { int xen_mode, ovf; @@ -90,7 +97,7 @@ static int nmi_callback(const struct cpu_user_regs *regs, int cpu) ovf = model->check_ctrs(cpu, &cpu_msrs[cpu], regs); xen_mode = ring_0(regs); if ( ovf && is_active(current->domain) && !xen_mode ) - send_guest_vcpu_virq(current, VIRQ_XENOPROF); + set_nmi_continuation(nmi_oprofile_send_virq, current); if ( ovf == 2 ) current->arch.nmi_pending = true;