Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2838305lqz; Wed, 3 Apr 2024 09:56:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUHHxlGo9VfSIj89G1m1g1UVPv/63W0RT4BLDdp8AckMp/vI1/V/Hu4Qd8tJldq70cpBKkJk+DcpQWP3mR/PPouKfSPiPuNGKoG4OiRyQ== X-Google-Smtp-Source: AGHT+IF4HtlCrHCyBBl5nhMgYklM75lzf75ojRTRVwF0ZKJbfuMzNmRHS6Ua+P9lkDffFKk8HoBo X-Received: by 2002:a17:902:ce8c:b0:1e0:c88f:654f with SMTP id f12-20020a170902ce8c00b001e0c88f654fmr4437142plg.33.1712163374815; Wed, 03 Apr 2024 09:56:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712163374; cv=pass; d=google.com; s=arc-20160816; b=t0O8pkOtXe9lfAi0pkfohkS6Rx+jlvRmYWAkhdK+JdHq9zvj9k3UFmoDnHbHUCOPqT bdGDwrYDbv3fu6h+LoQyNaaVyUxBb1pvn5wEtOLIdHIbLsMSATt8yOz8kYiSohHAJqk/ zOH2PKVw70LGOD+vhpwOtYF15po/Ulha10L1iaKW9NM0SX9+ZOzsC4hE3lgdM392F0eZ LZfG+tVKa0sNAaBfcZFcQxYCPngB6EzsRoSdUscyXW77SwdJ901UMQWypIuJDEb4ugPl P55aqW2KJB09C2Nfwlx4QlQw2XyjQJWYHinGi/vhQDU8v54ZS1+ZmtB/8TqGt8Tmjg2s UBGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=KCsFQpOryp/rvssUwJ8jG3/+Gvws5tiCogyEPIyhqN4=; fh=O/0KikVB3+agvRvdP1TT1+bL38adHKtNFz4Vgw6gmgs=; b=PSwW06hcGv/CbgPLWItIe1mcG1Esa5PRp86mK4udXBY5Tcam4kwC9uZaTIo4om+f0v 9APaziTRIilJNitJbJd1uwKPIo1XdWD10uHQOhvkrAFHw0zkiMt2vLt6TTW41J8HZ+xm +H9w3I3DbThyP6xLDciOD+IXYNLBUc9o/r1ElRwlxQK3gKi96vY0iXWCZA6l8wSTlCDZ RekSYuytcvzATlwvpP1gaGB3y4FFfpg92bqmD6TlkSB9dMvvJCosU+EEU6izVFHTLHKv 2Y8vwOz9qHNOH/rL1s3ORbGOqcd6FcsaX5isBRuJVLLhSkdm+CwdH9soelFcsMC4J2i1 hMsA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=UxeZRb8Z; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-130225-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130225-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b18-20020a170902d51200b001dcb306f032si13943037plg.118.2024.04.03.09.56.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:56:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130225-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=UxeZRb8Z; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-130225-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130225-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5E92528B9C1 for ; Wed, 3 Apr 2024 16:56:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B9BF2152DE8; Wed, 3 Apr 2024 16:55:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="UxeZRb8Z" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A480C15219D; Wed, 3 Apr 2024 16:55:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712163352; cv=none; b=QTHvu0cyJigLK9UqjvRce6pPypQxWEnQYvt2SncQQoBn3sGIYGPjRYbN3YlE7y5m3bpfdBJxYRJU10377O+VSKw/fiqahDVccg2qsTz9RPlbB90pKvtrEL5tGZO64XZ94IO3PBg7k9ghtzk9iUJIXbskKFf7THyCIN9Zy/iUyIw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712163352; c=relaxed/simple; bh=Mt/jdNcizSAPyHYbQE+rZ2V13UBG7PwrsIwZ5NwliAg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=AHPyUEWxJE07tEXgqsfg4wNwKCfbuMLimM0KX5D4FcHTPzwfyRN6kSiOmNwTHdntnX788m/XdQvO5pj8V+B2wpZSmcBI8Wt4A5YrY0evVdBPHONAtn8jHsIyCdVW1I5I6SxxK3GyGtHDQ++vBkUIuiRaj093docKr81R3a/DeR0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=UxeZRb8Z; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: from apais-vm1.0synte4vioeebbvidf5q0vz2ua.xx.internal.cloudapp.net (unknown [52.183.86.224]) by linux.microsoft.com (Postfix) with ESMTPSA id 40FE920E8CB7; Wed, 3 Apr 2024 09:55:50 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 40FE920E8CB7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1712163350; bh=KCsFQpOryp/rvssUwJ8jG3/+Gvws5tiCogyEPIyhqN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UxeZRb8Z0CNIAWXhIXLDGQc08F3fQcDabUoRuJjPN4WWRN0OHmr0eY4YucUwESYTY GbnQN65udcAkQimhIDXmG/MKDCJaEvTE2vO89mS4rLYW0JJmhEPaX3CC4iV2HBfx6r tOmXH6EJDLjWi470CE5USJnr5rU/VfRnH3v9HSS0= From: Allen Pais To: linux-kernel@vger.kernel.org Cc: tj@kernel.org, keescook@chromium.org, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, linux-hyperv@vger.kernel.org Subject: [PATCH v2 2/2] PCI: hv: Convert from tasklet to BH workqueue Date: Wed, 3 Apr 2024 16:55:42 +0000 Message-Id: <20240403165542.21738-2-apais@linux.microsoft.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240403165542.21738-1-apais@linux.microsoft.com> References: <20240403165542.21738-1-apais@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The only generic interface to execute asynchronously in the BH context is tasklet; however, it's marked deprecated and has some design flaws. To replace tasklets, BH workqueue support was recently added. A BH workqueue behaves similarly to regular workqueues except that the queued work items are executed in the BH context. This patch converts drivers/pci/pci-hyperv.c from tasklet to BH workqueue. Based on the work done by Tejun Heo Branch:https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10 Signed-off-by: Allen Pais --- drivers/pci/controller/pci-hyperv.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 5992280e8110..2823fd50a69c 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -50,6 +50,7 @@ #include #include #include +#include #include /* @@ -2000,7 +2001,7 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) udelay(100); } - tasklet_enable(&channel->callback_event); + enable_and_queue_work(system_bh_wq, &channel->callback_event); if (comp.comp_pkt.completion_status < 0) { dev_err(&hbus->hdev->device, @@ -2026,7 +2027,7 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) return; enable_tasklet: - tasklet_enable(&channel->callback_event); + enable_and_queue_work(system_bh_wq, &channel->callback_event); /* * The completion packet on the stack becomes invalid after 'return'; * remove the ID from the VMbus requestor if the identifier is still @@ -3890,9 +3891,9 @@ static void hv_pci_remove(struct hv_device *hdev) hbus = hv_get_drvdata(hdev); if (hbus->state == hv_pcibus_installed) { - tasklet_disable(&hdev->channel->callback_event); + disable_work_sync(&hdev->channel->callback_event); hbus->state = hv_pcibus_removing; - tasklet_enable(&hdev->channel->callback_event); + enable_and_queue_work(system_bh_wq, &hdev->channel->callback_event); destroy_workqueue(hbus->wq); hbus->wq = NULL; /* @@ -3948,14 +3949,14 @@ static int hv_pci_suspend(struct hv_device *hdev) * it knows that no new work item can be scheduled, and then it flushes * hbus->wq and safely closes the vmbus channel. */ - tasklet_disable(&hdev->channel->callback_event); + disable_work_sync(&hdev->channel->callback_event); /* Change the hbus state to prevent new work items. */ old_state = hbus->state; if (hbus->state == hv_pcibus_installed) hbus->state = hv_pcibus_removing; - tasklet_enable(&hdev->channel->callback_event); + enable_and_queue_work(system_bh_wq, &hdev->channel->callback_event); if (old_state != hv_pcibus_installed) return -EINVAL; -- 2.17.1