From: Mitchell Levy via B4 Relay <devnull+levymitchell0.gmail.com@kernel.org>
To: "K. Y. Srinivasan" <kys@microsoft.com>,
"Haiyang Zhang" <haiyangz@microsoft.com>,
"Wei Liu" <wei.liu@kernel.org>,
"Dexuan Cui" <decui@microsoft.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>
Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org,
Mitchell Levy <levymitchell0@gmail.com>
Subject: [PATCH RFC 2/2] Use raw_spinlock_t in vmbus_requestor
Date: Wed, 09 Aug 2023 22:36:33 +0000 [thread overview]
Message-ID: <20230809-b4-rt_preempt-fix-v1-2-7283bbdc8b14@gmail.com> (raw)
In-Reply-To: <20230809-b4-rt_preempt-fix-v1-0-7283bbdc8b14@gmail.com>
From: Mitchell Levy <levymitchell0@gmail.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
next prev parent reply other threads:[~2023-08-09 22:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 22:36 [PATCH RFC 0/2] hyperv: Use raw_spinlock_t when not sleepable Mitchell Levy via B4 Relay
2023-08-09 22:36 ` [PATCH RFC 1/2] Use raw_spinlock_t for vmbus_channel.sched_lock Mitchell Levy via B4 Relay
2023-08-09 22:36 ` Mitchell Levy via B4 Relay [this message]
2023-08-15 18:44 ` [PATCH RFC 0/2] hyperv: Use raw_spinlock_t when not sleepable Michael Kelley (LINUX)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230809-b4-rt_preempt-fix-v1-2-7283bbdc8b14@gmail.com \
--to=devnull+levymitchell0.gmail.com@kernel.org \
--cc=bhelgaas@google.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kw@linux.com \
--cc=kys@microsoft.com \
--cc=levymitchell0@gmail.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=robh@kernel.org \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).