From patchwork Tue May 24 15:06:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9133831 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 D068B6075E for ; Tue, 24 May 2016 15:09:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3A9F28230 for ; Tue, 24 May 2016 15:09:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B86C82827A; Tue, 24 May 2016 15:09:59 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 89C1A28230 for ; Tue, 24 May 2016 15:09:58 +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 1b5DvZ-0005AQ-7m; Tue, 24 May 2016 15:07:25 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5DvY-0005AK-6A for xen-devel@lists.xenproject.org; Tue, 24 May 2016 15:07:24 +0000 Received: from [193.109.254.147] by server-14.bemta-14.messagelabs.com id AE/C8-09513-B2E64475; Tue, 24 May 2016 15:07:23 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEIsWRWlGSWpSXmKPExsXiVRvkqKuV5xJ u8HumlMX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmnF49UfmghPsFfuvvmBuYJzP1sXIxSEkMINR YtbZSWAOi8BUVon1e/YwgzgSAhtZJQ6/PsDexcgJ5MRI3FnRxgJhV0rM2L6XEcQWElCRuLl9F RPEqMVMEt/v7ARrEBbQkzhy9AeU7SnRv/YgWDObgIHEmx17WUFsEQEliXurJoM1MwusZ5S4dv QgWIJFQFXi08ErYDavgLfEqk0LwZpFBeQkVl5ugYoLSpyc+QQozgHUrCmxfpc+SJhZQF5i+9s 5zBMYhWYhqZqFUDULSdUCRuZVjBrFqUVlqUW6hkZ6SUWZ6RkluYmZObqGhiZ6uanFxYnpqTmJ ScV6yfm5mxiBIc0ABDsYz05zPsQoycGkJMp7KsclXIgvKT+lMiOxOCO+qDQntfgQowwHh5IEr 2wuUE6wKDU9tSItMwcYXTBpCQ4eJRHeMyCtvMUFibnFmekQqVOMxhwLftxey8SxZeq9tUxCLH n5ealS4rzfQEoFQEozSvPgBsGi/hKjrJQwLyPQaUI8BalFuZklqPKvGMU5GJWEeUVA7uHJzCu B2/cK6BQmoFP8vziDnFKSiJCSamAsf6lnUbtRSG37a4bSfFtu07mHe913TwoKi6/bLBv9ZN+c QPH535UmXOWIm/2QYcJmvru/dsw7d/50KksXSzmT2N6+NJ8ZThqb+zczBV6+ucnPfbfsm+4pL 9ZZXXov+Wm72SVRse2sTHbLjDZe8vb907/w/uurMVYasqenaUbzqxR5l6tt2x2qxFKckWioxV xUnAgAe2r+kvUCAAA= X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-11.tower-27.messagelabs.com!1464102442!35006776!1 X-Originating-IP: [74.125.82.65] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 12999 invoked from network); 24 May 2016 15:07:22 -0000 Received: from mail-wm0-f65.google.com (HELO mail-wm0-f65.google.com) (74.125.82.65) by server-11.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 24 May 2016 15:07:22 -0000 Received: by mail-wm0-f65.google.com with SMTP id n129so7079790wmn.1 for ; Tue, 24 May 2016 08:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:from:to:cc:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=p/Jq77hxOG4Yo/F9PTUg3Mh5bXIpbvSGorUmMlDmMeA=; b=CIkLk/zVwOBtuobAclEiq+wx0k7FsY0E5vG0xfWgHlng64B12WyD9WUYPtuDD3enkK y3tla/r5uw776rV7biZ3tLgSHamEhfkIKNNyuv0nt7u+Vfg/MyuQ09kST2LNytwJzsPh zdCJWebhzScjvNsmMO1bfYzZflXNO98hK+cuF7c/EAAjwVz/G9KpmdoUTX/PTdG74e0N 5v/iChIzpdOfc7hA5HtuGo4B9NXJOB+WUpWzPf8AY1q2Rn7/wktC2NpHNkmpBezslLJN XkpAfzAiCg55dLAObz6n4CCRdmE1nzr1mcyFWYLYwZnixSbMPhBv+W8DWH89o0fV5MCq 1m5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:from:to:cc:date:message-id :user-agent:mime-version:content-transfer-encoding; bh=p/Jq77hxOG4Yo/F9PTUg3Mh5bXIpbvSGorUmMlDmMeA=; b=T7D2T8/oPapmp1349Mf+1hGoKtk4omFy8zCBWOWFtHN+wD9d7FWpTRF9nlzbx//b1y /xmj6A9TRt933NfTaZCwj/t4Z/iVxJ2OnG2Tizqt+tJVZcDuflnJuYMAn3Z2mh0uYw3T 12rJLqQq9abJBOk+sRQGWF7WK6aVXaq/dqRYZJ3ECgMUr7JIEgkBxV1EcvVh0hz7Bj1O s/iWDNlDMdH345T/LTKDS5ZeYvEKb3SX9UgZ8xCsmQapmB5k/Ow1bPYffa5r765/3+H6 UKW2YFcCK6+1iL2cX2NwuzXajSHxuQBSKxnsTbAoMudFKAt2n1CCMolslP5UVYDe5xn9 gYfg== X-Gm-Message-State: ALyK8tLqb/1QMWIg19nhDO5mX+b60Rts3FIYtGtCOwJeTjybpbVMLlUqVBb+4nPsvDY+Og== X-Received: by 10.194.95.40 with SMTP id dh8mr5308308wjb.146.1464102441792; Tue, 24 May 2016 08:07:21 -0700 (PDT) Received: from Solace.fritz.box (net-37-116-144-218.cust.vodafonedsl.it. [37.116.144.218]) by smtp.gmail.com with ESMTPSA id kd7sm3691266wjc.33.2016.05.24.08.06.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 May 2016 08:07:00 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Tue, 24 May 2016 17:06:58 +0200 Message-ID: <146410241867.30357.7157102219398554511.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: Wei Liu , Meng Xu , Jan Beulich , George Dunlap Subject: [Xen-devel] [PATCH] xen: RTDS: fix another instance of the 'read NOW()' race 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP which was overlooked in 779511f4bf5ae ("sched: avoid races on time values read from NOW()"). Reported-by: Jan Beulich Signed-off-by: Dario Faggioli Reviewed-by: Meng Xu Acked-by: George Dunlap --- Cc: Meng Xu Cc: George Dunlap Cc: Jan Beulich Cc: Wei Liu --- xen/common/sched_rt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c index 0946101..5b077d7 100644 --- a/xen/common/sched_rt.c +++ b/xen/common/sched_rt.c @@ -840,12 +840,14 @@ static void rt_vcpu_insert(const struct scheduler *ops, struct vcpu *vc) { struct rt_vcpu *svc = rt_vcpu(vc); - s_time_t now = NOW(); + s_time_t now; spinlock_t *lock; BUG_ON( is_idle_vcpu(vc) ); lock = vcpu_schedule_lock_irq(vc); + + now = NOW(); if ( now >= svc->cur_deadline ) rt_update_deadline(now, svc);