2017-03-09 02:24:21

by Zhou Chengming

[permalink] [raw]
Subject: [PATCH v2] don't forget to call pd_online_fn when activate policy

When we activate policy on the request_queue, we will create policy_date
for all the existing blkgs of the request_queue, so we should call
pd_init_fn() and pd_online_fn() on these newly created policy_data.

Signed-off-by: Zhou Chengming <[email protected]>
---
block/blk-cgroup.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 8ba0af7..0dd9e76 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1254,6 +1254,12 @@ int blkcg_activate_policy(struct request_queue *q,
pd->plid = pol->plid;
if (pol->pd_init_fn)
pol->pd_init_fn(pd);
+
+ if (pol->pd_online_fn) {
+ spin_lock(blkg->blkcg->lock);
+ pol->pd_online_fn(pd);
+ spin_unlock(blkg->blkcg->lock);
+ }
}

__set_bit(pol->plid, q->blkcg_pols);
--
1.8.3.1


2017-03-10 12:45:16

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2] don't forget to call pd_online_fn when activate policy

Hi Zhou,

[auto build test ERROR on block/for-next]
[also build test ERROR on v4.11-rc1 next-20170309]
[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/Zhou-Chengming/don-t-forget-to-call-pd_online_fn-when-activate-policy/20170310-140301
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: x86_64-rhel-7.2 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All errors (new ones prefixed by >>):

block/blk-cgroup.c: In function 'blkcg_activate_policy':
>> block/blk-cgroup.c:1261:14: error: incompatible type for argument 1 of 'spin_lock'
spin_lock(blkg->blkcg->lock);
^~~~
In file included from include/linux/rcupdate.h:38:0,
from include/linux/rculist.h:10,
from include/linux/pid.h:4,
from include/linux/sched.h:13,
from include/linux/ioprio.h:4,
from block/blk-cgroup.c:17:
include/linux/spinlock.h:297:29: note: expected 'spinlock_t * {aka struct spinlock *}' but argument is of type 'spinlock_t {aka struct spinlock}'
static __always_inline void spin_lock(spinlock_t *lock)
^~~~~~~~~
>> block/blk-cgroup.c:1263:16: error: incompatible type for argument 1 of 'spin_unlock'
spin_unlock(blkg->blkcg->lock);
^~~~
In file included from include/linux/rcupdate.h:38:0,
from include/linux/rculist.h:10,
from include/linux/pid.h:4,
from include/linux/sched.h:13,
from include/linux/ioprio.h:4,
from block/blk-cgroup.c:17:
include/linux/spinlock.h:337:29: note: expected 'spinlock_t * {aka struct spinlock *}' but argument is of type 'spinlock_t {aka struct spinlock}'
static __always_inline void spin_unlock(spinlock_t *lock)
^~~~~~~~~~~

vim +/spin_lock +1261 block/blk-cgroup.c

1255 pd->blkg = blkg;
1256 pd->plid = pol->plid;
1257 if (pol->pd_init_fn)
1258 pol->pd_init_fn(pd);
1259
1260 if (pol->pd_online_fn) {
> 1261 spin_lock(blkg->blkcg->lock);
1262 pol->pd_online_fn(pd);
> 1263 spin_unlock(blkg->blkcg->lock);
1264 }
1265 }
1266

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


Attachments:
(No filename) (2.57 kB)
.config.gz (37.89 kB)
Download all attachments

2017-03-10 15:12:54

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH v2] don't forget to call pd_online_fn when activate policy

On 03/08/2017 07:20 PM, Zhou Chengming wrote:
> When we activate policy on the request_queue, we will create policy_date
> for all the existing blkgs of the request_queue, so we should call
> pd_init_fn() and pd_online_fn() on these newly created policy_data.
>
> Signed-off-by: Zhou Chengming <[email protected]>
> ---
> block/blk-cgroup.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
> index 8ba0af7..0dd9e76 100644
> --- a/block/blk-cgroup.c
> +++ b/block/blk-cgroup.c
> @@ -1254,6 +1254,12 @@ int blkcg_activate_policy(struct request_queue *q,
> pd->plid = pol->plid;
> if (pol->pd_init_fn)
> pol->pd_init_fn(pd);
> +
> + if (pol->pd_online_fn) {
> + spin_lock(blkg->blkcg->lock);
> + pol->pd_online_fn(pd);
> + spin_unlock(blkg->blkcg->lock);
> + }

You didn't even compile this, did you?

--
Jens Axboe

2017-03-11 03:47:56

by Zhou Chengming

[permalink] [raw]
Subject: Re: [PATCH v2] don't forget to call pd_online_fn when activate policy

On 2017/3/10 23:12, Jens Axboe wrote:
> On 03/08/2017 07:20 PM, Zhou Chengming wrote:
>> When we activate policy on the request_queue, we will create policy_date
>> for all the existing blkgs of the request_queue, so we should call
>> pd_init_fn() and pd_online_fn() on these newly created policy_data.
>>
>> Signed-off-by: Zhou Chengming<[email protected]>
>> ---
>> block/blk-cgroup.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
>> index 8ba0af7..0dd9e76 100644
>> --- a/block/blk-cgroup.c
>> +++ b/block/blk-cgroup.c
>> @@ -1254,6 +1254,12 @@ int blkcg_activate_policy(struct request_queue *q,
>> pd->plid = pol->plid;
>> if (pol->pd_init_fn)
>> pol->pd_init_fn(pd);
>> +
>> + if (pol->pd_online_fn) {
>> + spin_lock(blkg->blkcg->lock);
>> + pol->pd_online_fn(pd);
>> + spin_unlock(blkg->blkcg->lock);
>> + }
>
> You didn't even compile this, did you?
>

Sorry for my carelessness. It's a very minor change, so I didn't compile...
I will send a patch-v3 that I have compiled. Sorry again..

2017-03-11 03:59:56

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH v2] don't forget to call pd_online_fn when activate policy


> On Mar 10, 2017, at 8:46 PM, zhouchengming <[email protected]> wrote:
>
>> On 2017/3/10 23:12, Jens Axboe wrote:
>>> On 03/08/2017 07:20 PM, Zhou Chengming wrote:
>>> When we activate policy on the request_queue, we will create policy_date
>>> for all the existing blkgs of the request_queue, so we should call
>>> pd_init_fn() and pd_online_fn() on these newly created policy_data.
>>>
>>> Signed-off-by: Zhou Chengming<[email protected]>
>>> ---
>>> block/blk-cgroup.c | 6 ++++++
>>> 1 file changed, 6 insertions(+)
>>>
>>> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
>>> index 8ba0af7..0dd9e76 100644
>>> --- a/block/blk-cgroup.c
>>> +++ b/block/blk-cgroup.c
>>> @@ -1254,6 +1254,12 @@ int blkcg_activate_policy(struct request_queue *q,
>>> pd->plid = pol->plid;
>>> if (pol->pd_init_fn)
>>> pol->pd_init_fn(pd);
>>> +
>>> + if (pol->pd_online_fn) {
>>> + spin_lock(blkg->blkcg->lock);
>>> + pol->pd_online_fn(pd);
>>> + spin_unlock(blkg->blkcg->lock);
>>> + }
>>
>> You didn't even compile this, did you?
>>
>
> Sorry for my carelessness. It's a very minor change, so I didn't compile...
> I will send a patch-v3 that I have compiled. Sorry again..

I don't care how trivial it seems. You always ALWAYS compile and test. Always. Don't ever send untested patches again, and not even compiling is unforgivable.