From patchwork Fri Oct 16 08:53:49 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: 11841055 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 712561752 for ; Fri, 16 Oct 2020 08:55:03 +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 30F4D20663 for ; Fri, 16 Oct 2020 08:55:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="JBkDJimA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 30F4D20663 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.7829.20611 (Exim 4.92) (envelope-from ) id 1kTLUq-0002D8-2I; Fri, 16 Oct 2020 08:53:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 7829.20611; Fri, 16 Oct 2020 08:53:56 +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 1kTLUp-0002D1-VC; Fri, 16 Oct 2020 08:53:55 +0000 Received: by outflank-mailman (input) for mailman id 7829; Fri, 16 Oct 2020 08:53:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kTLUo-0002Cr-Ah for xen-devel@lists.xenproject.org; Fri, 16 Oct 2020 08:53:54 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4e64d87c-f3c5-472e-95bc-a569bfb942e0; Fri, 16 Oct 2020 08:53:53 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B9C6BADFF; Fri, 16 Oct 2020 08:53:52 +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 1kTLUo-0002Cr-Ah for xen-devel@lists.xenproject.org; Fri, 16 Oct 2020 08:53:54 +0000 X-Inumbo-ID: 4e64d87c-f3c5-472e-95bc-a569bfb942e0 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4e64d87c-f3c5-472e-95bc-a569bfb942e0; Fri, 16 Oct 2020 08:53:53 +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=1602838432; 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=rSOB8WNkMaU2hnrfpEjv6May2yW7ubKae50ylsNLlyI=; b=JBkDJimAwG7YFhn7Tfy6L5waIaU2GINdyg3NuIpE1IGeZdYSB/vspy5e8BIWspmAs5R9KK zSmdkBkjXR5AKSqzZaSbrb4d20Xubf/XAsphoA/kBoflGHf2bdVSmHWlgJZBKJ7u2jhkII pMgSMsgPFhNapbRGP7k4epMyk3u/hmg= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B9C6BADFF; Fri, 16 Oct 2020 08:53:52 +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 v3 2/3] xen/oprofile: use set_nmi_continuation() for sending virq to guest Date: Fri, 16 Oct 2020 10:53:49 +0200 Message-Id: <20201016085350.10233-3-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201016085350.10233-1-jgross@suse.com> References: <20201016085350.10233-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. This avoids taking locks in NMI mode. 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..825f0aeef0 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 *arg) +{ + struct vcpu *v = arg; + + 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;