diff mbox

[v2] don't forget to call pd_online_fn when activate policy

Message ID 1489026008-161611-1-git-send-email-zhouchengming1@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhou Chengming March 9, 2017, 2:20 a.m. UTC
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 <zhouchengming1@huawei.com>
---
 block/blk-cgroup.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

kernel test robot March 10, 2017, 12:44 p.m. UTC | #1
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
Jens Axboe March 10, 2017, 3:12 p.m. UTC | #2
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 <zhouchengming1@huawei.com>
> ---
>  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?
Zhou Chengming March 11, 2017, 3:46 a.m. UTC | #3
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<zhouchengming1@huawei.com>
>> ---
>>   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..
Jens Axboe March 11, 2017, 3:59 a.m. UTC | #4
> On Mar 10, 2017, at 8:46 PM, zhouchengming <zhouchengming1@huawei.com> 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<zhouchengming1@huawei.com>
>>> ---
>>>  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.
diff mbox

Patch

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);