Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp286965imp; Thu, 21 Feb 2019 01:15:39 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib5gUWBTs2Mrk0iDez0UeZAx6n0CAd5UPfrwLo4cEUKrQ//Nw9r8UZCNUEGMKH8nSQrYevj X-Received: by 2002:a17:902:d83:: with SMTP id 3mr40725511plv.43.1550740539132; Thu, 21 Feb 2019 01:15:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550740539; cv=none; d=google.com; s=arc-20160816; b=pgmo7Ww4wfIo5nXPVNG3pc3pMzg6pn2qb6HE5MHOIimWCLPmJFoIEQ4gUniHZUxXta GGIeYD/I/DI5YdLhS6LKAwi8F7HkaAM5AJVs9BDG4dVn7DIplxhmTYllmi6Y6FaCBRzy f5NmEGsMkUGNVZTIqKqexlp/1WkQ7u00TrXHb/321fAMTBMHo9tXRTdk5WTyvXFdpXYP fplaWUlEjhxtxDT/3PloxkmONnnxLwhvUlWnltAza8bRLLkMECTYfS5iW1T1r3xNjOPN mwLuP9jvoQDxBb9Wba0K5RDYhAHmDaOm1Dm41cqV5mLI5xXOGcV/q+5PU9qR8uGCsYES xk4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ymLnOGqIIjdO1FjamuZAjN67xy4sBWh0kFo3LOMTt2c=; b=skwmBs3u+ovX9S0MOBJuXsmcpgCp+xNlYuuRVExcexRSVEE2AVF+62rLTgbgokO7Xp 8gqNkllcK20xGCFDqWK2TcdbcGw+7D6t1GsrGaZ69M0IYWdllIPtu5wEeeW1no7M4W/K DO+ju4Y36T8ymksw3ONk1BFvNr8/6OWzsx6c1Ql4hyff5w1rhCIS2S1U269+ZzrKsLI1 /iU5vqtcXlLJ0G7PjiS2WNOIEylh4jdagmyp76po0fk1MPcYEc81NBMfIb5prv8is7fL ALnNINigEEUtRcJVXg1dexWyyiBh6I4qca0oxcGGKti7C1hTOcaXSd/yqPFEP3K0Sqn2 bCAw== 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 u27si164849pgk.555.2019.02.21.01.15.23; Thu, 21 Feb 2019 01:15:39 -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 S1727379AbfBUJPB (ORCPT + 99 others); Thu, 21 Feb 2019 04:15:01 -0500 Received: from smtp.eu.citrix.com ([185.25.65.24]:7241 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725385AbfBUJPB (ORCPT ); Thu, 21 Feb 2019 04:15:01 -0500 X-IronPort-AV: E=Sophos;i="5.58,394,1544486400"; d="scan'208";a="86249110" Date: Thu, 21 Feb 2019 10:14:31 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Julien Grall CC: Andrew Cooper , Boris Ostrovsky , Dave P Martin , Jan Beulich , Juergen Gross , Julien Grall , Stefano Stabellini , "linux-kernel@vger.kernel.org" , xen-devel Subject: Re: [Xen-devel] xen/evtchn and forced threaded irq Message-ID: <20190221091431.vqi53op37mvhi25z@Air-de-Roger> References: <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> <1574a7fe-a5ac-4bc2-d3f0-967d8d01e5f1@oracle.com> <1100e6b1-6fa8-06f0-8ecc-b0699a2ce5f4@arm.com> <20190221080752.zy2qlzb4vi7tbu3p@Air-de-Roger> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 21, 2019 at 08:38:39AM +0000, Julien Grall wrote: > Hi Roger, > > On Thu, 21 Feb 2019, 08:08 Roger Pau Monn?, wrote: > > > FWIW, you can also mask the interrupt while waiting for the thread to > > execute the interrupt handler. Ie: > > > > Thank you for providing steps, however where would the masking be done? By > the irqchip or a custom solution? I'm not familiar with the irqchip infrastructure in Linux, what I proposed below is what FreeBSD does when running interrupt handlers in deferred threads IIRC. If irqchip has a specific handler to dispatch to a thread, then that's the place where the masking should happen. Likely, the unmasking should be done by the irq handling infrastructure after the thread executing the interrupt handler has finished. Isn't there a similar way to handle interrupts in threads for Linux? > > > 1. Interrupt injected > > 2. Execute guest event channel callback > > 3. Scan for pending interrupts > > 4. Mask interrupt > > 5. Clear pending field > > 6. Queue threaded handler > > 7. Go to 3 until all interrupts are drained > > [...] > > 8. Execute interrupt handler in thread > > 9. Unmask interrupt > > > > That should prevent you from stacking interrupts? > > > > Roger. > >