* [PATCH 0/4] Lustre fixes
@ 2015-03-08 0:24 green
2015-03-08 0:24 ` [PATCH 1/4] staging/lustre/libcfs: replace deprecated cpus_ calls with cpumask_ green
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: green @ 2015-03-08 0:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel, Andreas Dilger
Cc: Linux Kernel Mailing List, Oleg Drokin
From: Oleg Drokin <green@linuxhacker.ru>
The first two patches are a follow on for the previous patch series
on not using deprecated cpumask-related code.
And two blocking while atomic/not running fixes.
Please consider.
Lai Siyao (1):
staging/lustre/llite: avoid nonatomic memory alloc under spinlock
Oleg Drokin (3):
staging/lustre/libcfs: replace deprecated cpus_ calls with cpumask_
staging/lustre/o2iblnd: Don't use cpus_weight
staging/lustre: Don't call blocking funcitons when !RUNNABLE
.../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 +--
.../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 32 ++++++++++++----------
.../lustre/lustre/libcfs/linux/linux-tcpip.c | 10 +++----
drivers/staging/lustre/lustre/llite/statahead.c | 13 +++++++--
4 files changed, 35 insertions(+), 24 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] staging/lustre/libcfs: replace deprecated cpus_ calls with cpumask_
2015-03-08 0:24 [PATCH 0/4] Lustre fixes green
@ 2015-03-08 0:24 ` green
2015-03-08 0:24 ` [PATCH 2/4] staging/lustre/o2iblnd: Don't use cpus_weight green
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: green @ 2015-03-08 0:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel, Andreas Dilger
Cc: Linux Kernel Mailing List, Oleg Drokin
From: Oleg Drokin <green@linuxhacker.ru>
This patch continues to further remove deprecated functions, such as
any_online_cpu, for_each_cpu_mask and also cleaning up
usage of NR_CPUS in a few places
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
.../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 32 ++++++++++++----------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
index 1eeacef..cc3ab35 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
@@ -204,7 +204,7 @@ cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len)
}
tmp += rc;
- for_each_cpu_mask(j, *cptab->ctb_parts[i].cpt_cpumask) {
+ for_each_cpu(j, cptab->ctb_parts[i].cpt_cpumask) {
rc = snprintf(tmp, len, "%d ", j);
len -= rc;
if (len <= 0) {
@@ -251,8 +251,10 @@ cfs_cpt_online(struct cfs_cpt_table *cptab, int cpt)
LASSERT(cpt == CFS_CPT_ANY || (cpt >= 0 && cpt < cptab->ctb_nparts));
return cpt == CFS_CPT_ANY ?
- any_online_cpu(*cptab->ctb_cpumask) < nr_cpu_ids :
- any_online_cpu(*cptab->ctb_parts[cpt].cpt_cpumask) < nr_cpu_ids;
+ cpumask_any_and(cptab->ctb_cpumask,
+ cpu_online_mask) < nr_cpu_ids :
+ cpumask_any_and(cptab->ctb_parts[cpt].cpt_cpumask,
+ cpu_online_mask) < nr_cpu_ids;
}
EXPORT_SYMBOL(cfs_cpt_online);
@@ -356,22 +358,22 @@ cfs_cpt_unset_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
LASSERT(node_isset(node, *cptab->ctb_parts[cpt].cpt_nodemask));
LASSERT(node_isset(node, *cptab->ctb_nodemask));
- for_each_cpu_mask(i, *cptab->ctb_parts[cpt].cpt_cpumask) {
+ for_each_cpu(i, cptab->ctb_parts[cpt].cpt_cpumask) {
/* this CPT has other CPU belonging to this node? */
if (cpu_to_node(i) == node)
break;
}
- if (i == NR_CPUS)
+ if (i >= nr_cpu_ids)
node_clear(node, *cptab->ctb_parts[cpt].cpt_nodemask);
- for_each_cpu_mask(i, *cptab->ctb_cpumask) {
+ for_each_cpu(i, cptab->ctb_cpumask) {
/* this CPT-table has other CPU belonging to this node? */
if (cpu_to_node(i) == node)
break;
}
- if (i == NR_CPUS)
+ if (i >= nr_cpu_ids)
node_clear(node, *cptab->ctb_nodemask);
return;
@@ -383,13 +385,14 @@ cfs_cpt_set_cpumask(struct cfs_cpt_table *cptab, int cpt, cpumask_t *mask)
{
int i;
- if (cpumask_weight(mask) == 0 || any_online_cpu(*mask) >= nr_cpu_ids) {
+ if (cpumask_weight(mask) == 0 ||
+ cpumask_any_and(mask, cpu_online_mask) >= nr_cpu_ids) {
CDEBUG(D_INFO, "No online CPU is found in the CPU mask for CPU partition %d\n",
cpt);
return 0;
}
- for_each_cpu_mask(i, *mask) {
+ for_each_cpu(i, mask) {
if (!cfs_cpt_set_cpu(cptab, cpt, i))
return 0;
}
@@ -403,7 +406,7 @@ cfs_cpt_unset_cpumask(struct cfs_cpt_table *cptab, int cpt, cpumask_t *mask)
{
int i;
- for_each_cpu_mask(i, *mask)
+ for_each_cpu(i, mask)
cfs_cpt_unset_cpu(cptab, cpt, i);
}
EXPORT_SYMBOL(cfs_cpt_unset_cpumask);
@@ -493,7 +496,7 @@ cfs_cpt_clear(struct cfs_cpt_table *cptab, int cpt)
}
for (; cpt <= last; cpt++) {
- for_each_cpu_mask(i, *cptab->ctb_parts[cpt].cpt_cpumask)
+ for_each_cpu(i, cptab->ctb_parts[cpt].cpt_cpumask)
cfs_cpt_unset_cpu(cptab, cpt, i);
}
}
@@ -578,7 +581,7 @@ cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt)
nodemask = cptab->ctb_parts[cpt].cpt_nodemask;
}
- if (any_online_cpu(*cpumask) >= nr_cpu_ids) {
+ if (cpumask_any_and(cpumask, cpu_online_mask) >= nr_cpu_ids) {
CERROR("No online CPU found in CPU partition %d, did someone do CPU hotplug on system? You might need to reload Lustre modules to keep system working well.\n",
cpt);
return -EINVAL;
@@ -654,7 +657,7 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt,
LASSERT(!cpumask_empty(core));
- for_each_cpu_mask(i, *core) {
+ for_each_cpu(i, core) {
cpumask_clear_cpu(i, socket);
cpumask_clear_cpu(i, node);
@@ -965,7 +968,8 @@ cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
mutex_lock(&cpt_data.cpt_mutex);
/* if all HTs in a core are offline, it may break affinity */
cfs_cpu_ht_siblings(cpu, cpt_data.cpt_cpumask);
- warn = any_online_cpu(*cpt_data.cpt_cpumask) >= nr_cpu_ids;
+ warn = cpumask_any_and(cpt_data.cpt_cpumask,
+ cpu_online_mask) >= nr_cpu_ids;
mutex_unlock(&cpt_data.cpt_mutex);
CDEBUG(warn ? D_WARNING : D_INFO,
"Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u action: %lx]\n",
--
2.1.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/4] staging/lustre/o2iblnd: Don't use cpus_weight
2015-03-08 0:24 [PATCH 0/4] Lustre fixes green
2015-03-08 0:24 ` [PATCH 1/4] staging/lustre/libcfs: replace deprecated cpus_ calls with cpumask_ green
@ 2015-03-08 0:24 ` green
2015-03-08 0:24 ` [PATCH 3/4] staging/lustre/llite: avoid nonatomic memory alloc under spinlock green
2015-03-08 0:24 ` [PATCH 4/4] staging/lustre: Don't call blocking funcitons when !RUNNABLE green
3 siblings, 0 replies; 5+ messages in thread
From: green @ 2015-03-08 0:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel, Andreas Dilger
Cc: Linux Kernel Mailing List, Oleg Drokin
From: Oleg Drokin <green@linuxhacker.ru>
cpus_weight and for_each_cpu_mask are deprecated, so replace them
with cpumask_weight and for_each_cpu respectively.
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index 109f44c..b725a99 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -638,8 +638,8 @@ kiblnd_get_completion_vector(kib_conn_t *conn, int cpt)
return 0;
/* hash NID to CPU id in this partition... */
- off = do_div(nid, cpus_weight(*mask));
- for_each_cpu_mask(i, *mask) {
+ off = do_div(nid, cpumask_weight(mask));
+ for_each_cpu(i, mask) {
if (off-- == 0)
return i % vectors;
}
--
2.1.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] staging/lustre/llite: avoid nonatomic memory alloc under spinlock
2015-03-08 0:24 [PATCH 0/4] Lustre fixes green
2015-03-08 0:24 ` [PATCH 1/4] staging/lustre/libcfs: replace deprecated cpus_ calls with cpumask_ green
2015-03-08 0:24 ` [PATCH 2/4] staging/lustre/o2iblnd: Don't use cpus_weight green
@ 2015-03-08 0:24 ` green
2015-03-08 0:24 ` [PATCH 4/4] staging/lustre: Don't call blocking funcitons when !RUNNABLE green
3 siblings, 0 replies; 5+ messages in thread
From: green @ 2015-03-08 0:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel, Andreas Dilger
Cc: Linux Kernel Mailing List, Lai Siyao, Jian Yu, Oleg Drokin
From: Lai Siyao <lai.siyao@intel.com>
ll_intent_drop_lock() may sleep in memory allocation, which
should not be called inside spinlock.
Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Signed-off-by: Jian Yu <jian.yu@intel.com>
Reviewed-on: http://review.whamcloud.com/10674
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2272
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
drivers/staging/lustre/lustre/llite/statahead.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c
index fe732fa..b75562c 100644
--- a/drivers/staging/lustre/lustre/llite/statahead.c
+++ b/drivers/staging/lustre/lustre/llite/statahead.c
@@ -706,11 +706,21 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,
struct ll_inode_info *lli = ll_i2info(dir);
struct ll_statahead_info *sai = NULL;
struct ll_sa_entry *entry;
+ __u64 handle = 0;
int wakeup;
if (it_disposition(it, DISP_LOOKUP_NEG))
rc = -ENOENT;
+ if (rc == 0) {
+ /* release ibits lock ASAP to avoid deadlock when statahead
+ * thread enqueues lock on parent in readdir and another
+ * process enqueues lock on child with parent lock held, eg.
+ * unlink. */
+ handle = it->d.lustre.it_lock_handle;
+ ll_intent_drop_lock(it);
+ }
+
spin_lock(&lli->lli_sa_lock);
/* stale entry */
if (unlikely(lli->lli_sai == NULL ||
@@ -745,8 +755,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,
* when statahead thread tries to enqueue lock on parent
* for readpage and other tries to enqueue lock on child
* with parent's lock held, for example: unlink. */
- entry->se_handle = it->d.lustre.it_lock_handle;
- ll_intent_drop_lock(it);
+ entry->se_handle = handle;
wakeup = sa_received_empty(sai);
list_add_tail(&entry->se_list,
&sai->sai_entries_received);
--
2.1.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] staging/lustre: Don't call blocking funcitons when !RUNNABLE
2015-03-08 0:24 [PATCH 0/4] Lustre fixes green
` (2 preceding siblings ...)
2015-03-08 0:24 ` [PATCH 3/4] staging/lustre/llite: avoid nonatomic memory alloc under spinlock green
@ 2015-03-08 0:24 ` green
3 siblings, 0 replies; 5+ messages in thread
From: green @ 2015-03-08 0:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel, Andreas Dilger
Cc: Linux Kernel Mailing List, Oleg Drokin
From: Oleg Drokin <green@linuxhacker.ru>
Move setting of TASK_INTERRUPTIBLE just around schedule call in
libcfs_sock_accept.
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
index cd2fc01..f2462e7 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
@@ -543,19 +543,17 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock)
newsock->ops = sock->ops;
- set_current_state(TASK_INTERRUPTIBLE);
- add_wait_queue(sk_sleep(sock->sk), &wait);
-
rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
if (rc == -EAGAIN) {
/* Nothing ready, so wait for activity */
+ set_current_state(TASK_INTERRUPTIBLE);
+ add_wait_queue(sk_sleep(sock->sk), &wait);
schedule();
+ remove_wait_queue(sk_sleep(sock->sk), &wait);
+ set_current_state(TASK_RUNNING);
rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
}
- remove_wait_queue(sk_sleep(sock->sk), &wait);
- set_current_state(TASK_RUNNING);
-
if (rc != 0)
goto failed;
--
2.1.0
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-08 0:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-08 0:24 [PATCH 0/4] Lustre fixes green
2015-03-08 0:24 ` [PATCH 1/4] staging/lustre/libcfs: replace deprecated cpus_ calls with cpumask_ green
2015-03-08 0:24 ` [PATCH 2/4] staging/lustre/o2iblnd: Don't use cpus_weight green
2015-03-08 0:24 ` [PATCH 3/4] staging/lustre/llite: avoid nonatomic memory alloc under spinlock green
2015-03-08 0:24 ` [PATCH 4/4] staging/lustre: Don't call blocking funcitons when !RUNNABLE green
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®