From patchwork Tue Mar 7 05:51:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 9608219 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A9C8760414 for ; Tue, 7 Mar 2017 07:59:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AB4E28472 for ; Tue, 7 Mar 2017 07:59:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DBBD284BA; Tue, 7 Mar 2017 07:59:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D691228472 for ; Tue, 7 Mar 2017 07:59:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754854AbdCGH7l (ORCPT ); Tue, 7 Mar 2017 02:59:41 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34970 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752384AbdCGH7g (ORCPT ); Tue, 7 Mar 2017 02:59:36 -0500 Received: by mail-pf0-f195.google.com with SMTP id 67so15890762pfg.2 for ; Mon, 06 Mar 2017 23:59:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/QE4yJe2bfsKC6jo8x52dg/CcllhO6O1ZkMsM4C+6x8=; b=QKEkJuEv41BSAyZ9L8iUIR2fz4KQiEZVod23eTMdzqmcTefinW2QM86qbnt8necHH2 9riK8/uYl7SGyIePnvmAhH/ev1I3NHNmS9+fbw+WjhH1SFkcpQTYs2Eup1u/sZbHzr+9 XmcVUBq5uluiR9+KrHlooyv33ZzClq+tNKawdxlZzcbs3/SmdmifBn1PGNHaMfgON2c2 K5X7FDodVyJyiFQBvgsLo8UJ1upb4ItBnR7wznzmn8C8ZxD6wN1X+TUa5dsc74lUT0wa JoZsFX8XXD4FnPRHDPWGWUS+l20Tz96YX1Wwaw5U0CBSDb8BGo0LKw8X1E083YHjjl/s ctgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/QE4yJe2bfsKC6jo8x52dg/CcllhO6O1ZkMsM4C+6x8=; b=WH+Txzq67AqIVrIRNVb/W4IMd1g08rbdE0tJQPekCX978l9sQbT5P0X4ZyPcD2LwsT 9Rs8qbL4HX+2DmKVG0Zjxhh6y3Bt2bixTcLMVrZDejmF7eFUWYLpSdfKNI1woavJPSd0 rLucdNuZ+l5pkaa1+BJ/VspvIWR3bG1FbpalP/X60drSkOIhNuFQ2IU61zawuK+0ff91 CYKjZHsGXb9LR56nNo54sAy01il5o6PXxyrHvzs6z9Oe3MZ8DzRrS36tiWXcRj2aDaX0 KbYcNydrtPgYx8eJNUSuwIN+C0BY0FWoLUS+1BrcU0shAsPfu8+tfvKBxcntfO5MflG1 EWwA== X-Gm-Message-State: AMke39ldLxggJMBADcW8KumBzUiLcaDMe6+ErNk2LtFV3xahW8efLGXwuzmwbDMElx5DlQ== X-Received: by 10.99.168.5 with SMTP id o5mr19643321pgf.148.1488865895999; Mon, 06 Mar 2017 21:51:35 -0800 (PST) Received: from localhost ([203.205.141.123]) by smtp.gmail.com with ESMTPSA id s21sm43192816pgg.65.2017.03.06.21.51.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 21:51:34 -0800 (PST) From: Wanpeng Li X-Google-Original-From: Wanpeng Li To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , Wanpeng Li , Juri Lelli , Thomas Gleixner , Matt Fleming Subject: [PATCH] sched/deadline: Add missing update_rq_clock() in dl_task_timer() Date: Mon, 6 Mar 2017 21:51:28 -0800 Message-Id: <1488865888-15894-1-git-send-email-wanpeng.li@hotmail.com> X-Mailer: git-send-email 2.7.4 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wanpeng Li The following warning can be triggered by hot-unplugging the CPU on which an active SCHED_DEADLINE task is running on: ------------[ cut here ]------------ WARNING: CPU: 7 PID: 0 at kernel/sched/sched.h:833 replenish_dl_entity+0x71e/0xc40 rq->clock_update_flags < RQCF_ACT_SKIP CPU: 7 PID: 0 Comm: swapper/7 Tainted: G B 4.11.0-rc1+ #24 Hardware name: LENOVO ThinkCentre M8500t-N000/SHARKBAY, BIOS FBKTC1AUS 02/16/2016 Call Trace: dump_stack+0x85/0xc4 __warn+0x172/0x1b0 warn_slowpath_fmt+0xb4/0xf0 ? __warn+0x1b0/0x1b0 ? debug_check_no_locks_freed+0x2c0/0x2c0 ? cpudl_set+0x3d/0x2b0 replenish_dl_entity+0x71e/0xc40 enqueue_task_dl+0x2ea/0x12e0 ? dl_task_timer+0x777/0x990 ? __hrtimer_run_queues+0x270/0xa50 dl_task_timer+0x316/0x990 ? enqueue_task_dl+0x12e0/0x12e0 ? enqueue_task_dl+0x12e0/0x12e0 __hrtimer_run_queues+0x270/0xa50 ? hrtimer_cancel+0x20/0x20 ? hrtimer_interrupt+0x119/0x600 hrtimer_interrupt+0x19c/0x600 ? trace_hardirqs_off+0xd/0x10 local_apic_timer_interrupt+0x74/0xe0 smp_apic_timer_interrupt+0x76/0xa0 apic_timer_interrupt+0x93/0xa0 The DL task will be migrated to a suitable later deadline rq once the DL timer fires and currnet rq is offline. The rq clock of the new rq should be updated. This patch fixes it by updating the rq clock after holding the new rq's rq lock. Cc: Juri Lelli Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Thomas Gleixner Cc: Matt Fleming Signed-off-by: Wanpeng Li Reviewed-by: Matt Fleming Reviewed-by: Daniel Bristot de Oliveira Acked-by: Juri Lelli --- kernel/sched/deadline.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 99b2c33..c6db3fd 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -638,6 +638,7 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer) lockdep_unpin_lock(&rq->lock, rf.cookie); rq = dl_task_offline_migration(rq, p); rf.cookie = lockdep_pin_lock(&rq->lock); + update_rq_clock(rq); /* * Now that the task has been migrated to the new RQ and we