Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4584335imc; Mon, 25 Feb 2019 07:26:57 -0800 (PST) X-Google-Smtp-Source: AHgI3Iax6QI5cxfVlqOsIuqbMkuHPbzEauBjPCWCpLhLZ9h81tNFrMHGyPzMfGcpjqK++HLeuCh0 X-Received: by 2002:a63:28c1:: with SMTP id o184mr19714126pgo.123.1551108417232; Mon, 25 Feb 2019 07:26:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551108417; cv=none; d=google.com; s=arc-20160816; b=R/vPsHMGqrUz2pn9Y2LvgctFtUwsVf+HOvldqDeHs0fcAU2W3qg5Aenu07zzQMob8W 4LLCBOJWs/ZMHIVKc750iBsyOYjv5ty6q4iSJW3QHV6p6Ae/IQ+do6tTvgqtpaAE8Ced kwUW0s1v61h3opVe/43/p3hTpN5+ytJ3sGoE7xr+NjawTP8Da/F0SLK5N9j9f1U8RuiG 3dco0J9MUnGz7QYEaPnWXUXNJBrXu0R2i3HevNJGcv07dhb1ZZ0jo1wpnguj/Y60v372 +OsgBKqXXKOXcQoelKoACjl3I84GUYZ9CpKblIMbZ/YKrYXI49dfGiZibQ3ouYqwiwOz hZ0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=+WFjNLKilRu+yUetGxULCnYZcWZXxfWw/4W9f1MmBMc=; b=wVkD3h8JKpG9zP2gWzP+YH2bZKDvGXcjRnB0L2s1o6C8Dfzy3Grw/k7xaK+/g3TqHW hgfuvfcWw+7eA2v92+Y+WC3q/Jl11OOiw6XsUeS/Gr6nU4mQItNiyaQLGSWxojarwafA HOJaT6PDwiGmiRv7/ErqPT6Jd2k/3V/e6ScPCyx4GEjvTWECksOyKaRiEWkceZ6gBlMU jLwUXPrXfWFG3KVamInUyLUBQH1FwnKcwNMOgDzhixYGie8dabEb3MLI4dlrMLmWYeEQ 0ZXm9TCDm1/qWFzCAmNh7l14xe55EEFNE4Cjjln3fSLsCOi8qlTXUzZ+RwZwKHcVzyKL UXCg== 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 26si10162396pfr.9.2019.02.25.07.26.41; Mon, 25 Feb 2019 07:26:57 -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 S1727589AbfBYP0Q (ORCPT + 99 others); Mon, 25 Feb 2019 10:26:16 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33926 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727467AbfBYP0Q (ORCPT ); Mon, 25 Feb 2019 10:26:16 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E245A1596; Mon, 25 Feb 2019 07:26:15 -0800 (PST) Received: from [10.1.196.50] (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 653243F703; Mon, 25 Feb 2019 07:26:14 -0800 (PST) Subject: Re: [Xen-devel] xen/evtchn and forced threaded irq To: Oleksandr Andrushchenko , Boris Ostrovsky Cc: Juergen Gross , Stefano Stabellini , Andrew Cooper , "linux-kernel@vger.kernel.org" , Jan Beulich , Dave P Martin , xen-devel References: <5e256d9a-572c-e01e-7706-407f99245b00@arm.com> <20190220000209.GA4091@localhost.localdomain> <21214d47-9c68-e6bf-007a-4047cc2b02f9@oracle.com> <8f7445d7-fa50-f3e9-44f5-cc2aebd020f4@arm.com> <15bc52cb-82d8-4d2c-e5a8-c6ae8de90276@oracle.com> <5df8888a-4a29-fccd-bac2-a9c170244029@arm.com> <13a9616c-2d9a-f90b-3358-f2dcadbbb64d@gmail.com> <1aeda04d-3420-fa50-ad33-a0b3e981f5e4@gmail.com> From: Julien Grall Message-ID: <25316391-38b3-42d4-073f-46614307c240@arm.com> Date: Mon, 25 Feb 2019 15:26:13 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <1aeda04d-3420-fa50-ad33-a0b3e981f5e4@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Oleksandr, On 25/02/2019 14:08, Oleksandr Andrushchenko wrote: > On 2/25/19 3:55 PM, Julien Grall wrote: >> Hi Oleksandr, >> >> On 25/02/2019 13:24, Oleksandr Andrushchenko wrote: >>> On 2/22/19 3:33 PM, Julien Grall wrote: >>>> Hi, >>>> >>>> On 22/02/2019 12:38, Oleksandr Andrushchenko wrote: >>>>> On 2/20/19 10:46 PM, Julien Grall wrote: >>>>>> Discussing with my team, a solution that came up would be to introduce one >>>>>> atomic field per event to record the number of event received. I will >>>>>> explore that solution tomorrow. >>>>> How will this help if events have some payload? >>>> >>>> What payload? The event channel does not carry any payload. It only notify >>>> you that something happen. Then this is up to the user to decide what to you >>>> with it. >>> Sorry, I was probably not precise enough. I mean that an event might have >>> associated payload in the ring buffer, for example [1]. So, counting events >>> may help somehow, but the ring's data may still be lost >> >> From my understanding of event channels are edge interrupts. By definition, >> they can be merged so you can get a signal notification to the guest for >> multiple "events". So if you rely on the event to have an associated payload, >> then you probably have done something wrong in your driver. >> >> I haven't implemented PV drivers myself, but I would expect either side to >> block if there were no space in the ring. >> >> What do you do in the displif driver when the ring is full? >> > It is handled by the originator, the display backend in our case: it doesn't send > events if it sees that the ring will overflow. But I was worried about > such a generic change with counting number of events received and if this > really helps to recover in general case Well, I was originally looking at modifying only the /dev/evtchn driver but it turns out the event flow for Xen irqchip is not entirely correct. A lot of Xen PV drivers will thread the handler and set IRQF_ONESHOT expecting the event to be masked until the event handler has ran. However, the flow we use does not deal with it and actually warn you may receive another event before executing the handler for the first event. I have discussed with Marc Z. (one of the irqchip maintainers) about the issue. He suggested a different interrupt flow that I need to try out. Cheers, -- Julien Grall