From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: xen-devel@lists.xenproject.org, jbeulich@suse.com
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH v2.1 15/15] xen: tmem: tmem_try_to_evict_pgp: fix a lock issue
Date: Wed, 9 Apr 2014 09:26:19 -0400 [thread overview]
Message-ID: <1397049979-3479-16-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1397049979-3479-1-git-send-email-konrad.wilk@oracle.com>
From: Bob Liu <bob.liu@oracle.com>
During xen testing, below failure was triggered if dedup=0.
(XEN) Assertion '!preempt_count()' failed at preempt.c:37
(XEN) ----[ Xen-4.5-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 51
(XEN) RIP: e008:[<ffff82d08011bfef>] ASSERT_NOT_IN_ATOMIC+0x22/0x53
(XEN) RFLAGS: 0000000000010286 CONTEXT: hypervisor
(XEN) rax: ffff82d080318d20 rbx: ffff8300681ea000 rcx: 0000000000000001
(XEN) rdx: 00000033bca03300 rsi: ffff8308110da000 rdi: ffff82d080286690
(XEN) rbp: ffff83043cd0ff08 rsp: ffff83043cd0ff08 r8: ffff8307d2beecb0
(XEN) r9: 000000000000000d r10: 00000000deadbeef r11: 0000000000000202
(XEN) r12: 0000000000000000 r13: 0000000000000000 r14: 0000000000000005
(XEN) r15: 0000000000000001 cr0: 0000000080050033 cr4: 00000000001526f0
(XEN) cr3: 000000005246d000 cr2: ffff880106123418
(XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen stack trace from rsp=ffff83043cd0ff08:
(XEN) 00007cfbc32f00c7 ffff82d0802258f0 ffff880106123418 ffffea0006156e80
(XEN) ffff8800d0ab5368 00007faff4c83000 ffff8801bdea33e8 0000000000000002
(XEN) 0000000000000202 00000000deadbeef 0000000000000000 00000000000c3565
(XEN) fffffffffffffff4 ffffffff810014ca ffffffff81de1000 000000000000c356
(XEN) 00000000deadbeef 0001010000000000 ffffffff810014ca 000000000000e033
(XEN) 0000000000000202 ffff8801bdea3360 000000000000e02b 000000000000beef
(XEN) 000000000000beef 000000000000beef 000000000000beef 0000000000000033
(XEN) ffff8300681ea000 00000033bca03300 0000000000000000
(XEN) Xen call trace:
(XEN) [<ffff82d08011bfef>] ASSERT_NOT_IN_ATOMIC+0x22/0x53
(XEN) [<ffff82d0802258f0>] test_all_events+0x6/0x30
The root cause is there is an wronng
'write_unlock(&pcd_tree_rwlocks[firstbyte])' in function
tmem_try_to_evict_pgp().
Nobody will lock &pcd_tree_rwlocks if dedup=0, but the write_unlock() will be
executed anyway. This was introduced by a git commit
38c433d0c711406778aba1ae183a195da98656f0 ("tmem: add page deduplication with
optional compression or trailing-zero-elimination")
Signed-off-by: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
xen/common/tmem.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xen/common/tmem.c b/xen/common/tmem.c
index 66870a0..f7f828f 100644
--- a/xen/common/tmem.c
+++ b/xen/common/tmem.c
@@ -1263,7 +1263,8 @@ static bool_t tmem_try_to_evict_pgp(struct tmem_page_descriptor *pgp, bool_t *ho
return 1;
}
pcd_unlock:
- write_unlock(&pcd_tree_rwlocks[firstbyte]);
+ if ( tmem_dedup_enabled() )
+ write_unlock(&pcd_tree_rwlocks[firstbyte]);
obj_unlock:
spin_unlock(&obj->obj_spinlock);
}
--
1.8.5.3
prev parent reply other threads:[~2014-04-09 13:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-09 13:26 [PATCH/GIT PULL] Cleanups and bug-fix in tmem for v4.5 (v2.1) Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 01/15] tmem: refactor function do_tmem_op() Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 02/15] tmem: remove pageshift from struct tmem_pool Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 03/15] tmem: cleanup: drop unneeded client/pool initialization Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 04/15] tmem: bugfix in obj allocate path Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 05/15] tmem: cleanup: remove unneed parameter from pgp_delist() Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 06/15] tmem: cleanup: remove unneed parameter from pgp_free() Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 07/15] tmem: cleanup the pgp free path Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 08/15] tmem: drop oneline function client_freeze() Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 09/15] tmem: cleanup: drop global_pool_list Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 10/15] tmem: fix the return value of tmemc_set_var() Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 11/15] tmem: remove unneeded parameters from obj destroy path Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 12/15] tmem: cleanup: refactor function tmemc_shared_pool_auth() Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 13/15] tmem: reorg the shared pool allocate path Konrad Rzeszutek Wilk
2014-04-09 13:26 ` [PATCH v2.1 14/15] tmem: remove useless parameter from client and pool flush Konrad Rzeszutek Wilk
2014-04-09 13:26 ` Konrad Rzeszutek Wilk [this message]
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=1397049979-3479-16-git-send-email-konrad.wilk@oracle.com \
--to=konrad.wilk@oracle.com \
--cc=jbeulich@suse.com \
--cc=xen-devel@lists.xenproject.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).