From f9f77dcebfbee6d977e67510f8a1ec7f40d88899 Mon Sep 17 00:00:00 2001 From: fche Date: Wed, 31 Aug 2005 19:29:55 +0000 Subject: 2005-08-31 Frank Ch. Eigler * translate.cxx (visit_array_in, visit_arrayindex): Use write locks even for array reads, until PR 1275. (translate_pass): Add read_trylock -> write_trylock escalation. --- translate.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'translate.cxx') diff --git a/translate.cxx b/translate.cxx index 6e68e7e3..8c29b020 100644 --- a/translate.cxx +++ b/translate.cxx @@ -1785,7 +1785,8 @@ c_unparser::visit_array_in (array_in* e) { // block used to control varlock_r lifespan mapvar mvar = getmap (e->operand->referent, e->tok); - varlock_r guard (*this, mvar); + // XXX: should be varlock_r, but runtime arrays reads mutate + varlock_w guard (*this, mvar); o->newline() << mvar.seek (idx) << ";"; c_assign (res, mvar.exists(), e->tok); } @@ -2119,7 +2120,8 @@ c_unparser::visit_arrayindex (arrayindex* e) { // block used to control varlock_r lifespan mapvar mvar = getmap (e->referent, e->tok); - varlock_r guard (*this, mvar); + // XXX: should be varlock_r, but runtime arrays reads mutate + varlock_w guard (*this, mvar); o->newline() << mvar.seek (idx) << ";"; c_assign (res, mvar.get(), e->tok); } @@ -2320,6 +2322,12 @@ translate_pass (systemtap_session& s) // XXX s.op->newline() << "#define KALLSYMS_LOOKUP_NAME \"\""; s.op->newline() << "#define KALLSYMS_LOOKUP 0"; + // some older kernels don't have read_trylock, so pessimize. + // XXX: maybe read_trylock is never actually necessary + // for deadlock avoidance + s.op->newline() << "#ifndef read_trylock"; + s.op->newline() << "#define read_trylock write_trylock"; + s.op->newline() << "#endif"; s.op->newline() << "#endif"; s.up->emit_common_header (); -- cgit