From patchwork Wed Nov 13 03:42:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 21472 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 681B823FBE for ; Wed, 13 Nov 2013 03:42:25 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id 6sf11689068qeb.8 for ; Tue, 12 Nov 2013 19:42:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=mXTaW5zlqOPmQ2beOZ6x7XwpwIwDxPeq6Gon1j6WW44=; b=PdveCXpvX6RI+ROzv3YsdvQ5i3ExQLEj8ynPFeWqsDmnqDum+lJvXAZ3byaT4PkjSt osm07FzG40ROqhIt9DudPfj4sdziAtq7NGTV1QghhtUzAAHY0S+gvokRHnpTLGqdtA0i O4ad0QWAGUngAXDiAGfRHsipqbKo0vvmRdHtsNDLFxP67AUfhrAFD/HaDjl7+0wGY+wg CIeeqeai+3xLZqPjPYqY1Akc4ArnziQGRJf3m/4BCcqJoWmqgVi+t92bYi4Wd18Zq0kH mS3Gb1kTDyNxvsAlhlrb4rb8tsAdfhErN82tBio2zG4py1+huXK+Dz8lW6R4uKOzQql+ UTTg== X-Gm-Message-State: ALoCoQkQEJc3CL0Ckdl8xeDRkV35z2tmKf+b5jgdoHmoZMHH3e7FYfi/2lScC50sVHLEpnZcMh2w X-Received: by 10.58.230.73 with SMTP id sw9mr11581918vec.30.1384314144593; Tue, 12 Nov 2013 19:42:24 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.97.67 with SMTP id dy3ls363310qeb.95.gmail; Tue, 12 Nov 2013 19:42:24 -0800 (PST) X-Received: by 10.220.164.202 with SMTP id f10mr5930063vcy.25.1384314144429; Tue, 12 Nov 2013 19:42:24 -0800 (PST) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id sz7si13574167vdc.34.2013.11.12.19.42.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Nov 2013 19:42:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id jy13so2238365veb.37 for ; Tue, 12 Nov 2013 19:42:24 -0800 (PST) X-Received: by 10.58.216.74 with SMTP id oo10mr32021723vec.0.1384314144326; Tue, 12 Nov 2013 19:42:24 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp208668vcz; Tue, 12 Nov 2013 19:42:23 -0800 (PST) X-Received: by 10.66.66.202 with SMTP id h10mr40182874pat.70.1384314143293; Tue, 12 Nov 2013 19:42:23 -0800 (PST) Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by mx.google.com with ESMTPS id q7si1986819pbi.15.2013.11.12.19.42.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Nov 2013 19:42:23 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.181 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.181; Received: by mail-pd0-f181.google.com with SMTP id p10so3357069pdj.12 for ; Tue, 12 Nov 2013 19:42:22 -0800 (PST) X-Received: by 10.68.235.72 with SMTP id uk8mr39147058pbc.93.1384314142197; Tue, 12 Nov 2013 19:42:22 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id ha10sm16506429pbd.17.2013.11.12.19.42.21 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Nov 2013 19:42:21 -0800 (PST) From: John Stultz To: LKML Cc: Peter Zijlstra , Vivek Goyal , Jens Axboe , Fengguang Wu , Ingo Molnar , John Stultz Subject: [PATCH] block: Employ u64_stats_init() Date: Tue, 12 Nov 2013 19:42:14 -0800 Message-Id: <1384314134-6895-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Peter Zijlstra Now that seqcounts are lockdep enabled objects, we need to properly initialize them. Without this patch, Fengguang was seeing: [ 4.127282] INFO: trying to register non-static key. [ 4.128027] the code is fine but needs lockdep annotation. [ 4.128027] turning off the locking correctness validator. [ 4.128027] CPU: 0 PID: 96 Comm: kworker/u4:1 Not tainted 3.12.0-next-20131108-10601-gbad570d #2 [ 4.128027] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 [ 4.128027] Workqueue: events_unbound async_run_entry_fn [ 4.128027] 7908e744 00000000 78019968 79dc7cf2 7a80e0a8 780199a0 7908953e 7a1b7f4d [ 4.128027] 7a1b7fa7 7a1b7f7d 7f368608 00000000 00000011 44374011 0000a805 7f368110 [ 4.128027] 7f368110 85bf2a70 00000000 780199cc 7908a1c5 00000000 00000001 00000000 [ 4.128027] Call Trace: [ 4.128027] [<7908e744>] ? console_unlock+0x353/0x380 [ 4.128027] [<79dc7cf2>] dump_stack+0x48/0x60 [ 4.128027] [<7908953e>] __lock_acquire.isra.26+0x7e3/0xceb [ 4.128027] [<7908a1c5>] lock_acquire+0x71/0x9a [ 4.128027] [<794079aa>] ? blk_throtl_bio+0x1c3/0x485 [ 4.128027] [<7940658b>] throtl_update_dispatch_stats+0x7c/0x153 [ 4.128027] [<794079aa>] ? blk_throtl_bio+0x1c3/0x485 [ 4.128027] [<794079aa>] blk_throtl_bio+0x1c3/0x485 ... Cc: Vivek Goyal Cc: Jens Axboe Cc: Fengguang Wu Cc: Ingo Molnar Reported-by: Fengguang Wu Signed-off-by: Peter Zijlstra [jstultz: Folded in another fix from the mailing list as well as a fix to that fix. Tweaked commit message.] Signed-off-by: John Stultz --- block/blk-cgroup.h | 10 ++++++++++ block/blk-throttle.c | 10 ++++++++++ block/cfq-iosched.c | 25 +++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index ae6969a..1610b22 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h @@ -402,6 +402,11 @@ struct request_list *__blk_queue_next_rl(struct request_list *rl, #define blk_queue_for_each_rl(rl, q) \ for ((rl) = &(q)->root_rl; (rl); (rl) = __blk_queue_next_rl((rl), (q))) +static inline void blkg_stat_init(struct blkg_stat *stat) +{ + u64_stats_init(&stat->syncp); +} + /** * blkg_stat_add - add a value to a blkg_stat * @stat: target blkg_stat @@ -458,6 +463,11 @@ static inline void blkg_stat_merge(struct blkg_stat *to, struct blkg_stat *from) blkg_stat_add(to, blkg_stat_read(from)); } +static inline void blkg_rwstat_init(struct blkg_rwstat *rwstat) +{ + u64_stats_init(&rwstat->syncp); +} + /** * blkg_rwstat_add - add a value to a blkg_rwstat * @rwstat: target blkg_rwstat diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 8331aba..0653404 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -256,6 +256,12 @@ static struct throtl_data *sq_to_td(struct throtl_service_queue *sq) } \ } while (0) +static void tg_stats_init(struct tg_stats_cpu *tg_stats) +{ + blkg_rwstat_init(&tg_stats->service_bytes); + blkg_rwstat_init(&tg_stats->serviced); +} + /* * Worker for allocating per cpu stat for tgs. This is scheduled on the * system_wq once there are some groups on the alloc_list waiting for @@ -269,12 +275,16 @@ static void tg_stats_alloc_fn(struct work_struct *work) alloc_stats: if (!stats_cpu) { + int cpu; + stats_cpu = alloc_percpu(struct tg_stats_cpu); if (!stats_cpu) { /* allocation failed, try again after some time */ schedule_delayed_work(dwork, msecs_to_jiffies(10)); return; } + for_each_possible_cpu(cpu) + tg_stats_init(per_cpu_ptr(stats_cpu, cpu)); } spin_lock_irq(&tg_stats_alloc_lock); diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 434944c..4d5cec1 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -1508,6 +1508,29 @@ static void cfq_init_cfqg_base(struct cfq_group *cfqg) } #ifdef CONFIG_CFQ_GROUP_IOSCHED +static void cfqg_stats_init(struct cfqg_stats *stats) +{ + blkg_rwstat_init(&stats->service_bytes); + blkg_rwstat_init(&stats->serviced); + blkg_rwstat_init(&stats->merged); + blkg_rwstat_init(&stats->service_time); + blkg_rwstat_init(&stats->wait_time); + blkg_rwstat_init(&stats->queued); + + blkg_stat_init(&stats->sectors); + blkg_stat_init(&stats->time); + +#ifdef CONFIG_DEBUG_BLK_CGROUP + blkg_stat_init(&stats->unaccounted_time); + blkg_stat_init(&stats->avg_queue_size_sum); + blkg_stat_init(&stats->avg_queue_size_samples); + blkg_stat_init(&stats->dequeue); + blkg_stat_init(&stats->group_wait_time); + blkg_stat_init(&stats->idle_time); + blkg_stat_init(&stats->empty_time); +#endif +} + static void cfq_pd_init(struct blkcg_gq *blkg) { struct cfq_group *cfqg = blkg_to_cfqg(blkg); @@ -1515,6 +1538,8 @@ static void cfq_pd_init(struct blkcg_gq *blkg) cfq_init_cfqg_base(cfqg); cfqg->weight = blkg->blkcg->cfq_weight; cfqg->leaf_weight = blkg->blkcg->cfq_leaf_weight; + cfqg_stats_init(&cfqg->stats); + cfqg_stats_init(&cfqg->dead_stats); } static void cfq_pd_offline(struct blkcg_gq *blkg)