From patchwork Thu Apr 13 07:49:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9678861 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 72F7B601C3 for ; Thu, 13 Apr 2017 07:52:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63CD928395 for ; Thu, 13 Apr 2017 07:52:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58BF928490; Thu, 13 Apr 2017 07:52:26 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,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 4EE9B2848E for ; Thu, 13 Apr 2017 07:52:25 +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 1cyZVv-000432-QB; Thu, 13 Apr 2017 07:49:59 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cyZVu-00042N-DU for xen-devel@lists.xenproject.org; Thu, 13 Apr 2017 07:49:58 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id A5/B9-03012-5AD2FE85; Thu, 13 Apr 2017 07:49:57 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKIsWRWlGSWpSXmKPExsXiVRvkortU932 EQdMEAYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNaNrXh9rwRGOig8Hp7A1MK5i72Lk4hASmMEo MWneYiYQh0VgKqvElFU/GbsYOTkkBDayShz4I9PFyAFkx0nsOGIMEa6UmNi9kg3EFhJQkbi5f RUTxKAfjBLPuycwgSSEBfQkjhz9wQ5hx0lMfHeOGcRmEzCQeLNjLyuILSKgJHFv1WSwemaBWo k1F6ewgNgsAqoSd6Z0gy3gFfCSONL9EWyOqICcxMrLLawQcUGJkzOfsIDcxiygKbF+lz7EGHm J7W/nME9gFJqFpGoWQtUsJFULGJlXMWoUpxaVpRbpGhnrJRVlpmeU5CZm5ugaGpjp5aYWFyem p+YkJhXrJefnbmIEBjMDEOxg/DM/8BCjJAeTkijvKYX3EUJ8SfkplRmJxRnxRaU5qcWHGDU4O AQmnJ07nUmKJS8/L1VJgne/DlCdYFFqempFWmYOMN5gSiU4eJREeNWAMSfEW1yQmFucmQ6ROs Woy/Fo5Y/3TEJgM6TEeX+AzBAAKcoozYMbAYv9S4yyUsK8jEAHCvEUpBblZpagyr9iFOdgVBL m/QAyhSczrwRu0yugI5iAjli79y3IESWJCCmpBsb8K2fU+TNev/KelvZOgjm2Rcpg+3uZz80F JxbcPrdR+WyY8LWXGjuU1s4sfSu6PTt+vb5d0PsbB1aq9zWterh7yRn2gstC0w/WV0x4ePp1c HCKiteeNaIOe5ecFryn0bbMnKm55P6eBYFst+yMPYsdvKfq173cf0Gn6GLbae1a22nrK2cXT8 pTYinOSDTUYi4qTgQAYvVVZPgCAAA= X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1492069797!96799510!1 X-Originating-IP: [74.125.82.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 34354 invoked from network); 13 Apr 2017 07:49:57 -0000 Received: from mail-wm0-f68.google.com (HELO mail-wm0-f68.google.com) (74.125.82.68) by server-16.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 13 Apr 2017 07:49:57 -0000 Received: by mail-wm0-f68.google.com with SMTP id x75so10887832wma.1 for ; Thu, 13 Apr 2017 00:49:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:cc:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=xDco7Qh55kfXY39wVCakJpUdWnrbrH5rqECAUknQ8ZA=; b=Xivnkglr6fJkVWlX+HAZql74cK6kgUyUScBFxGevSmhKgKr5fyJGIp+sf32naGhLtu wK9UcKXCmFpOTCKGH79jBkWCbWPrNbGBccXOgNJa34nXX5FgHEovDoZQxIjhKy/Vh+pU 6WZKXxanuYY25/KNGoB61yTuc/ehiToVGvpKiBf3s25T3P44l+qi5T5PmnIrxQkLXh0+ Or6L730HktgK7r5HqE4jvYN5EpVcCkyD59DsVNLM4ucW74/XmTHZULEEw2OE+sbVBeTY ohrvGoPvk2d3YrzKegrnRt+v+PZDRuI0uXeH0bYhHCz0mlEgjICPZTZxU48IVe6qbo3I 3GTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:cc:date:message-id :user-agent:mime-version:content-transfer-encoding; bh=xDco7Qh55kfXY39wVCakJpUdWnrbrH5rqECAUknQ8ZA=; b=K3S+FO+ADZiXICpWfATGP2wZIbwQtuzj22n1jCqQ5dQT2dWTfozHeL9JMe8RNvUp54 6q+bwY3PNaqImcdJZwIwfgM/xVMRzSDBJzJx5rUi6WwfsDbl43xAgBrO1zKWR8vA/U3E 2L2sCcmdEljeApph7frsW/7kERSbA2BfLgQYQrJxTLdlhcYGo3veMQod8kh79K/g2NHa 2+bjMrJiSzh/EU41R/wCvmtQ/xojnL75KODfV0WjaRkkR+sxwPmqBsS3KKk3qVwPVpbp VlifGIn4zarSAqYdn01oqOyfhqJfGX1gcYUkKndNMkFDW2z20HFXltFzDO6Uv7b2b1pF O8jg== X-Gm-Message-State: AN3rC/4GF5js49y9NDPmx7qQC3lwOknFPNfQozAeC6h1GV/0ZBZzVS7L vyPCieTSIB2I3A== X-Received: by 10.28.128.68 with SMTP id b65mr2012310wmd.140.1492069796895; Thu, 13 Apr 2017 00:49:56 -0700 (PDT) Received: from Solace.fritz.box ([80.66.223.83]) by smtp.gmail.com with ESMTPSA id 201sm9510310wmr.5.2017.04.13.00.49.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Apr 2017 00:49:55 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Thu, 13 Apr 2017 09:49:54 +0200 Message-ID: <149206979424.1420.4973403493863924866.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: Andrew Cooper , Julien Grall , George Dunlap Subject: [Xen-devel] [for-4.9 PATCH] xen: credit: change an ASSERT on nr_runnable so that it makes sense. 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 Since the counter is unsigned, it's pointless/bogous to check for if to be above zero. Check that it is at least one before it's decremented, instead. Spotted by Coverity. Reported-by: Andrew Cooper Signed-off-by: Dario Faggioli Reviewed-by: George Dunlap --- Cc: George Dunlap Cc: Andrew Cooper Cc: Julien Grall --- Julien, This is very low risk, and I'd call it a bugfix in the sense that it quiesces coverity. Dario --- xen/common/sched_credit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 93658dc..efdf6bf 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -275,8 +275,8 @@ static inline void dec_nr_runnable(unsigned int cpu) { ASSERT(spin_is_locked(per_cpu(schedule_data, cpu).schedule_lock)); + ASSERT(CSCHED_PCPU(cpu)->nr_runnable >= 1); CSCHED_PCPU(cpu)->nr_runnable--; - ASSERT(CSCHED_PCPU(cpu)->nr_runnable >= 0); } static inline void