From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, Jon Maloy <jon.maloy@ericsson.com>,
Ying Xue <ying.xue@windriver.com>,
Erik Hugne <erik.hugne@ericsson.com>,
Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: [PATCH net-next 10/12] tipc: convert config_lock from spinlock to mutex
Date: Thu, 30 May 2013 15:36:15 -0400 [thread overview]
Message-ID: <1369942577-39563-11-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <1369942577-39563-1-git-send-email-paul.gortmaker@windriver.com>
From: Ying Xue <ying.xue@windriver.com>
As the configuration server is now running under process context,
it's unnecessary for us to have a spinlock serializing the TIPC
configuration process. Instead, we replace it with a mutex lock,
which gives us more freedom. For instance, we can now call
pre-emptable functions within the protected area.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/config.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/net/tipc/config.c b/net/tipc/config.c
index d183479..8be6052 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -42,7 +42,7 @@
#define REPLY_TRUNCATED "<truncated>\n"
-static DEFINE_SPINLOCK(config_lock);
+static DEFINE_MUTEX(config_mutex);
static struct tipc_server cfgsrv;
static const void *req_tlv_area; /* request message TLV area */
@@ -181,18 +181,7 @@ static struct sk_buff *cfg_set_own_addr(void)
if (tipc_own_addr)
return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (cannot change node address once assigned)");
-
- /*
- * Must temporarily release configuration spinlock while switching into
- * networking mode as it calls tipc_eth_media_start(), which may sleep.
- * Releasing the lock is harmless as other locally-issued configuration
- * commands won't occur until this one completes, and remotely-issued
- * configuration commands can't be received until a local configuration
- * command to enable the first bearer is received and processed.
- */
- spin_unlock_bh(&config_lock);
tipc_core_start_net(addr);
- spin_lock_bh(&config_lock);
return tipc_cfg_reply_none();
}
@@ -232,7 +221,7 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
{
struct sk_buff *rep_tlv_buf;
- spin_lock_bh(&config_lock);
+ mutex_lock(&config_mutex);
/* Save request and reply details in a well-known location */
req_tlv_area = request_area;
@@ -359,7 +348,7 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
/* Return reply buffer */
exit:
- spin_unlock_bh(&config_lock);
+ mutex_unlock(&config_mutex);
return rep_tlv_buf;
}
--
1.8.1.2
next prev parent reply other threads:[~2013-05-30 19:36 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-30 19:36 [PATCH net-next 00/12] tipc: make use of kernel threads to simplify things Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 01/12] tipc: change socket buffer overflow control to respect sk_rcvbuf Paul Gortmaker
2013-05-31 13:36 ` Neil Horman
2013-06-03 9:55 ` Ying Xue
2013-06-03 13:16 ` Neil Horman
2013-06-04 1:37 ` Ying Xue
2013-06-04 13:40 ` Neil Horman
2013-05-30 19:36 ` [PATCH net-next 02/12] tipc: Add "max_ports" configuration parameter Paul Gortmaker
2013-05-30 22:49 ` David Miller
2013-05-31 8:25 ` Erik Hugne
2013-05-31 8:29 ` David Miller
2013-05-31 8:34 ` Erik Hugne
2013-05-31 8:40 ` David Miller
2013-05-31 9:23 ` Erik Hugne
2013-05-31 9:25 ` David Laight
2013-05-31 9:26 ` David Miller
2013-05-31 9:06 ` David Laight
2013-05-31 17:48 ` Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 03/12] tipc: allow implicit connect for stream sockets Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 04/12] tipc: introduce new TIPC server infrastructure Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 05/12] tipc: convert topology server to use new server facility Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 06/12] tipc: convert configuration " Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 07/12] tipc: delete code orphaned by new server infrastructure Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 08/12] tipc: remove user_port instance from tipc_port structure Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 09/12] tipc: rename tipc_createport_raw to tipc_createport Paul Gortmaker
2013-05-30 19:36 ` Paul Gortmaker [this message]
2013-05-30 19:36 ` [PATCH net-next 11/12] tipc: save sock structure pointer instead of void pointer to tipc_port Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 12/12] tipc: cosmetic realignment of function arguments Paul Gortmaker
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=1369942577-39563-11-git-send-email-paul.gortmaker@windriver.com \
--to=paul.gortmaker@windriver.com \
--cc=davem@davemloft.net \
--cc=erik.hugne@ericsson.com \
--cc=jon.maloy@ericsson.com \
--cc=netdev@vger.kernel.org \
--cc=ying.xue@windriver.com \
/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).