From e50fb9b3a75d22304c4d714bb4b670457ad8c17f Mon Sep 17 00:00:00 2001 From: Kartik Rajput Date: Mon, 14 Apr 2025 05:51:03 +0000 Subject: [PATCH] NVIDIA: SAUCE: Revert "NVIDIA: SAUCE: fs: eventpoll: Add smp_mb() before waitqueue_active" This reverts commit 84256e2b9722b98d52c8441be53aed177802cf08. Reason for revert: Following upstream commit already patched the same issue: 81121524f1c7 "locking/rwbase: Take care of ordering guarantee for fastpath reader" http://nvbugs/5217681 Signed-off-by: Kartik Rajput Reviewed-by: Laxman Dewangan Acked-by: Noah Wager Acked-by: Jacob Martin Signed-off-by: Noah Wager --- fs/eventpoll.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 9eea3f0272f4..1a7e322f4f87 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -671,7 +671,6 @@ static void ep_done_scan(struct eventpoll *ep, __pm_relax(ep->ws); if (!list_empty(&ep->rdllist)) { - smp_mb(); if (waitqueue_active(&ep->wq)) wake_up(&ep->wq); } @@ -1251,7 +1250,6 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v * Wake up ( if active ) both the eventpoll wait list and the ->poll() * wait list. */ - smp_mb(); if (waitqueue_active(&ep->wq)) { if ((epi->event.events & EPOLLEXCLUSIVE) && !(pollflags & POLLFREE)) { @@ -1624,7 +1622,6 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event, ep_pm_stay_awake(epi); /* Notify waiting tasks that events are available */ - smp_mb(); if (waitqueue_active(&ep->wq)) wake_up(&ep->wq); if (waitqueue_active(&ep->poll_wait)) @@ -1701,7 +1698,6 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, ep_pm_stay_awake(epi); /* Notify waiting tasks that events are available */ - smp_mb(); if (waitqueue_active(&ep->wq)) wake_up(&ep->wq); if (waitqueue_active(&ep->poll_wait)) @@ -1956,11 +1952,8 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, * important. */ eavail = ep_events_available(ep); - if (!eavail) { - spin_lock(&ep->wq.lock); + if (!eavail) __add_wait_queue_exclusive(&ep->wq, &wait); - spin_unlock(&ep->wq.lock); - } write_unlock_irq(&ep->lock); @@ -1987,9 +1980,7 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, */ if (timed_out) eavail = list_empty(&wait.entry); - spin_lock(&ep->wq.lock); __remove_wait_queue(&ep->wq, &wait); - spin_unlock(&ep->wq.lock); write_unlock_irq(&ep->lock); } }