/// Find functions that refer to GFP_KERNEL but are called with locks held. //# The proposed change of converting the GFP_KERNEL is not necessarily the //# correct one. It may be desired to unlock the lock, or to not call the //# function under the lock in the first place. /// // Confidence: Moderate // Copyright: (C) 2012 Nicolas Palix. GPLv2. // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ // Comments: // Options: --no-includes --include-headers virtual patch virtual context virtual org virtual report @gfp exists@ identifier fn; position p; @@ fn(...) { ... when != read_unlock_irq(...) when != write_unlock_irq(...) when != read_unlock_irqrestore(...) when != write_unlock_irqrestore(...) when != spin_unlock(...) when != spin_unlock_irq(...) when != spin_unlock_irqrestore(...) when != local_irq_enable(...) when any GFP_KERNEL@p ... when any } @locked exists@ identifier gfp.fn; position p1,p2; @@ ( read_lock_irq@p1 | write_lock_irq@p1 | read_lock_irqsave@p1 | write_lock_irqsave@p1 | spin_lock@p1 | spin_trylock@p1 | spin_lock_irq@p1 | spin_lock_irqsave@p1 | local_irq_disable@p1 ) (...) ... when != read_unlock_irq(...) when != write_unlock_irq(...) when != read_unlock_irqrestore(...) when != write_unlock_irqrestore(...) when != spin_unlock(...) when != spin_unlock_irq(...) when != spin_unlock_irqrestore(...) when != local_irq_enable(...) fn@p2(...) @depends on locked && patch@ position gfp.p; @@ - GFP_KERNEL@p + GFP_ATOMIC @depends on locked && !patch@ position gfp.p; @@ * GFP_KERNEL@p @script:python depends on !patch && org@ p << gfp.p; fn << gfp.fn; p1 << locked.p1; p2 << locked.p2; @@ cocci.print_main("lock",p1) cocci.print_secs("call",p2) cocci.print_secs("GFP_KERNEL",p) @script:python depends on !patch && report@ p << gfp.p; fn << gfp.fn; p1 << locked.p1; p2 << locked.p2; @@ msg = "ERROR: function %s called on line %s inside lock on line %s but uses GFP_KERNEL" % (fn,p2[0].line,p1[0].line) coccilib.report.print_report(p[0], msg) /linux/net-next.git/diff/net/sunrpc/sunrpc.h?h=nds-private-remove&id=433e19cf33d34bb6751c874a9c00980552fe508c'>diff
path: root/net/sunrpc/sunrpc.h
diff options
context:
space:
mode:
authorDexuan Cui <decui@microsoft.com>2017-01-28 11:46:02 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-31 10:59:48 +0100
commit433e19cf33d34bb6751c874a9c00980552fe508c (patch)
treece6547ef2987fbb289fa28f03536328a42781651 /net/sunrpc/sunrpc.h
parent191e885a2e130e639bb0c8ee350d7047294f2ce6 (diff)
Drivers: hv: vmbus: finally fix hv_need_to_signal_on_read()
Commit a389fcfd2cb5 ("Drivers: hv: vmbus: Fix signaling logic in hv_need_to_signal_on_read()") added the proper mb(), but removed the test "prev_write_sz < pending_sz" when making the signal decision. As a result, the guest can signal the host unnecessarily, and then the host can throttle the guest because the host thinks the guest is buggy or malicious; finally the user running stress test can perceive intermittent freeze of the guest. This patch brings back the test, and properly handles the in-place consumption APIs used by NetVSC (see get_next_pkt_raw(), put_pkt_raw() and commit_rd_index()). Fixes: a389fcfd2cb5 ("Drivers: hv: vmbus: Fix signaling logic in hv_need_to_signal_on_read()") Signed-off-by: Dexuan Cui <decui@microsoft.com> Reported-by: Rolf Neugebauer <rolf.neugebauer@docker.com> Tested-by: Rolf Neugebauer <rolf.neugebauer@docker.com> Cc: "K. Y. Srinivasan" <kys@microsoft.com> Cc: Haiyang Zhang <haiyangz@microsoft.com> Cc: Stephen Hemminger <sthemmin@microsoft.com> Cc: <stable@vger.kernel.org> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/sunrpc/sunrpc.h')