From: Dan Magenheimer Subject: [PATCH] [FOR 4.2] tmem: add matching unlock for an about-to-be-destroyed object Date: Fri, 31 Aug 2012 12:58:18 -0700 (PDT) Message-ID: <76edd759-ceca-4fb5-b411-1e598137afd8@default> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="__1346443137219609740abhmt117.oracle.com" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: keir@xen.org, Zhenzhong Duan , Konrad Wilk List-Id: xen-devel@lists.xenproject.org --__1346443137219609740abhmt117.oracle.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable (Guidance appreciated if the Xen patch submittal process has changed and I need to do more than send this email.) A 4.2 changeset forces a preempt_disable/enable with every lock/unlock. Tmem has dynamically allocated "objects" that contain a lock. The lock is held when the object is destroyed. No reason to unlock something that's about to be destroyed! But with the preempt_enable/disable in the generic locking code, and the fact that do_softirq ASSERTs that preempt_count must be zero, a crash occurs soon after any object is destroyed. So force lock to be released before destroying objects. Signed-off-by: Dan Magenheimer diff -r 1967c7c290eb xen/common/tmem.c --- a/xen/common/tmem.c=09Wed Feb 09 12:03:09 2011 +0000 +++ b/xen/common/tmem.c=09Fri Aug 31 13:49:51 2012 -0600 @@ -957,6 +957,7 @@ /* use no_rebalance only if all objects are being destroyed anyway */ if ( !no_rebalance ) rb_erase(&obj->rb_tree_node,&pool->obj_rb_root[oid_hash(&old_oid)]= ); + tmem_spin_unlock(&obj->obj_spinlock); tmem_free(obj,sizeof(obj_t),pool); } --__1346443137219609740abhmt117.oracle.com Content-Type: application/octet-stream; name="xen-tmem-destroy-obj.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="xen-tmem-destroy-obj.patch" ZGlmZiAtciAxOTY3YzdjMjkwZWIgeGVuL2NvbW1vbi90bWVtLmMKLS0tIGEveGVuL2NvbW1vbi90 bWVtLmMJV2VkIEZlYiAwOSAxMjowMzowOSAyMDExICswMDAwCisrKyBiL3hlbi9jb21tb24vdG1l bS5jCUZyaSBBdWcgMzEgMTM6NDk6NTEgMjAxMiAtMDYwMApAQCAtOTU3LDYgKzk1Nyw3IEBACiAg ICAgLyogdXNlIG5vX3JlYmFsYW5jZSBvbmx5IGlmIGFsbCBvYmplY3RzIGFyZSBiZWluZyBkZXN0 cm95ZWQgYW55d2F5ICovCiAgICAgaWYgKCAhbm9fcmViYWxhbmNlICkKICAgICAgICAgcmJfZXJh c2UoJm9iai0+cmJfdHJlZV9ub2RlLCZwb29sLT5vYmpfcmJfcm9vdFtvaWRfaGFzaCgmb2xkX29p ZCldKTsKKyAgICB0bWVtX3NwaW5fdW5sb2NrKCZvYmotPm9ial9zcGlubG9jayk7CiAgICAgdG1l bV9mcmVlKG9iaixzaXplb2Yob2JqX3QpLHBvb2wpOwogfQogCg== --__1346443137219609740abhmt117.oracle.com Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --__1346443137219609740abhmt117.oracle.com--