2019-08-30 23:19:43

by Joel Fernandes

[permalink] [raw]
Subject: [PATCH 2/2] ipc/sem: Convert to use built-in RCU list checking

CONFIG_PROVE_RCU_LIST requires list_for_each_entry_rcu() to pass a
lockdep expression if using srcu or locking for protection. It can only
check regular RCU protection, all other protection needs to be passed as
lockdep expression.

Signed-off-by: Joel Fernandes (Google) <[email protected]>
---
ipc/sem.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ipc/sem.c b/ipc/sem.c
index 7da4504bcc7c..ec97a7072413 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1852,7 +1852,8 @@ static struct sem_undo *__lookup_undo(struct sem_undo_list *ulp, int semid)
{
struct sem_undo *un;

- list_for_each_entry_rcu(un, &ulp->list_proc, list_proc) {
+ list_for_each_entry_rcu(un, &ulp->list_proc, list_proc,
+ spin_is_locked(&ulp->lock)) {
if (un->semid == semid)
return un;
}
--
2.23.0.187.g17f5b7556c-goog


2019-09-04 05:11:56

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 2/2] ipc/sem: Convert to use built-in RCU list checking

Hi "Joel,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc7 next-20190903]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Joel-Fernandes-Google/pci-Convert-to-use-built-in-RCU-list-checking/20190901-211013
config: x86_64-rhel-7.6 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>

All error/warnings (new ones prefixed by >>):

ipc/sem.c: In function '__lookup_undo':
>> ipc/sem.c:1856:31: error: macro "list_for_each_entry_rcu" passed 4 arguments, but takes just 3
spin_is_locked(&ulp->lock)) {
^
>> ipc/sem.c:1855:2: error: 'list_for_each_entry_rcu' undeclared (first use in this function); did you mean 'class_for_each_device'?
list_for_each_entry_rcu(un, &ulp->list_proc, list_proc,
^~~~~~~~~~~~~~~~~~~~~~~
class_for_each_device
ipc/sem.c:1855:2: note: each undeclared identifier is reported only once for each function it appears in
>> ipc/sem.c:1856:33: error: expected ';' before '{' token
spin_is_locked(&ulp->lock)) {
^
ipc/sem.c:1853:19: warning: unused variable 'un' [-Wunused-variable]
struct sem_undo *un;
^~
>> ipc/sem.c:1861:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^

vim +/list_for_each_entry_rcu +1856 ipc/sem.c

1850
1851 static struct sem_undo *__lookup_undo(struct sem_undo_list *ulp, int semid)
1852 {
1853 struct sem_undo *un;
1854
> 1855 list_for_each_entry_rcu(un, &ulp->list_proc, list_proc,
> 1856 spin_is_locked(&ulp->lock)) {
1857 if (un->semid == semid)
1858 return un;
1859 }
1860 return NULL;
> 1861 }
1862

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (2.20 kB)
.config.gz (46.89 kB)
Download all attachments