Thread (23 messages) 23 messages, 4 authors, 2025-03-05

Re: [PATCH net-next 03/10] devlink: Serialize access to rate domains

flat view

From: Jiri Pirko <jiri@resnulli.us>
Date: 2025-02-14 12:54:55
Also in: linux-doc, linux-rdma, lkml

Thu, Feb 13, 2025 at 07:01:27PM +0100, tariqt@nvidia.com wrote:
quoted hunk ↗ jump to hunk
From: Cosmin Ratiu <redacted>

Access to rates in a rate domain should be serialized.

This commit introduces two new functions, devl_rate_domain_lock and
devl_rate_domain_unlock, and uses them whenever serial access to a rate
domain is needed. For now, they are no-ops since access to a rate domain
is protected by the devlink lock.

Signed-off-by: Cosmin Ratiu <redacted>
Reviewed-by: Carolina Jubran <redacted>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
net/devlink/devl_internal.h |   4 ++
net/devlink/rate.c          | 114 +++++++++++++++++++++++++++---------
2 files changed, 89 insertions(+), 29 deletions(-)
diff --git a/net/devlink/devl_internal.h b/net/devlink/devl_internal.h
index 209b4a4c7070..fae81dd6953f 100644
--- a/net/devlink/devl_internal.h
+++ b/net/devlink/devl_internal.h
@@ -121,6 +121,10 @@ static inline void devl_dev_unlock(struct devlink *devlink, bool dev_lock)
		device_unlock(devlink->dev);
}

+static inline void devl_rate_domain_lock(struct devlink *devlink) { }
+
+static inline void devl_rate_domain_unlock(struct devlink *devlink) { }

For the record, I'm still not convinced that introducing this kind of
shared inter-devlink lock is good idea. We spent quite a bit of painful
times getting rid of global devlink_mutex and making devlink locking
scheme nice and simple as it currently is.

But at the same time I admit I can't think of any other nicer solution
to the problem this patchset is trying to solve.

Jakub, any thoughts?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help