Message ID | 99b1edfd3147c6b5d22a5139dab5861e767dc34a.1697439990.git.viresh.kumar@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3285510vqb; Mon, 16 Oct 2023 00:12:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdXsxK9/zk1wRm8llOgPQMxo3XP0Xn9xlNcfTyZClQQ3ANNBxYXvcPokCGsGTq11XzpX2u X-Received: by 2002:a05:6a20:3d04:b0:13d:d5bd:758f with SMTP id y4-20020a056a203d0400b0013dd5bd758fmr41277938pzi.6.1697440337342; Mon, 16 Oct 2023 00:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697440337; cv=none; d=google.com; s=arc-20160816; b=fUokGAu3HaDKiaLrrtgEZ3DU8u9myc2u5lLxB2GSwctDCjvMl/XG6K1iex2OxvevgC G7vLBO3kRZvy0Ncj4UrRZt+PjAr1v4U+42uvvGfjNAX39feQquXhFcBf3tWRXW7s9YVa +vewlIbilZWN6GUYS4slMwYmFn518umNgpU7mC1plXxxWyydg2WS57EbkP6yl2H5Muaz yXt6oPBFiuJKdtD9nkoGIBpMfzrfJIx0vHgTqtkEzS/Eh6lTCYnG+qEgfMVrs5BTybKc ryIzs40cgByW/jmBnh/5dy7de8R38+sK/rWAc++MIxkUrSdEtIvHqFCNbRtv24VfOTGd +Ctg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VA2GT8eqbiQpihVq6IatV7jxO70qnqwP/ImeaPQmFQY=; fh=d5nVmjWixkEOOHMfZ6PT2MW7RaSVhlMsxi5CFTJb04c=; b=w7acCULN2Vb38Z0HJXcxNi+rXs2IlUUunO4itOH6f03WOyh74kyhdx0YI8WEQeykMO f3L+ofyu7Hg9/NeWy0L+gd3tktt5iiF+9XvLgHJhTqzILdOqNEvYqJJ6g63K6SJn2wAb bNZlmMnRXb1Q7BXSO3na82Dwt1Utszau11zgRiDARAH9ARp/+fuZtCQaLBTPSFqf4KmK 9BY8h+5deC7yN4yUgsWy7zHcRIm/ULvKEynIXEBNQQTSEmstkLOpwcvWLdYSfxljTaTH vjb2OCbn967bUVHpCWralUdu5ePU02TN1f81HlbA0TM+93v/QfXAuvsufdHmQ2vrPGnQ Z3ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c0cmlIbM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id n6-20020a17090a9f0600b00278f79e4fabsi5364137pjp.93.2023.10.16.00.12.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 00:12:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c0cmlIbM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 80D6580579A3; Mon, 16 Oct 2023 00:12:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231855AbjJPHL6 (ORCPT <rfc822;hjfbswb@gmail.com> + 18 others); Mon, 16 Oct 2023 03:11:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231474AbjJPHLz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 16 Oct 2023 03:11:55 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B99FED for <linux-kernel@vger.kernel.org>; Mon, 16 Oct 2023 00:11:51 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6b5cac99cfdso1668162b3a.2 for <linux-kernel@vger.kernel.org>; Mon, 16 Oct 2023 00:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697440311; x=1698045111; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VA2GT8eqbiQpihVq6IatV7jxO70qnqwP/ImeaPQmFQY=; b=c0cmlIbMULuVKRYc3sCOeVmPgo6C7gQDhRNtrKDRqAZWUQ7VbqG87GtMFKJY5i0Vt8 6dC0dZGkYmSUhdjj6pFswkJXL//WqtYSA1jVINPB9mbmLG2OhJCdgevaMGX9UBiqHJ1Q e0IMn8hKO7XxANbzCr48H9ZpF85nzgtR1iXsJDtrAw9x5fBXSzC04w1dGf4i0BHgRM0m ketFLUPdNqdrgx6M+FEHdphDegFZQfc0iZoH/ZcZsfp3Aho+JKNe0Kv6NfebmfIoN6Qu yoCpVuNRRrsol9DdRSJcD8fOfly4Auv9hhfnVyhbZsJ22fpimrY7yVKiRWcg+1gigM38 fNNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697440311; x=1698045111; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VA2GT8eqbiQpihVq6IatV7jxO70qnqwP/ImeaPQmFQY=; b=WHZdcwOLfpn+bSpQ7jexnOe3vOMoR4O6PTt14Xd5D/XHEUx0IsUsRZCKX5GKywdQ8u 1qNFWpk7YUIvbi4gH7xVXOHH6LTmyx3Lv1nvZIxPqmBIZIKRdHrCmGc/nKEp7rUljPxB HYuVVXVp5D6DWi1LgM0wBYzipaEcp8XWMpor887ey7LtwyZxXi2JpLoAdRqIqyIanis3 Cwdeq9522JIsUi54/UvxqFWQVbpnPuwoEi367lRWrbfRdcYe/qNhE/Xfvuy0UxzSK6Rn AMLDNZuNw34VfacIm682zIPllakhqq1m8pnle5RyiXy+0hPOY92S6vIl6mzeldPJFRl+ ugjQ== X-Gm-Message-State: AOJu0YzWkWbxPG+V+Axt6A3r4ih+Vj4Kt1RmcSOqdyJttx0Q7OyHLlrz 1Q+7+a59GJjuwG8U+IDtIIO9qQ== X-Received: by 2002:a05:6a00:23ce:b0:68e:3f0b:5e6f with SMTP id g14-20020a056a0023ce00b0068e3f0b5e6fmr35005262pfc.24.1697440311003; Mon, 16 Oct 2023 00:11:51 -0700 (PDT) Received: from localhost ([122.172.80.14]) by smtp.gmail.com with ESMTPSA id k9-20020aa79729000000b006bd6a0a4678sm2187567pfg.80.2023.10.16.00.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 00:11:50 -0700 (PDT) From: Viresh Kumar <viresh.kumar@linaro.org> To: Juergen Gross <jgross@suse.com>, Stefano Stabellini <sstabellini@kernel.org>, Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> Cc: Viresh Kumar <viresh.kumar@linaro.org>, Vincent Guittot <vincent.guittot@linaro.org>, =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>, stratos-dev@op-lists.linaro.org, Erik Schilling <erik.schilling@linaro.org>, Manos Pitsidianakis <manos.pitsidianakis@linaro.org>, Mathieu Poirier <mathieu.poirier@linaro.org>, Arnd Bergmann <arnd@kernel.org>, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 3/4] xen: evtchn: Allow shared registration of IRQ handers Date: Mon, 16 Oct 2023 12:41:26 +0530 Message-Id: <99b1edfd3147c6b5d22a5139dab5861e767dc34a.1697439990.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: <cover.1697439990.git.viresh.kumar@linaro.org> References: <cover.1697439990.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 16 Oct 2023 00:12:14 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779895199198209274 X-GMAIL-MSGID: 1779895199198209274 |
Series |
xen: privcmd: Add ioeventfd and fix irqfd support
|
|
Commit Message
Viresh Kumar
Oct. 16, 2023, 7:11 a.m. UTC
Currently the handling of events is supported either in the kernel or
userspace, but not both.
In order to support fast delivery of interrupts from the guest to the
backend, we need to handle the Queue notify part of Virtio protocol in
kernel and the rest in userspace.
Update the interrupt handler registration flag to IRQF_SHARED for event
channels, which would allow multiple entities to bind their interrupt
handler for the same event channel port.
Also increment the reference count of irq_info when multiple entities
try to bind event channel to irqchip, so the unbinding happens only
after all the users are gone.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/xen/events/events_base.c | 3 ++-
drivers/xen/evtchn.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
Comments
On 16.10.23 09:11, Viresh Kumar wrote: > Currently the handling of events is supported either in the kernel or > userspace, but not both. > > In order to support fast delivery of interrupts from the guest to the > backend, we need to handle the Queue notify part of Virtio protocol in > kernel and the rest in userspace. > > Update the interrupt handler registration flag to IRQF_SHARED for event > channels, which would allow multiple entities to bind their interrupt > handler for the same event channel port. > > Also increment the reference count of irq_info when multiple entities > try to bind event channel to irqchip, so the unbinding happens only > after all the users are gone. > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Juergen Gross <jgross@suse.com> Juergen
diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c index c7715f8bd452..d72fb26cc051 100644 --- a/drivers/xen/events/events_base.c +++ b/drivers/xen/events/events_base.c @@ -1238,7 +1238,8 @@ static int bind_evtchn_to_irq_chip(evtchn_port_t evtchn, struct irq_chip *chip, bind_evtchn_to_cpu(evtchn, 0, false); } else { struct irq_info *info = info_for_irq(irq); - WARN_ON(info == NULL || info->type != IRQT_EVTCHN); + if (!WARN_ON(!info || info->type != IRQT_EVTCHN)) + info->refcnt++; } out: diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index c99415a70051..43f77915feb5 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c @@ -397,7 +397,7 @@ static int evtchn_bind_to_user(struct per_user_data *u, evtchn_port_t port) if (rc < 0) goto err; - rc = bind_evtchn_to_irqhandler_lateeoi(port, evtchn_interrupt, 0, + rc = bind_evtchn_to_irqhandler_lateeoi(port, evtchn_interrupt, IRQF_SHARED, u->name, evtchn); if (rc < 0) goto err;