From: <vl...@us...> - 2007-09-25 09:36:28
|
Revision: 196 http://scst.svn.sourceforge.net/scst/?rev=196&view=rev Author: vlnb Date: 2007-09-25 02:36:27 -0700 (Tue, 25 Sep 2007) Log Message: ----------- - Fixes wrong IRQ-safe/IRQ-unsafe locking dependancy spotted by lockdep: scst_check_local_events() must not be called with IRQs disabled - Cosmetics Modified Paths: -------------- trunk/scst/src/dev_handlers/scst_user.c trunk/scst/src/scst_mem.c trunk/scst/src/scst_targ.c Modified: trunk/scst/src/dev_handlers/scst_user.c =================================================================== --- trunk/scst/src/dev_handlers/scst_user.c 2007-09-25 09:34:37 UTC (rev 195) +++ trunk/scst/src/dev_handlers/scst_user.c 2007-09-25 09:36:27 UTC (rev 196) @@ -1446,6 +1446,7 @@ return res; } +/* Called under cmd_lists.cmd_list_lock and IRQ off */ struct dev_user_cmd *__dev_user_get_next_cmd(struct list_head *cmd_list) { struct dev_user_cmd *u; @@ -1459,11 +1460,11 @@ EXTRACHECKS_BUG_ON(u->state & UCMD_STATE_JAMMED_MASK); if (u->cmd != NULL) { if (u->state == UCMD_STATE_EXECING) { - int rc = scst_check_local_events(u->cmd); + struct scst_user_dev *dev = u->dev; + int rc; + spin_unlock_irq(&dev->cmd_lists.cmd_list_lock); + rc = scst_check_local_events(u->cmd); if (unlikely(rc != 0)) { - struct scst_user_dev *dev = u->dev; - spin_unlock_irq( - &dev->cmd_lists.cmd_list_lock); u->cmd->scst_cmd_done(u->cmd, SCST_CMD_STATE_DEFAULT); /* @@ -1474,6 +1475,11 @@ &dev->cmd_lists.cmd_list_lock); goto again; } + /* + * There is no real need to lock again here, but + * let's do it for simplicity. + */ + spin_lock_irq(&dev->cmd_lists.cmd_list_lock); } else if (unlikely(test_bit(SCST_CMD_ABORTED, &u->cmd->cmd_flags))) { switch(u->state) { Modified: trunk/scst/src/scst_mem.c =================================================================== --- trunk/scst/src/scst_mem.c 2007-09-25 09:34:37 UTC (rev 195) +++ trunk/scst/src/scst_mem.c 2007-09-25 09:36:27 UTC (rev 196) @@ -471,19 +471,14 @@ pages = sgv_pool_oom_free_objs(pages); if (pages > 0) { - static int q; - if (q < 100) { - q++; - TRACE(TRACE_OUT_OF_MEM, "Requested amount of " - "memory for being executed commands " - "exceeds allowed maximum %dMB, " - "should you increase scst_max_cmd_mem " - "(requested %d pages)? (This warning " - "will be shown only %d more times)", - sgv_pools_mgr.mgr.thr.hi_wmk >> - (20-PAGE_SHIFT), pages_to_alloc, - 100-q); - } + TRACE(TRACE_OUT_OF_MEM, "Requested amount of " + "memory (%d pages) for being executed " + "commands together with the already " + "allocated memory exceeds the allowed " + "maximum %dMB. Should you increase " + "scst_max_cmd_mem?", pages_to_alloc, + sgv_pools_mgr.mgr.thr.hi_wmk >> + (20-PAGE_SHIFT)); sgv_pools_mgr.mgr.thr.releases_failed++; res = -ENOMEM; goto out_unlock; Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2007-09-25 09:34:37 UTC (rev 195) +++ trunk/scst/src/scst_targ.c 2007-09-25 09:36:27 UTC (rev 196) @@ -1449,6 +1449,7 @@ goto out; } +/* No locks, no IRQ or IRQ-safe context allowed */ int scst_check_local_events(struct scst_cmd *cmd) { int res, rc; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |