2020-02-23 23:18:19

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 00/30] Lock warning cleanups

This patch series adds missing annotations to various functions,
that register warnings of context imbalance when built with Sparse tool.
The adds fix the warnings, improve on readability odf the code
and give better insight or directive on what the functions are actually doing.

Jules Irenge (30):
btrfs: Add missing annotation for release_extent_buffer()
dax: Add missing annotations ofr dax_read_lock() and dax_read_unlock()
xfs: Add missing annotation to xfs_ail_check()
sctp: Add missing annotation for sctp_err_finish()
sctp: Add missing annotation for sctp_transport_walk_start()
sctp: Add missing annotation for sctp_transport_walk_stop()
net: Add missing annotation for llc_seq_start()
netrom: Add missing annotation for nr_info_start()
netrom: Add missing annotation for nr_info_stop()
net: netrom: Add missing annotation for nr_node_start()
net: netrom: Add missing annotation for nr_node_stop()
net: netrom: Add missing annotation for nr_neigh_start()
net: netrom: Add missing annotation for nr_neigh_stop()
dccp: Add missing annotation for dccp_child_process()
af_unix: Add missing annotation for unix_wait_for_peer()
proc: Add missing annotation for close_pdeo()
mm/zsmalloc: Add missing annotation for zs_map_object()
mm/zsmalloc: Add missing annotation for zs_unmap_object()
mm/zsmalloc: Add missing annotation for migrate_write_lock()
mm/zsmalloc: Add missing annotation for migrate_write_unlock()
scsi: csiostor: Add missing annotation for csio_scsi_cleanup_io_q()
ACPI: OSL: Add missing annotation for acpi_os_acquire_lock()
ACPI: OSL: Add missing annotation for acpi_os_release_lock()
dmaengine: mic_x100_dma: Add missing annotation for
mic_dma_tx_submit_unlock()
zram: Add missing annotatin for zram_slot_lock()
zram: Add missing annotatin for zram_slot_unlock()
habanalabs: Add missing annotation for goya_hw_queues_lock()
habanalabs: Add missing annotation for goya_hw_queues_unlock()
sgi-xp: Add missing annotation for xpc_disconnect_channel()
sgi-xp: Add missing annotation for ocfs2_inode_cache_lock() and
ocfs2_inode_cache_unlock()

drivers/acpi/osl.c | 2 ++
drivers/block/zram/zram_drv.c | 2 ++
drivers/dax/super.c | 4 ++--
drivers/dma/mic_x100_dma.c | 1 +
drivers/misc/habanalabs/goya/goya.c | 2 ++
drivers/misc/sgi-xp/xpc_channel.c | 1 +
drivers/scsi/csiostor/csio_scsi.c | 1 +
fs/btrfs/extent_io.c | 1 +
fs/ocfs2/inode.c | 2 ++
fs/proc/inode.c | 1 +
fs/xfs/xfs_trans_ail.c | 1 +
mm/zsmalloc.c | 4 ++++
net/dccp/minisocks.c | 1 +
net/llc/llc_proc.c | 2 +-
net/netrom/af_netrom.c | 2 ++
net/netrom/nr_route.c | 4 ++++
net/sctp/input.c | 1 +
net/sctp/socket.c | 4 ++--
net/unix/af_unix.c | 1 +
19 files changed, 32 insertions(+), 5 deletions(-)

--
2.24.1


2020-02-23 23:18:19

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 01/30] btrfs: Add missing annotation for release_extent_buffer()

Sparse reports a warning at release_extent_buffer()
warning: context imbalance in release_extent_buffer() - unexpected unlock

The root cause is the missing annotation at release_extent_buffer()
Add the missing __releases(&eb->refs_lock) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
fs/btrfs/extent_io.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index c0f202741e09..8b6d6893e7a7 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -5230,6 +5230,7 @@ static inline void btrfs_release_extent_buffer_rcu(struct rcu_head *head)
}

static int release_extent_buffer(struct extent_buffer *eb)
+ __releases(&eb->refs_lock)
{
lockdep_assert_held(&eb->refs_lock);

--
2.24.1

2020-02-23 23:18:25

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 04/30] sctp: Add missing annotation for sctp_err_finish()

Sparse reports a warning at sctp_err_finish()
warning: context imbalance in sctp_err_finish() - unexpected unlock

The root cause is a missing annotation at sctp_err_finish()
Add the missing __releases(&((__sk)->sk_lock.slock)) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
net/sctp/input.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/sctp/input.c b/net/sctp/input.c
index efaaefc3bb1c..55d4fc6f371d 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -548,6 +548,7 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb,

/* Common cleanup code for icmp/icmpv6 error handler. */
void sctp_err_finish(struct sock *sk, struct sctp_transport *t)
+ __releases(&((__sk)->sk_lock.slock))
{
bh_unlock_sock(sk);
sctp_transport_put(t);
--
2.24.1

2020-02-23 23:18:48

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 14/30] dccp: Add missing annotation for dccp_child_process()

Sparse reports a warning at dccp_child_process()
warning: context imbalance in dccp_child_process() - unexpected unlock
The root cause is the missing annotation at dccp_child_process()
Add the missing __releases(child) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
net/dccp/minisocks.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 25187528c308..c5c74a34d139 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -216,6 +216,7 @@ EXPORT_SYMBOL_GPL(dccp_check_req);
*/
int dccp_child_process(struct sock *parent, struct sock *child,
struct sk_buff *skb)
+ __releases(child)
{
int ret = 0;
const int state = child->sk_state;
--
2.24.1

2020-02-23 23:18:51

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 15/30] af_unix: Add missing annotation for unix_wait_for_peer()

Sparse reports a warning unix_wait_for_peer()

warning: context imbalance in unix_wait_for_peer() - unexpected unlock

The root cause is the missing annotation at unix_wait_for_peer()
Add the missing annotation __releases(&unix_sk(other)->lock)

Signed-off-by: Jules Irenge <[email protected]>
---
net/unix/af_unix.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 62c12cb5763e..cbd7dc01e147 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1207,6 +1207,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
}

static long unix_wait_for_peer(struct sock *other, long timeo)
+ __releases(&unix_sk(other)->lock)
{
struct unix_sock *u = unix_sk(other);
int sched;
--
2.24.1

2020-02-23 23:18:53

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 16/30] proc: Add missing annotation for close_pdeo()

Sparse reports a warning at close_pdeo()
warning: context imbalance in close_pdeo() - unexpected unlock
The root cause is the missing annotation at close_pdeo()
Add the missing __releases(&pde->pde_unload_lock) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
fs/proc/inode.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 6da18316d209..1f33cb7a6c47 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -139,6 +139,7 @@ static void unuse_pde(struct proc_dir_entry *pde)

/* pde is locked on entry, unlocked on exit */
static void close_pdeo(struct proc_dir_entry *pde, struct pde_opener *pdeo)
+ __releases(&pde->pde_unload_lock)
{
/*
* close() (proc_reg_release()) can't delete an entry and proceed:
--
2.24.1

2020-02-23 23:19:00

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 21/30] scsi: csiostor: Add missing annotation for csio_scsi_cleanup_io_q()

Sparse reports a warning at csio_scsi_cleanup_io_q()

warning: context imbalance in csio_scsi_cleanup_io_q() - unexpected unlock

The root cause is the missing annotation at csio_scsi_cleanup_io_q()
Add the missing __must_hold(&hw->lock)

Signed-off-by: Jules Irenge <[email protected]>
---
drivers/scsi/csiostor/csio_scsi.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index 00cf33573136..77cba766ae52 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -1157,6 +1157,7 @@ csio_scsi_cmpl_handler(struct csio_hw *hw, void *wr, uint32_t len,
*/
void
csio_scsi_cleanup_io_q(struct csio_scsim *scm, struct list_head *q)
+ __must_hold(&hw->lock)
{
struct csio_hw *hw = scm->hw;
struct csio_ioreq *ioreq;
--
2.24.1

2020-02-23 23:19:08

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 25/30] zram: Add missing annotatin for zram_slot_lock()

Sparse reports a warning at zram_slot_lock()
warning: context imbalance in zram_slot_lock() - wrong count at exit
The root cause is the missing annotation at zram_slot_lock()
Add the missing __acquires(ZRAM_LOCK) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
drivers/block/zram/zram_drv.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 1bdb5793842b..1462b1bfec11 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -62,6 +62,7 @@ static int zram_slot_trylock(struct zram *zram, u32 index)
}

static void zram_slot_lock(struct zram *zram, u32 index)
+ __acquires(ZRAM_LOCK)
{
bit_spin_lock(ZRAM_LOCK, &zram->table[index].flags);
}
--
2.24.1

2020-02-23 23:19:08

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 24/30] dmaengine: mic_x100_dma: Add missing annotation for mic_dma_tx_submit_unlock()

Sparse reports a warning dma_cookie_t mic_dma_tx_submit_unlock()

warning: context imbalance in mic_dma_tx_submit_unlock()
- unexpected unlock

The root cause is the missing annotation at mic_dma_tx_submit_unlock()
Add the missing annotation __releases(&mic_ch->prep_lock)

Signed-off-by: Jules Irenge <[email protected]>
---
drivers/dma/mic_x100_dma.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/dma/mic_x100_dma.c b/drivers/dma/mic_x100_dma.c
index fea8608a7810..d15c41151d09 100644
--- a/drivers/dma/mic_x100_dma.c
+++ b/drivers/dma/mic_x100_dma.c
@@ -236,6 +236,7 @@ static inline void mic_dma_update_pending(struct mic_dma_chan *ch)
}

static dma_cookie_t mic_dma_tx_submit_unlock(struct dma_async_tx_descriptor *tx)
+ __releases(&mic_ch->prep_lock)
{
struct mic_dma_chan *mic_ch = to_mic_dma_chan(tx->chan);
dma_cookie_t cookie;
--
2.24.1

2020-02-23 23:19:21

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 28/30] habanalabs: Add missing annotation for goya_hw_queues_unlock()

Sparse reports a warning at goya_hw_queues_unlock()
warning: context imbalance in goya_hw_queues_unlock() - unexpected unlock
The root cause is a missing annotation at goya_hw_queues_unlock()
Add the missing __releases(&goya->hw_queues_lock) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
drivers/misc/habanalabs/goya/goya.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c
index 8ca7ee57cbc1..6138b461d0f8 100644
--- a/drivers/misc/habanalabs/goya/goya.c
+++ b/drivers/misc/habanalabs/goya/goya.c
@@ -5081,6 +5081,7 @@ static void goya_hw_queues_lock(struct hl_device *hdev)
}

static void goya_hw_queues_unlock(struct hl_device *hdev)
+ __releases(&goya->hw_queues_lock)
{
struct goya_device *goya = hdev->asic_specific;

--
2.24.1

2020-02-23 23:19:25

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 29/30] sgi-xp: Add missing annotation for xpc_disconnect_channel()

Sparse reports a warning at xpc_disconnect_channel()
warning: context imbalance in xpc_disconnect_channel() - unexpected unlock
The root cause is a missing annotation at xpc_disconnect_channel()
Add the missing __must_hold(&ch->lock) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
drivers/misc/sgi-xp/xpc_channel.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/misc/sgi-xp/xpc_channel.c b/drivers/misc/sgi-xp/xpc_channel.c
index 8e6607fc8a67..a1e92488e9bc 100644
--- a/drivers/misc/sgi-xp/xpc_channel.c
+++ b/drivers/misc/sgi-xp/xpc_channel.c
@@ -752,6 +752,7 @@ xpc_initiate_disconnect(int ch_number)
void
xpc_disconnect_channel(const int line, struct xpc_channel *ch,
enum xp_retval reason, unsigned long *irq_flags)
+ __must_hold(&ch->lock)
{
u32 channel_was_connected = (ch->flags & XPC_C_CONNECTED);

--
2.24.1

2020-02-23 23:19:41

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 22/30] ACPI: OSL: Add missing annotation for acpi_os_acquire_lock()

Sparse reports a warning at acpi_os_acquire_lock()

warning: context imbalance in acpi_os_acquire_lock() - unexpected unlock

The root cause is the missing annotation at acpi_os_acquire_lock()
Add the missing annotation __acquires(lockp)

Signed-off-by: Jules Irenge <[email protected]>
---
drivers/acpi/osl.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 41168c027a5a..7094abc5ffc6 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1598,6 +1598,7 @@ void acpi_os_delete_lock(acpi_spinlock handle)
*/

acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp)
+ __acquires(lockp)
{
acpi_cpu_flags flags;
spin_lock_irqsave(lockp, flags);
--
2.24.1

2020-02-23 23:19:42

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 20/30] mm/zsmalloc: Add missing annotation for migrate_write_unlock()

Sparse reports a warning at migrate_write_unlock()
warning: context imbalance in migrate_write_unlock() - unexpected unlock
The root cause is the missing annotation at migrate_write_unlock()
Add the missing __releases(&zspage->lock)

Signed-off-by: Jules Irenge <[email protected]>
---
mm/zsmalloc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 7ec69a1140cf..cb5541d06823 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1852,6 +1852,7 @@ static void migrate_write_lock(struct zspage *zspage)
}

static void migrate_write_unlock(struct zspage *zspage)
+ __releases(&zspage->lock)
{
write_unlock(&zspage->lock);
}
--
2.24.1

2020-02-23 23:19:48

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 27/30] habanalabs: Add missing annotation for goya_hw_queues_lock()

Sparse reports a warning at goya_hw_queues_lock()
warning: context imbalance in goya_hw_queues_lock() - wrong count at exit
The root cause is a missing annotation at goya_hw_queues_lock()
Add the missing __acquires(&goya->hw_queues_lock) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
drivers/misc/habanalabs/goya/goya.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c
index 7344e8a222ae..8ca7ee57cbc1 100644
--- a/drivers/misc/habanalabs/goya/goya.c
+++ b/drivers/misc/habanalabs/goya/goya.c
@@ -5073,6 +5073,7 @@ static bool goya_is_device_idle(struct hl_device *hdev, u32 *mask,
}

static void goya_hw_queues_lock(struct hl_device *hdev)
+ __acquires(&goya->hw_queues_lock)
{
struct goya_device *goya = hdev->asic_specific;

--
2.24.1

2020-02-23 23:19:50

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 19/30] mm/zsmalloc: Add missing annotation for migrate_write_lock()

Sparse reports a warning at migrate_write_lock()
warning: context imbalance in migrate_write_lock() - wrong count at exit
The root cause is the missing annotation at migrate_write_lock()
Add the missing __acquires(&zspage->lock)

Signed-off-by: Jules Irenge <[email protected]>
---
mm/zsmalloc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 10a96651cb97..7ec69a1140cf 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1846,6 +1846,7 @@ static void migrate_read_unlock(struct zspage *zspage) __releases(&zspage->lock)
}

static void migrate_write_lock(struct zspage *zspage)
+ __acquires(&zspage->lock)
{
write_lock(&zspage->lock);
}
--
2.24.1

2020-02-23 23:20:02

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 13/30] net: netrom: Add missing annotation for nr_neigh_stop()

Sparse reports a warning at nr_neigh_stop()
warning: context imbalance in nr_neigh_stop() - unexpected unlock
The root cause is the missing annotation at nr_neigh_stop()
Add the missing __releases(&nr_neigh_list_lock) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
net/netrom/nr_route.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index 33e7b91fc805..79f12d8c7b86 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -907,6 +907,7 @@ static void *nr_neigh_next(struct seq_file *seq, void *v, loff_t *pos)
}

static void nr_neigh_stop(struct seq_file *seq, void *v)
+ __releases(&nr_neigh_list_lock)
{
spin_unlock_bh(&nr_neigh_list_lock);
}
--
2.24.1

2020-02-23 23:20:04

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 12/30] net: netrom: Add missing annotation for nr_neigh_start()

Sparse reports a warning at nr_neigh_start()
warning: context imbalance in nr_neigh_start() - wrong count at exit
The root cause is the missing annotation at nr_neigh_start()
Add the missing __acquires(&nr_neigh_list_lock) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
net/netrom/nr_route.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index 637a743c060d..33e7b91fc805 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -895,6 +895,7 @@ const struct seq_operations nr_node_seqops = {
};

static void *nr_neigh_start(struct seq_file *seq, loff_t *pos)
+ __acquires(&nr_neigh_list_lock)
{
spin_lock_bh(&nr_neigh_list_lock);
return seq_hlist_start_head(&nr_neigh_list, *pos);
--
2.24.1

2020-02-23 23:20:08

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 06/30] sctp: Add missing annotation for sctp_transport_walk_stop()

Sparse reports a warning at sctp_transport_walk_stop()

warning: context imbalance in sctp_transport_walk_stop
- wrong count at exit

The root cause is the missing annotation at sctp_transport_walk_stop()
Add the missing __releases(RCU) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
net/sctp/socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 05be67bb0474..fed26a1e9518 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5340,7 +5340,7 @@ void sctp_transport_walk_start(struct rhashtable_iter *iter) __acquires(RCU)
rhashtable_walk_start(iter);
}

-void sctp_transport_walk_stop(struct rhashtable_iter *iter)
+void sctp_transport_walk_stop(struct rhashtable_iter *iter) __releases(RCU)
{
rhashtable_walk_stop(iter);
rhashtable_walk_exit(iter);
--
2.24.1

2020-02-23 23:20:18

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 30/30] sgi-xp: Add missing annotation for ocfs2_inode_cache_lock() and ocfs2_inode_cache_unlock()

Sparse reports a warning at ocfs2_inode_cache_lock()
and ocfs2_inode_cache_unlock()
warning: context imbalance in ocfs2_inode_cache_lock()
- wrong count at exit

warning: context imbalance in ocfs2_inode_cache_unlock()
- unexpected unlock
The root cause is a missing annotation at ocfs2_inode_cache_lock()
and at ocfs2_inode_cache_unlock()

Add the missing __acquires(&oi->ip_lock) annotation
Add the missing __releases(&oi->ip_lock) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
fs/ocfs2/inode.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 7c9dfd50c1c1..0b87e0a63ab9 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -1623,6 +1623,7 @@ static struct super_block *ocfs2_inode_cache_get_super(struct ocfs2_caching_info
}

static void ocfs2_inode_cache_lock(struct ocfs2_caching_info *ci)
+ __acquires(&oi->ip_lock)
{
struct ocfs2_inode_info *oi = cache_info_to_inode(ci);

@@ -1630,6 +1631,7 @@ static void ocfs2_inode_cache_lock(struct ocfs2_caching_info *ci)
}

static void ocfs2_inode_cache_unlock(struct ocfs2_caching_info *ci)
+ __releases(&oi->ip_lock)
{
struct ocfs2_inode_info *oi = cache_info_to_inode(ci);

--
2.24.1

2020-02-23 23:20:25

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 26/30] zram: Add missing annotatin for zram_slot_unlock()

Sparse reports a warning at zram_slot_unlock()
warning: context imbalance in zram_slot_unlock() - unexpected unlock
The root cause is the missing annotation at zram_slot_unlock()
Add the missing __releases(ZRAM_LOCK) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
drivers/block/zram/zram_drv.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 1462b1bfec11..a38725452966 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -68,6 +68,7 @@ static void zram_slot_lock(struct zram *zram, u32 index)
}

static void zram_slot_unlock(struct zram *zram, u32 index)
+ __releases(ZRAM_LOCK)
{
bit_spin_unlock(ZRAM_LOCK, &zram->table[index].flags);
}
--
2.24.1

2020-02-23 23:20:29

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 23/30] ACPI: OSL: Add missing annotation for acpi_os_release_lock()

Sparse reports a warning at acpi_os_release_lock()

warning: context imbalance in acpi_os_release_lock() - unexpected unlock

The root cause is the missing annotation at acpi_os_release_lock()
Add the missing annotation __releases(lockp)

Signed-off-by: Jules Irenge <[email protected]>
---
drivers/acpi/osl.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 7094abc5ffc6..762c5d50b8fe 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1610,6 +1610,7 @@ acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp)
*/

void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags)
+ __releases(lockp)
{
spin_unlock_irqrestore(lockp, flags);
}
--
2.24.1

2020-02-23 23:20:32

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 08/30] netrom: Add missing annotation for nr_info_start()

Sparse reports a warning at nr_info_start()
warning: context imbalance in nr_info_start() - wrong count at exit
The root cause is the missing annotation at nr_info_start()
Add the missing __acquires(&nr_list_lock)

Signed-off-by: Jules Irenge <[email protected]>
---
net/netrom/af_netrom.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 58d5373c513c..8be06e61ff03 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -1230,6 +1230,7 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
#ifdef CONFIG_PROC_FS

static void *nr_info_start(struct seq_file *seq, loff_t *pos)
+ __acquires(&nr_list_lock)
{
spin_lock_bh(&nr_list_lock);
return seq_hlist_start_head(&nr_list, *pos);
--
2.24.1

2020-02-23 23:20:37

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 07/30] net: Add missing annotation for llc_seq_start()

Sparse reports a warning at llc_seq_start()

warning: context imbalance in llc_seq_start() - wrong count at exit
The root cause is the msiing annotation at llc_seq_start()

Add the missing __acquires(RCU) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
net/llc/llc_proc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c
index f3a36c16a5e7..a4eccb98220a 100644
--- a/net/llc/llc_proc.c
+++ b/net/llc/llc_proc.c
@@ -56,7 +56,7 @@ static struct sock *llc_get_sk_idx(loff_t pos)
return sk;
}

-static void *llc_seq_start(struct seq_file *seq, loff_t *pos)
+static void *llc_seq_start(struct seq_file *seq, loff_t *pos) __acquires(RCU)
{
loff_t l = *pos;

--
2.24.1

2020-02-23 23:20:42

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 09/30] netrom: Add missing annotation for nr_info_stop()

Sparse reports a warning at nr_info_stop()
warning: context imbalance in nr_info_stop() - unexpected unlock
The root cause is the missing annotation at nr_info_stop()
Add the missing __releases(&nr_list_lock)

Signed-off-by: Jules Irenge <[email protected]>
---
net/netrom/af_netrom.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 8be06e61ff03..7b1a74f74aad 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -1242,6 +1242,7 @@ static void *nr_info_next(struct seq_file *seq, void *v, loff_t *pos)
}

static void nr_info_stop(struct seq_file *seq, void *v)
+ __releases(&nr_list_lock)
{
spin_unlock_bh(&nr_list_lock);
}
--
2.24.1

2020-02-23 23:20:50

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 05/30] sctp: Add missing annotation for sctp_transport_walk_start()

Sparse reports a warning at sctp_transport_walk_start()

warning: context imbalance in sctp_transport_walk_start
- wrong count at exit

The root cause is the missing annotation at sctp_transport_walk_start()
Add the missing __acquires(RCU) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
net/sctp/socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 1b56fc440606..05be67bb0474 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5333,7 +5333,7 @@ int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc,
EXPORT_SYMBOL_GPL(sctp_get_sctp_info);

/* use callback to avoid exporting the core structure */
-void sctp_transport_walk_start(struct rhashtable_iter *iter)
+void sctp_transport_walk_start(struct rhashtable_iter *iter) __acquires(RCU)
{
rhltable_walk_enter(&sctp_transport_hashtable, iter);

--
2.24.1

2020-02-23 23:20:51

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 18/30] mm/zsmalloc: Add missing annotation for zs_unmap_object()

Sparse reports a warning at zs_unmap_object()
context imbalance in zs_unmap_object() - unexpected unlock
The root cause is the missing annotation at zs_unmap_object()
Add the missing __releases(zspage)

Signed-off-by: Jules Irenge <[email protected]>
---
mm/zsmalloc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 9d3f9b3d22aa..10a96651cb97 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1349,6 +1349,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle,
EXPORT_SYMBOL_GPL(zs_map_object);

void zs_unmap_object(struct zs_pool *pool, unsigned long handle)
+ __releases(zspage)
{
struct zspage *zspage;
struct page *page;
--
2.24.1

2020-02-23 23:20:58

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 17/30] mm/zsmalloc: Add missing annotation for zs_map_object()

Sparse reports a warning at zs_map_object()
context imbalance in zs_map_object() - wrong count at exit
The root cause is the missing annotation at zs_map_object()
Add the missing __acquires(zspage)

Signed-off-by: Jules Irenge <[email protected]>
---
mm/zsmalloc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 2aa2d524a343..9d3f9b3d22aa 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1290,6 +1290,7 @@ EXPORT_SYMBOL_GPL(zs_get_total_pages);
*/
void *zs_map_object(struct zs_pool *pool, unsigned long handle,
enum zs_mapmode mm)
+ __acquires(zspage)
{
struct zspage *zspage;
struct page *page;
--
2.24.1

2020-02-23 23:20:59

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 11/30] net: netrom: Add missing annotation for nr_node_stop()

Sparse reports a warning at nr_node_stop()
warning: context imbalance in nr_node_stop() - wrong count at exit
The root cause is the missing annotation at nr_node_stop()
Add the missing __releases(&nr_node_list_lock) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
net/netrom/nr_route.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index fe278fc24153..637a743c060d 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -850,6 +850,7 @@ static void *nr_node_next(struct seq_file *seq, void *v, loff_t *pos)
}

static void nr_node_stop(struct seq_file *seq, void *v)
+ __releases(&nr_node_list_lock)
{
spin_unlock_bh(&nr_node_list_lock);
}
--
2.24.1

2020-02-23 23:21:10

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 10/30] net: netrom: Add missing annotation for nr_node_start()

Sparse reports a warning at nr_node_start()
warning: context imbalance in nr_node_start() - wrong count at exit
The root cause is the missing annotation at nr_node_start()
Add the missing __acquires(&nr_node_list_lock) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
net/netrom/nr_route.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index d41335bad1f8..fe278fc24153 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -838,6 +838,7 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)
#ifdef CONFIG_PROC_FS

static void *nr_node_start(struct seq_file *seq, loff_t *pos)
+ __acquires(&nr_node_list_lock)
{
spin_lock_bh(&nr_node_list_lock);
return seq_hlist_start_head(&nr_node_list, *pos);
--
2.24.1

2020-02-23 23:21:50

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 02/30] dax: Add missing annotations ofr dax_read_lock() and dax_read_unlock()

Sparse reports warning at dax_read_lock() and at dax_read_unlock()

warning: context imbalance in dax_read_lock() - wrong count at exit
warning: context imbalance in dax_read_unlock() - unexpected unlock

The root cause is the mnissing annotations at dax_read_lock()
and dax_read_unlock()

Add the missing __acquires(&dax_srcu) notations to dax_read_lock()
Add the missing __releases(&dax_srcu) annotation to dax_read_unlock()

Signed-off-by: Jules Irenge <[email protected]>
---
drivers/dax/super.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index 26a654dbc69a..f872a2fb98d4 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -28,13 +28,13 @@ static struct super_block *dax_superblock __read_mostly;
static struct hlist_head dax_host_list[DAX_HASH_SIZE];
static DEFINE_SPINLOCK(dax_host_lock);

-int dax_read_lock(void)
+int dax_read_lock(void) __acquires(&dax_srcu)
{
return srcu_read_lock(&dax_srcu);
}
EXPORT_SYMBOL_GPL(dax_read_lock);

-void dax_read_unlock(int id)
+void dax_read_unlock(int id) __releases(&dax_srcu)
{
srcu_read_unlock(&dax_srcu, id);
}
--
2.24.1

2020-02-23 23:21:55

by Jules Irenge

[permalink] [raw]
Subject: [PATCH 03/30] xfs: Add missing annotation to xfs_ail_check()

Sparse reports a warning at xfs_ail_check()

warning: context imbalance in xfs_ail_check() - unexpected unlock

The root cause is the missing annotation at xfs_ail_check()

Add the missing __must_hold(&ailp->ail_lock) annotation

Signed-off-by: Jules Irenge <[email protected]>
---
fs/xfs/xfs_trans_ail.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 00cc5b8734be..58d4ef1b4c05 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -32,6 +32,7 @@ STATIC void
xfs_ail_check(
struct xfs_ail *ailp,
struct xfs_log_item *lip)
+ __must_hold(&ailp->ail_lock)
{
struct xfs_log_item *prev_lip;
struct xfs_log_item *next_lip;
--
2.24.1

2020-02-23 23:28:37

by Nikolay Borisov

[permalink] [raw]
Subject: Re: [PATCH 01/30] btrfs: Add missing annotation for release_extent_buffer()



On 24.02.20 г. 1:16 ч., Jules Irenge wrote:
> Sparse reports a warning at release_extent_buffer()
> warning: context imbalance in release_extent_buffer() - unexpected unlock
>
> The root cause is the missing annotation at release_extent_buffer()
> Add the missing __releases(&eb->refs_lock) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Reviewed-by: Nikolay Borisov <[email protected]>

2020-02-24 01:24:21

by Yi Zhang

[permalink] [raw]
Subject: Re: [PATCH 02/30] dax: Add missing annotations ofr dax_read_lock() and dax_read_unlock()



On 2/24/20 7:16 AM, Jules Irenge wrote:
> Sparse reports warning at dax_read_lock() and at dax_read_unlock()
>
> warning: context imbalance in dax_read_lock() - wrong count at exit
> warning: context imbalance in dax_read_unlock() - unexpected unlock
>
> The root cause is the mnissing annotations at dax_read_lock()
> and dax_read_unlock()
s/mnissing/missing
> Add the missing __acquires(&dax_srcu) notations to dax_read_lock()
> Add the missing __releases(&dax_srcu) annotation to dax_read_unlock()
>
> Signed-off-by: Jules Irenge <[email protected]>
> ---
> drivers/dax/super.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> index 26a654dbc69a..f872a2fb98d4 100644
> --- a/drivers/dax/super.c
> +++ b/drivers/dax/super.c
> @@ -28,13 +28,13 @@ static struct super_block *dax_superblock __read_mostly;
> static struct hlist_head dax_host_list[DAX_HASH_SIZE];
> static DEFINE_SPINLOCK(dax_host_lock);
>
> -int dax_read_lock(void)
> +int dax_read_lock(void) __acquires(&dax_srcu)
> {
> return srcu_read_lock(&dax_srcu);
> }
> EXPORT_SYMBOL_GPL(dax_read_lock);
>
> -void dax_read_unlock(int id)
> +void dax_read_unlock(int id) __releases(&dax_srcu)
> {
> srcu_read_unlock(&dax_srcu, id);
> }

2020-02-24 01:53:22

by Joseph Qi

[permalink] [raw]
Subject: Re: [PATCH 30/30] sgi-xp: Add missing annotation for ocfs2_inode_cache_lock() and ocfs2_inode_cache_unlock()



On 2020/2/24 07:17, Jules Irenge wrote:
> Sparse reports a warning at ocfs2_inode_cache_lock()
> and ocfs2_inode_cache_unlock()
> warning: context imbalance in ocfs2_inode_cache_lock()
> - wrong count at exit
>
> warning: context imbalance in ocfs2_inode_cache_unlock()
> - unexpected unlock
> The root cause is a missing annotation at ocfs2_inode_cache_lock()
> and at ocfs2_inode_cache_unlock()
>
> Add the missing __acquires(&oi->ip_lock) annotation
> Add the missing __releases(&oi->ip_lock) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Looks good.
BTW, there are another co_cache_[lock|unlock] implementations also
miss the annotations:
ocfs2_refcount_cache_lock
ocfs2_refcount_cache_unlock
So could we add the missing annotations as well?

Thanks,
Joseph

> ---
> fs/ocfs2/inode.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
> index 7c9dfd50c1c1..0b87e0a63ab9 100644
> --- a/fs/ocfs2/inode.c
> +++ b/fs/ocfs2/inode.c
> @@ -1623,6 +1623,7 @@ static struct super_block *ocfs2_inode_cache_get_super(struct ocfs2_caching_info
> }
>
> static void ocfs2_inode_cache_lock(struct ocfs2_caching_info *ci)
> + __acquires(&oi->ip_lock)
> {
> struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
>
> @@ -1630,6 +1631,7 @@ static void ocfs2_inode_cache_lock(struct ocfs2_caching_info *ci)
> }
>
> static void ocfs2_inode_cache_unlock(struct ocfs2_caching_info *ci)
> + __releases(&oi->ip_lock)
> {
> struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
>
>

2020-02-24 15:20:43

by David Sterba

[permalink] [raw]
Subject: Re: [PATCH 01/30] btrfs: Add missing annotation for release_extent_buffer()

On Sun, Feb 23, 2020 at 11:16:42PM +0000, Jules Irenge wrote:
> Sparse reports a warning at release_extent_buffer()
> warning: context imbalance in release_extent_buffer() - unexpected unlock
>
> The root cause is the missing annotation at release_extent_buffer()
> Add the missing __releases(&eb->refs_lock) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Added to misc-next, thanks.

2020-02-24 21:29:08

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 04/30] sctp: Add missing annotation for sctp_err_finish()

From: Jules Irenge <[email protected]>
Date: Sun, 23 Feb 2020 23:16:45 +0000

> Sparse reports a warning at sctp_err_finish()
> warning: context imbalance in sctp_err_finish() - unexpected unlock
>
> The root cause is a missing annotation at sctp_err_finish()
> Add the missing __releases(&((__sk)->sk_lock.slock)) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Applied.

2020-02-24 21:29:22

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 05/30] sctp: Add missing annotation for sctp_transport_walk_start()

From: Jules Irenge <[email protected]>
Date: Sun, 23 Feb 2020 23:16:46 +0000

> Sparse reports a warning at sctp_transport_walk_start()
>
> warning: context imbalance in sctp_transport_walk_start
> - wrong count at exit
>
> The root cause is the missing annotation at sctp_transport_walk_start()
> Add the missing __acquires(RCU) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Applied.

2020-02-24 21:29:29

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 06/30] sctp: Add missing annotation for sctp_transport_walk_stop()

From: Jules Irenge <[email protected]>
Date: Sun, 23 Feb 2020 23:16:47 +0000

> Sparse reports a warning at sctp_transport_walk_stop()
>
> warning: context imbalance in sctp_transport_walk_stop
> - wrong count at exit
>
> The root cause is the missing annotation at sctp_transport_walk_stop()
> Add the missing __releases(RCU) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Applied.

2020-02-24 21:29:42

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 07/30] net: Add missing annotation for llc_seq_start()

From: Jules Irenge <[email protected]>
Date: Sun, 23 Feb 2020 23:16:48 +0000

> Sparse reports a warning at llc_seq_start()
>
> warning: context imbalance in llc_seq_start() - wrong count at exit
> The root cause is the msiing annotation at llc_seq_start()
>
> Add the missing __acquires(RCU) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Applied.

2020-02-24 21:29:51

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 09/30] netrom: Add missing annotation for nr_info_stop()

From: Jules Irenge <[email protected]>
Date: Sun, 23 Feb 2020 23:16:50 +0000

> Sparse reports a warning at nr_info_stop()
> warning: context imbalance in nr_info_stop() - unexpected unlock
> The root cause is the missing annotation at nr_info_stop()
> Add the missing __releases(&nr_list_lock)
>
> Signed-off-by: Jules Irenge <[email protected]>

Applied.

2020-02-24 21:29:57

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 10/30] net: netrom: Add missing annotation for nr_node_start()

From: Jules Irenge <[email protected]>
Date: Sun, 23 Feb 2020 23:16:51 +0000

> Sparse reports a warning at nr_node_start()
> warning: context imbalance in nr_node_start() - wrong count at exit
> The root cause is the missing annotation at nr_node_start()
> Add the missing __acquires(&nr_node_list_lock) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Applied.

2020-02-24 21:29:58

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 11/30] net: netrom: Add missing annotation for nr_node_stop()

From: Jules Irenge <[email protected]>
Date: Sun, 23 Feb 2020 23:16:52 +0000

> Sparse reports a warning at nr_node_stop()
> warning: context imbalance in nr_node_stop() - wrong count at exit
> The root cause is the missing annotation at nr_node_stop()
> Add the missing __releases(&nr_node_list_lock) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Applied.

2020-02-24 21:30:05

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 13/30] net: netrom: Add missing annotation for nr_neigh_stop()

From: Jules Irenge <[email protected]>
Date: Sun, 23 Feb 2020 23:16:54 +0000

> Sparse reports a warning at nr_neigh_stop()
> warning: context imbalance in nr_neigh_stop() - unexpected unlock
> The root cause is the missing annotation at nr_neigh_stop()
> Add the missing __releases(&nr_neigh_list_lock) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Applied.

2020-02-24 21:30:43

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 08/30] netrom: Add missing annotation for nr_info_start()

From: Jules Irenge <[email protected]>
Date: Sun, 23 Feb 2020 23:16:49 +0000

> Sparse reports a warning at nr_info_start()
> warning: context imbalance in nr_info_start() - wrong count at exit
> The root cause is the missing annotation at nr_info_start()
> Add the missing __acquires(&nr_list_lock)
>
> Signed-off-by: Jules Irenge <[email protected]>

Applied.

2020-02-24 21:31:12

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 14/30] dccp: Add missing annotation for dccp_child_process()

From: Jules Irenge <[email protected]>
Date: Sun, 23 Feb 2020 23:16:55 +0000

> Sparse reports a warning at dccp_child_process()
> warning: context imbalance in dccp_child_process() - unexpected unlock
> The root cause is the missing annotation at dccp_child_process()
> Add the missing __releases(child) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Applied.

2020-02-24 21:31:15

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 15/30] af_unix: Add missing annotation for unix_wait_for_peer()

From: Jules Irenge <[email protected]>
Date: Sun, 23 Feb 2020 23:16:56 +0000

> Sparse reports a warning unix_wait_for_peer()
>
> warning: context imbalance in unix_wait_for_peer() - unexpected unlock
>
> The root cause is the missing annotation at unix_wait_for_peer()
> Add the missing annotation __releases(&unix_sk(other)->lock)
>
> Signed-off-by: Jules Irenge <[email protected]>

Applied.

2020-02-24 21:31:26

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 12/30] net: netrom: Add missing annotation for nr_neigh_start()

From: Jules Irenge <[email protected]>
Date: Sun, 23 Feb 2020 23:16:53 +0000

> Sparse reports a warning at nr_neigh_start()
> warning: context imbalance in nr_neigh_start() - wrong count at exit
> The root cause is the missing annotation at nr_neigh_start()
> Add the missing __acquires(&nr_neigh_list_lock) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Applied.

2020-02-25 00:56:17

by Joseph Qi

[permalink] [raw]
Subject: Re: [PATCH 30/30] sgi-xp: Add missing annotation for ocfs2_inode_cache_lock() and ocfs2_inode_cache_unlock()



On 2020/2/24 07:17, Jules Irenge wrote:
> Sparse reports a warning at ocfs2_inode_cache_lock()
> and ocfs2_inode_cache_unlock()
> warning: context imbalance in ocfs2_inode_cache_lock()
> - wrong count at exit
>
> warning: context imbalance in ocfs2_inode_cache_unlock()
> - unexpected unlock
> The root cause is a missing annotation at ocfs2_inode_cache_lock()
> and at ocfs2_inode_cache_unlock()
>
> Add the missing __acquires(&oi->ip_lock) annotation
> Add the missing __releases(&oi->ip_lock) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Acked-by: Joseph Qi <[email protected]>
> ---
> fs/ocfs2/inode.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
> index 7c9dfd50c1c1..0b87e0a63ab9 100644
> --- a/fs/ocfs2/inode.c
> +++ b/fs/ocfs2/inode.c
> @@ -1623,6 +1623,7 @@ static struct super_block *ocfs2_inode_cache_get_super(struct ocfs2_caching_info
> }
>
> static void ocfs2_inode_cache_lock(struct ocfs2_caching_info *ci)
> + __acquires(&oi->ip_lock)
> {
> struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
>
> @@ -1630,6 +1631,7 @@ static void ocfs2_inode_cache_lock(struct ocfs2_caching_info *ci)
> }
>
> static void ocfs2_inode_cache_unlock(struct ocfs2_caching_info *ci)
> + __releases(&oi->ip_lock)
> {
> struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
>
>

2020-02-25 12:12:28

by Oded Gabbay

[permalink] [raw]
Subject: Re: [PATCH 27/30] habanalabs: Add missing annotation for goya_hw_queues_lock()

On Mon, Feb 24, 2020 at 1:18 AM Jules Irenge <[email protected]> wrote:
>
> Sparse reports a warning at goya_hw_queues_lock()
> warning: context imbalance in goya_hw_queues_lock() - wrong count at exit
> The root cause is a missing annotation at goya_hw_queues_lock()
> Add the missing __acquires(&goya->hw_queues_lock) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>
> ---
> drivers/misc/habanalabs/goya/goya.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c
> index 7344e8a222ae..8ca7ee57cbc1 100644
> --- a/drivers/misc/habanalabs/goya/goya.c
> +++ b/drivers/misc/habanalabs/goya/goya.c
> @@ -5073,6 +5073,7 @@ static bool goya_is_device_idle(struct hl_device *hdev, u32 *mask,
> }
>
> static void goya_hw_queues_lock(struct hl_device *hdev)
> + __acquires(&goya->hw_queues_lock)
> {
> struct goya_device *goya = hdev->asic_specific;
>
> --
> 2.24.1
>
This patch is:
Reviewed-by: Oded Gabbay <[email protected]>
Applied to -next
Thanks,
Oded

2020-02-25 12:13:43

by Oded Gabbay

[permalink] [raw]
Subject: Re: [PATCH 28/30] habanalabs: Add missing annotation for goya_hw_queues_unlock()

On Mon, Feb 24, 2020 at 1:18 AM Jules Irenge <[email protected]> wrote:
>
> Sparse reports a warning at goya_hw_queues_unlock()
> warning: context imbalance in goya_hw_queues_unlock() - unexpected unlock
> The root cause is a missing annotation at goya_hw_queues_unlock()
> Add the missing __releases(&goya->hw_queues_lock) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>
> ---
> drivers/misc/habanalabs/goya/goya.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c
> index 8ca7ee57cbc1..6138b461d0f8 100644
> --- a/drivers/misc/habanalabs/goya/goya.c
> +++ b/drivers/misc/habanalabs/goya/goya.c
> @@ -5081,6 +5081,7 @@ static void goya_hw_queues_lock(struct hl_device *hdev)
> }
>
> static void goya_hw_queues_unlock(struct hl_device *hdev)
> + __releases(&goya->hw_queues_lock)
> {
> struct goya_device *goya = hdev->asic_specific;
>
> --
> 2.24.1
>
This patch is:
Reviewed-by: Oded Gabbay <[email protected]>
Applied to -next
Thanks,
Oded

2020-02-25 16:05:43

by Darrick J. Wong

[permalink] [raw]
Subject: Re: [PATCH 03/30] xfs: Add missing annotation to xfs_ail_check()

On Sun, Feb 23, 2020 at 11:16:44PM +0000, Jules Irenge wrote:
> Sparse reports a warning at xfs_ail_check()
>
> warning: context imbalance in xfs_ail_check() - unexpected unlock
>
> The root cause is the missing annotation at xfs_ail_check()
>
> Add the missing __must_hold(&ailp->ail_lock) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>

Seems reasonable, though I'm wondering if this is a treewide change you
seek to apply yourself, or merely a large patch series to merge through
the individual subsystem maintainers?

Reviewed-by: Darrick J. Wong <[email protected]>

--D

> ---
> fs/xfs/xfs_trans_ail.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
> index 00cc5b8734be..58d4ef1b4c05 100644
> --- a/fs/xfs/xfs_trans_ail.c
> +++ b/fs/xfs/xfs_trans_ail.c
> @@ -32,6 +32,7 @@ STATIC void
> xfs_ail_check(
> struct xfs_ail *ailp,
> struct xfs_log_item *lip)
> + __must_hold(&ailp->ail_lock)
> {
> struct xfs_log_item *prev_lip;
> struct xfs_log_item *next_lip;
> --
> 2.24.1
>

2020-02-28 19:23:02

by Robin Holt

[permalink] [raw]
Subject: Re: [PATCH 29/30] sgi-xp: Add missing annotation for xpc_disconnect_channel()

On Sun, Feb 23, 2020 at 5:18 PM Jules Irenge <[email protected]> wrote:
>
> Sparse reports a warning at xpc_disconnect_channel()
> warning: context imbalance in xpc_disconnect_channel() - unexpected unlock
> The root cause is a missing annotation at xpc_disconnect_channel()
> Add the missing __must_hold(&ch->lock) annotation
>
> Signed-off-by: Jules Irenge <[email protected]>
Acked-by: Robin Holt <[email protected]>

2020-03-04 11:02:06

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH 22/30] ACPI: OSL: Add missing annotation for acpi_os_acquire_lock()

On Monday, February 24, 2020 12:17:03 AM CET Jules Irenge wrote:
> Sparse reports a warning at acpi_os_acquire_lock()
>
> warning: context imbalance in acpi_os_acquire_lock() - unexpected unlock
>
> The root cause is the missing annotation at acpi_os_acquire_lock()
> Add the missing annotation __acquires(lockp)
>
> Signed-off-by: Jules Irenge <[email protected]>
> ---
> drivers/acpi/osl.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index 41168c027a5a..7094abc5ffc6 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -1598,6 +1598,7 @@ void acpi_os_delete_lock(acpi_spinlock handle)
> */
>
> acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp)
> + __acquires(lockp)
> {
> acpi_cpu_flags flags;
> spin_lock_irqsave(lockp, flags);
>

Merged with the [23/30] and applied with modified subject and changelog as
5.7 material.

Thanks!