Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp8030309ybc; Fri, 29 Nov 2019 04:41:44 -0800 (PST) X-Google-Smtp-Source: APXvYqzMGfdjDLCBVMJ+m6hUdhGx7T0vXnBu6GMn/QnJpezaTebJSfr+lb4YFa48qzB20tGY4KJG X-Received: by 2002:a5d:6089:: with SMTP id w9mr8089120wrt.228.1575031304624; Fri, 29 Nov 2019 04:41:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575031304; cv=none; d=google.com; s=arc-20160816; b=eOHbZw2+JmEqMGaztiT1lj4MPWQqY0AXzH20MbrHvg22za6g1o+bs+fMTBIdZCln0M yGe8UkAHZSxfHgcUHhDRYTDe83fvvQ20ultl1dQdaSS0vvrA9VrWlX0ECeACfb2RBWlw vrf819UC2TXhocSpRHR+CWznNkebBwE8HG3u4OKQ6YuQXV59pt/r+vOFg2UX2WHJBUUl spFiFs+s5V4l36omIUQppwnLm2LuZTA9aSvTMy2RRp9JJrQ22g/lgOHKSpq1YiTv4SbF /g2ojkczmtKk9TrRkrbox0y6fyDzRooyUKnJoF+haX4YDgr0ifRS2vmlgJQSg47/09h5 iYBw== 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=MelGKRvQlebrFGRGivsCKzw++YN/2mRC4Efwrs4SDQI=; b=x2FsE3d5MfaUFb9JGF5Lz0Z9AXT4oyswfaAC3jUBA+vw0caeLOW2zFpT4+uEwUXUWK +tgwyjehA+5kehr/xZSxJKpzd1hLkbW72GCjw0ydngty+gDws9WxViZ6ffXP0GYzbCAp HEbAv1skUvQ1nYLWHccldDq4xxl8I/d8EmhFbZ1oKfvK3dqO72rhCsq3vVOpazcXfGyF OL4VN9loPWNGnSzzj/KipQIpQWQ9xY1X3il3lhV0aW76UtG8neqilwByMIYQUAK24NYF L0lqNqhOa61TGLX9DHsx4Y1wSZO8mndhLO3gowb1AnlTA3sJTTP6J4YRxCNLd+/Nsv5s Bpyg== 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 n25si6697179wmd.57.2019.11.29.04.41.09; Fri, 29 Nov 2019 04:41:44 -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 S1726763AbfK2Mjp (ORCPT + 99 others); Fri, 29 Nov 2019 07:39:45 -0500 Received: from mx2.suse.de ([195.135.220.15]:45554 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726360AbfK2Mjp (ORCPT ); Fri, 29 Nov 2019 07:39:45 -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 BCA62ACE0; Fri, 29 Nov 2019 12:39:43 +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 v3] xen/events: remove event handling recursion detection Date: Fri, 29 Nov 2019 13:39:41 +0100 Message-Id: <20191129123941.11975-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) V3: rmb() -> virt_rmb() (Boris Ostrovsky) --- 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..499eff7d3f65 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: + virt_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