From patchwork Sat Oct 22 02:12:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meng Xu X-Patchwork-Id: 9390345 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 F34EB60780 for ; Sat, 22 Oct 2016 02:15:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C836729F8A for ; Sat, 22 Oct 2016 02:15:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A552B2A035; Sat, 22 Oct 2016 02:15:06 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 017CF29F8A for ; Sat, 22 Oct 2016 02:15:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bxlnL-0000eL-HO; Sat, 22 Oct 2016 02:12:23 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bxlnK-0000eF-7X for xen-devel@lists.xenproject.org; Sat, 22 Oct 2016 02:12:22 +0000 Received: from [85.158.143.35] by server-5.bemta-6.messagelabs.com id E1/D0-29563-50BCA085; Sat, 22 Oct 2016 02:12:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFLMWRWlGSWpSXmKPExsUyr8m9SpflNFe EwaZjehbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8b5o03sBWe5KlZMbGNrYDzO0cXIySEk0Mgk cWJKGIjNJqAicXzDI1YQW0RASeLeqslMXYxcHMwCLcwSe35+YwJJCAu4S6w4NpkZxGYRUJVYc LmdEcTmFXCWmHlnBzuILSEgJ3Hy2GRWCDtUYs3i80ww8ccPHzBOYORawMiwilGjOLWoLLVI19 BYL6koMz2jJDcxM0fX0MBMLze1uDgxPTUnMalYLzk/dxMj0I8MQLCD8cuygEOMkhxMSqK8iyZ yRgjxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4OU5xRUhJFiUmp5akZaZAwwomLQEB4+SCK/FSaA0 b3FBYm5xZjpE6hSjopQ4Ly9InwBIIqM0D64NFsSXGGWlhHkZgQ4R4ilILcrNLEGVf8UozsGoJ MyrDTKFJzOvBG76K6DFTECLa9I4QBaXJCKkpBoYmRslpnPePbTdQnpJ2Ar7RzvfKwRXGgtzmh 2ZeeOH/d4v2gETtp3N3mnHULKdR7QsuUp5gnWhM8OtKr+KaXd+HLzbES45re6BSprnKi3Guc5 fTTIYzrIwPzo/6wvL1DyvHw4/7/77s6LhGfuFZjcjNZ97K5TcPZepvgyMV1L4rvXzkgrnlVlh SizFGYmGWsxFxYkA+f39EV0CAAA= X-Env-Sender: mengxu@cis.upenn.edu X-Msg-Ref: server-6.tower-21.messagelabs.com!1477102340!16875594!1 X-Originating-IP: [158.130.71.122] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.0.13; banners=-,-,- X-VirusChecked: Checked Received: (qmail 63230 invoked from network); 22 Oct 2016 02:12:20 -0000 Received: from coyote.seas.upenn.edu (HELO hound.seas.upenn.edu) (158.130.71.122) by server-6.tower-21.messagelabs.com with SMTP; 22 Oct 2016 02:12:20 -0000 Received: from panda-catbroadwell.cis.upenn.edu ([158.130.48.19]) (authenticated bits=0) by hound.seas.upenn.edu (8.14.9/8.14.5) with ESMTP id u9M2CCPg000552 (version=TLSv1/SSLv3 cipher=AES256-SHA256 bits=256 verify=NOT); Fri, 21 Oct 2016 22:12:13 -0400 From: Meng Xu To: xen-devel@lists.xenproject.org Date: Fri, 21 Oct 2016 22:12:02 -0400 Message-Id: <1477102322-4162-1-git-send-email-mengxu@cis.upenn.edu> X-Mailer: git-send-email 1.9.1 X-Proofpoint-Virus-Version: vendor=nai engine=5600 definitions=5800 signatures=585085 X-Proofpoint-Spam-Reason: safe Cc: Wei Liu , Dagaen Golomb , George Dunlap , Haoran Li , Dario Faggioli , Linh Thi Xuan Phan , Meng Xu , Meng Xu , Tianyang Chen Subject: [Xen-devel] [PATCH] xen:rtds:Clear __RTDS_depleted bit once replenish vcpu X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP We should clear the __RTDS_depleted bit once a VCPU budget is replenished. Because repl_timer_handler may be called after rt_schedule but before rt_context_saved, the VCPU may be not on CPU or on queue when the VCPU is the middle of context switch Signed-off-by: Meng Xu Acked-by: Dario Faggioli --- Cc: Dario Faggioli Cc: George Dunlap Cc: Wei Liu Cc: Linh Thi Xuan Phan Cc: Haoran Li Cc: Meng Xu Cc: Dagaen Golomb Cc: Tianyang Chen --- xen/common/sched_rt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c index ff17bd2..16b5691 100644 --- a/xen/common/sched_rt.c +++ b/xen/common/sched_rt.c @@ -1488,8 +1488,8 @@ static void repl_timer_handler(void *data){ if ( svc->cur_deadline > next_on_runq->cur_deadline ) runq_tickle(ops, next_on_runq); } - else if ( vcpu_on_q(svc) && - __test_and_clear_bit(__RTDS_depleted, &svc->flags) ) + else if ( __test_and_clear_bit(__RTDS_depleted, &svc->flags) && + vcpu_on_q(svc) ) runq_tickle(ops, svc); list_del(&svc->replq_elem);