Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6532951ybc; Thu, 28 Nov 2019 00:47:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwkXfmgL+1TaT5IQnazfTN4MqHNWtgHhezbQcplRmcbk4gzzFaSfrYmxwVf30LamGE5pBAB X-Received: by 2002:a17:907:1102:: with SMTP id qu2mr53177919ejb.300.1574930868131; Thu, 28 Nov 2019 00:47:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574930868; cv=none; d=google.com; s=arc-20160816; b=Y7QCzFm7rCKWWlWPJSgn0Jok+LkN8n/PNWi4Qbdzp2j4IWgphjH96fGj1aTEPJg5vv HbKbH98PMFogZBZWb7+pqEEHtUvv5a8YmCbavgfUBU0vr5OzikzKRH5oAWpTf7kY3fwI o3yDZQnW7GlqjOOzgqZKOyHVO3pz7jBKs1BglOFlefjkgL9g2XhvA1dGWWTYQcmvtWC8 fOvTEV5WxIp0//js8BHSSyu2i3xY84RACfd0DcL38ChvZjWmiqWfxXMvThGNPz4foop1 sNxo1a4XQBjyzJqijrJMJmOfgaao9coyqHTQWAK5HRJgxDfRmt6IRFLq1kHFOxHeVJm1 WWxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=KUJd7SatqB5GUhyqVrcfTl9fMzzealojwG7Rd3yWNVE=; b=Uu7r7GJljTGnfWiaR8ltJsZyeO+vCWFUvoiPByOSMfflPWneRUaRwd1rySqBeOhe/Z 8Jdwxk3koTpoPofzpBNEjdWIiG/fwlDl/0NtrQT8hhIMCBL4lHCrfLCcQdDAAGS1w9T9 IKdusTLp3vz/MoOrl2ohGpQOlqZ7/18ByllFUS72ztZ+SaURWi5kMnqiMMpI4/dG1209 Et6qWNt31d1GpR5g/fr71lWMcLFg22WMukYd12/bVz/LYwxZ+ALEIdkgz9V3HO4lTmuJ gQQnl0RoJydfUsq5lyNLfY6LWhKSJB8uPFihbZzays4Dl4lrpQZZNUIltwp9w5ztIfNx siZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c70si12669787edf.436.2019.11.28.00.47.24; Thu, 28 Nov 2019 00:47:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727438AbfK1Ipt (ORCPT + 99 others); Thu, 28 Nov 2019 03:45:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:47116 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726301AbfK1Ips (ORCPT ); Thu, 28 Nov 2019 03:45:48 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 32A43B174; Thu, 28 Nov 2019 08:45:47 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , Boris Ostrovsky , Stefano Stabellini Subject: [PATCH v2] xen/events: remove event handling recursion detection Date: Thu, 28 Nov 2019 09:45:45 +0100 Message-Id: <20191128084545.13831-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org __xen_evtchn_do_upcall() contains guards against being called recursively. This mechanism was introduced in the early pvops times (kernel 2.6.26) when there were all the Xen backend drivers missing from the upstream kernel, and some of those out-of-tree drivers were enabling interrupts in their event handlers (which was explicitly allowed in the initial XenoLinux). Nowadays we don't need to support those old drivers any more and the capability to allow recursive calls of __xen_evtchn_do_upcall() can be removed. Signed-off-by: Juergen Gross --- V2: adapt commit message (Jan Beulich) --- drivers/xen/events/events_base.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c index 6c8843968a52..33212c494afd 100644 --- a/drivers/xen/events/events_base.c +++ b/drivers/xen/events/events_base.c @@ -1213,31 +1213,21 @@ void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector) notify_remote_via_irq(irq); } -static DEFINE_PER_CPU(unsigned, xed_nesting_count); - static void __xen_evtchn_do_upcall(void) { struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu); - int cpu = get_cpu(); - unsigned count; + int cpu = smp_processor_id(); do { vcpu_info->evtchn_upcall_pending = 0; - if (__this_cpu_inc_return(xed_nesting_count) - 1) - goto out; - xen_evtchn_handle_events(cpu); BUG_ON(!irqs_disabled()); - count = __this_cpu_read(xed_nesting_count); - __this_cpu_write(xed_nesting_count, 0); - } while (count != 1 || vcpu_info->evtchn_upcall_pending); - -out: + rmb(); /* Hypervisor can set upcall pending. */ - put_cpu(); + } while (vcpu_info->evtchn_upcall_pending); } void xen_evtchn_do_upcall(struct pt_regs *regs) -- 2.16.4