lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230809-b4-rt_preempt-fix-v1-2-7283bbdc8b14@gmail.com>
Date:   Wed, 09 Aug 2023 22:36:33 +0000
From:   Mitchell Levy via B4 Relay 
        <devnull+levymitchell0.gmail.com@...nel.org>
To:     "K. Y. Srinivasan" <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
        Lorenzo Pieralisi <lpieralisi@...nel.org>,
        Krzysztof WilczyƄski <kw@...ux.com>,
        Rob Herring <robh@...nel.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>
Cc:     linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-pci@...r.kernel.org, Mitchell Levy <levymitchell0@...il.com>
Subject: [PATCH RFC 2/2] Use raw_spinlock_t in vmbus_requestor

From: Mitchell Levy <levymitchell0@...il.com>

Because hv_pci_onchannelcallback is called with irq disabled in
hv_compose_msi_msg, any locks held in that function must not be
sleepable. Therefore, change vmbus_requestor to use raw_spinlock_t.
---
 drivers/hv/channel.c   | 2 +-
 include/linux/hyperv.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 00d73ec060ed..08e6bd4a056d 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -635,7 +635,7 @@ static int vmbus_alloc_requestor(struct vmbus_requestor *rqstor, u32 size)
 	rqstor->req_bitmap = bitmap;
 	rqstor->size = size;
 	rqstor->next_request_id = 0;
-	spin_lock_init(&rqstor->req_lock);
+	raw_spin_lock_init(&rqstor->req_lock);
 
 	return 0;
 }
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 56a1fb1647a4..664c03a78e11 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -787,7 +787,7 @@ struct vmbus_requestor {
 	unsigned long *req_bitmap; /* is a given slot available? */
 	u32 size;
 	u64 next_request_id;
-	spinlock_t req_lock; /* provides atomicity */
+	raw_spinlock_t req_lock; /* provides atomicity */
 };
 
 #define VMBUS_NO_RQSTOR U64_MAX
@@ -1050,7 +1050,7 @@ struct vmbus_channel {
 do {									\
 	struct vmbus_requestor *rqstor = &(channel)->requestor;		\
 									\
-	spin_lock_irqsave(&rqstor->req_lock, flags);			\
+	raw_spin_lock_irqsave(&rqstor->req_lock, flags);		\
 } while (0)
 
 static __always_inline void unlock_requestor(struct vmbus_channel *channel,
@@ -1058,7 +1058,7 @@ static __always_inline void unlock_requestor(struct vmbus_channel *channel,
 {
 	struct vmbus_requestor *rqstor = &channel->requestor;
 
-	spin_unlock_irqrestore(&rqstor->req_lock, flags);
+	raw_spin_unlock_irqrestore(&rqstor->req_lock, flags);
 }
 
 u64 vmbus_next_request_id(struct vmbus_channel *channel, u64 rqst_addr);

-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ