Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1758294lqg; Mon, 4 Mar 2024 02:58:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXibj7LvGbNOkskZYaRsM7bRaZ9y1iLwRvGqX5ZKeCzr7r5kEr2WnbhmID8Jty0Pt4fg2ZF4fftaKNH4mLK5qV9PfAjQJ4y2qIB5SkL6g== X-Google-Smtp-Source: AGHT+IGTejmDe4GjGYF0UrXguKV5q1lNwkZyQxLSB+Ms91LAIo5F3RPTaEA2jZ4yevILqf7ViWZa X-Received: by 2002:a05:622a:188f:b0:42e:c5a4:353d with SMTP id v15-20020a05622a188f00b0042ec5a4353dmr11113999qtc.23.1709549929019; Mon, 04 Mar 2024 02:58:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709549929; cv=pass; d=google.com; s=arc-20160816; b=HVKPU8HA1vkpZU6VOah3fPXp3CUlJ7EYpCQ7EpIGq8SB7hI8OdNHl8AT8tm98mnXoz 2Ar88QQL7kN79znEJG6WxABnql6dZVIohRFZ+qnpSTTEzwnz105LYHMllxvi0SEjLqgG A8yIza+/lMdYemDPAXKUErhlMz2G/9py80d+eMKwX6y4Xi5Spy3oTCrbLvhkuFz3YQjM jMPueIW7ImjOJCKEyXlrVDQXPdp8e+vgufpk5M7/n9YpcVhDPwrlPSeAGTAbpgWnfp0/ fRjSADZ1Jm3nW9//Uzd2Cj7y0bMynwrGh533xSrmC/ys91Q9GcmqJp0EqrPaipVyRnIJ j+2A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=LzF8Zv3PvXVlkIrXqbIlnUe2pkXzxE7AeiA/nV9wZ/E=; fh=ivolCMigU0jpJCZKDs9SN74DiQRSkAbG1hhrLrWNcK8=; b=mJx8Amm501sepiyBi2SZz3Imj4sjO6Ir/Ap3VkQUVnDKPneD8v1OG8z35aIBi0SgUD Sd3UlzS7dCDzs56SnAEBTBbnTdyVl3lqpR5Pivc7WjCrZY0i1EFBig1yaZj1VBeyaoC1 UdkhSjMEGGq4NkSkyU5c2JowsAJMc6XpcAGNX2zM/kf0+DGbY5TE57O56DHK557ZIlpd UCNW53U+Ds9bpBmYwCbjmn/h2sdu+zO00KZJ4uMlQ2sDO3C4KYu8Sb0Po6RNaIDri8Km AVK9R0/4I1JtaCQ31kO/Bduy501tn50SH+vDofyEreoA8hEA6Jw4p+LF7CGsn4DQdF+s IA3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=BqJS6S5r; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=McKmMK7J; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-90467-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90467-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k12-20020ac85fcc000000b0042ef6c745c5si744952qta.185.2024.03.04.02.58.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 02:58:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90467-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=BqJS6S5r; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=McKmMK7J; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-90467-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90467-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BDE711C220FB for ; Mon, 4 Mar 2024 10:58:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A71AB381DF; Mon, 4 Mar 2024 10:58:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="BqJS6S5r"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="McKmMK7J" Received: from wfhigh1-smtp.messagingengine.com (wfhigh1-smtp.messagingengine.com [64.147.123.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 206D9376F7 for ; Mon, 4 Mar 2024 10:58:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.152 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709549924; cv=none; b=HKfGq9BpFB/KKfcqHiD2/x+hmcpff+WqeQhxkSC+EjQ553thvay9LIbG50x8aZAg9rkwu4TojuuwqPacifbYqA8SLXGxAZNyu+B8Pz4KCwW1VUyDStFgUQg2OdNF12nLzAFEiNXOwQQxDdC1O7vY2FGPFlrOetqGKPT4R+bTVfE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709549924; c=relaxed/simple; bh=249yk6eWEjjWoRhjonEKb38hHj3r4c1txX4WOVsv668=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=ro9ud49PCUjdPs26dHpO8MhJKQm0KKmn3Q1RpdR6rmZvwUIdHETHQI/UxU7jmK+4uWTE3t9dx3BhWxBn7EA50kh55ay63a97qwYDpUHuvdOqODaRqsO0Scg9CySmMwNiolGK3jGgY++rI8cNvBKWJUB9gSKvW0JSsYcUzf2azpc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=BqJS6S5r; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=McKmMK7J; arc=none smtp.client-ip=64.147.123.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.west.internal (Postfix) with ESMTP id CABDB1800072; Mon, 4 Mar 2024 05:58:40 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Mon, 04 Mar 2024 05:58:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1709549920; x=1709636320; bh=LzF8Zv3PvX VlkIrXqbIlnUe2pkXzxE7AeiA/nV9wZ/E=; b=BqJS6S5r3T52XC0SuE4vLtOSVe qgAMGz/30FS1ct8VLOYEllUQ8nuL+hGIu8WeD0zAPGslqX4nw3cS842P2o7ColOU ZOiSCyEha51V0ZAUbjBs1wRd+Bv2VaXorgzkOjpJr/dX18TiUEJCWpe0ZxTKNFA0 5ISyqaJds4LHxVvtpyp6SB3YvsfBP4epCaBEFF5VQY3jx4pjgY5xqNtkxWxDVwGv 0RGqk/ve+c88ARhncQZ5exdRoFyXmS6r2BpJBrB4Hm3h3EK6GCYtVyzDqt+wE0ul CTiinKlKO0z05veQFQ43Bui60rkpYkoUDNN3/jY/sNNZdyrq4pjOqX0/FWtw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1709549920; x=1709636320; bh=LzF8Zv3PvXVlkIrXqbIlnUe2pkXz xE7AeiA/nV9wZ/E=; b=McKmMK7J/QSsg6e0l+x9jZDQGYlrrn0CYR1bSZNAcIxN eSnFz3Dpsnl/hVavIdDU5hArlkvIGiQdwk/iSFjrLpT8EAm23IlQ+cqQ1MrfpO/Q JZqqetoFG0wN5vo95pqLBZxnpqBwptK6Jaq+MA4Lr8cqjnD8NUds7XMKaYmlqrQU 9FPVG+SspvflQ5kablMq1CrPLXLNIKBn2/7qC9cOA2W19k+Io8fje7vcl281XG0w 9KA2fDRZPwq4MqfN548Hq23+59FRgLLlGkOv2/RS+luDGvp/YAgZdgAk0O96gdcC 20isq7Yi1JTgq5Udh159sYURbQq0ZaH/bbI7TEmoqw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrheejgddvudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdetrhhn ugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrghtth gvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedtkeet ffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrh hnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 70F7EB6008F; Mon, 4 Mar 2024 05:58:39 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-205-g4dbcac4545-fm-20240301.001-g4dbcac45 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <44216ff8-740b-45ca-9902-b52a04901655@app.fastmail.com> In-Reply-To: References: <20240219195807.517742-1-sakari.ailus@linux.intel.com> <20240219195807.517742-2-sakari.ailus@linux.intel.com> Date: Mon, 04 Mar 2024 11:58:19 +0100 From: "Arnd Bergmann" To: "Sakari Ailus" , "Wentong Wu" Cc: "Hans de Goede" , "Tomas Winkler" , "Greg Kroah-Hartman" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 1/3] mei: vsc: Call wake_up() in the threaded IRQ handler Content-Type: text/plain On Thu, Feb 22, 2024, at 12:46, Sakari Ailus wrote: > Hi Wentong, > > On Thu, Feb 22, 2024 at 03:26:18AM +0000, Wu, Wentong wrote: >> > From: Sakari Ailus >> > >> > The hard IRQ handler vsc_tp_irq() is called with a raw spinlock taken. >> > wake_up() acquires a spinlock, a sleeping lock on PREEMPT_RT. >> >> Does this mean we can't use wake_up() in isr? > > Good question. A lot of callers currently do. If driver has a traditional (non-threaded) handler, it should always work fine: on non-PREEMPT_RT it can take the spinlock and on PREEMPT_RT it automatically turns into a threaded handler that can still call it. > In this case, handle_edge_irq() takes the raw spinlock and acquiring the > wake queue spinlock in wake_up() leads to sleeping IRQs disabled (see > below). > > I don't think there's any harm in moving the wake_up() to the threaded > handler. It causes an extra bit of latency for the non-PREEMPT_RT case because you now always have to go through two task switches. This is probably fine if you don't care about latency. You can probably replace the open-coded completion (wait queue head plus atomic) with a normal 'struct completion' and call complete() in the isr instead. This one seems to only take a raw spinlock already. Arnd