From patchwork Wed Feb 8 09:00:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Razvan Cojocaru X-Patchwork-Id: 9562025 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 D2F7360434 for ; Wed, 8 Feb 2017 09:04:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCA5228495 for ; Wed, 8 Feb 2017 09:04:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B107F2849D; Wed, 8 Feb 2017 09:04:22 +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 4FC9128495 for ; Wed, 8 Feb 2017 09:04:22 +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 1cbO7f-00056H-1m; Wed, 08 Feb 2017 09:01:07 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cbO7d-00056B-Vj for xen-devel@lists.xen.org; Wed, 08 Feb 2017 09:01:06 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id 71/A2-02804-15EDA985; Wed, 08 Feb 2017 09:01:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCIsWRWlGSWpSXmKPExsUSfTxjoW7AvVk RBmfadSyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oxnW6ayFEziqDh77hRTA+M9ti5GTg4hAXeJ tvOzgWwuIHsNo8S8yV/ZIZyrjBLTWu/AVZ3tXcYEkdjHKDF9y2QmkASbgKHE6o0tYEUiAtIS1 z5fZgSxmQVcJc5dP8ACYgsL+EhM3dXCDmKzCKhK7Jr8FayeV8BT4snOdrA5EgJyEiePTWaFsH Mk7v3aCTSHA8iWkvjfqgSyV0LgLIvEujevmSFqZCQeTbzJNoFRYAEjwypGjeLUorLUIl1DC72 kosz0jJLcxMwcXUMDY73c1OLixPTUnMSkYr3k/NxNjMDQqmdgYNzB+Pu05yFGSQ4mJVHekLuz IoT4kvJTKjMSizPii0pzUosPMcpwcChJ8OaA5ASLUtNTK9Iyc4BBDpOW4OBREuGdDZLmLS5Iz C3OTIdInWJUlBLnNQVJCIAkMkrz4NpgkXWJUVZKmJeRgYFBiKcgtSg3swRV/hWjOAejkjDvcp ApPJl5JXDTXwEtZgJafP002OKSRISUVANjN5PuVu4y5Yz+H+sf18/xu3rg9cuKb+aue89E8vH q/WR8cnJpActuw/wf1s8tvLP+nmHeIcDEPsWs7XHB8oADB+WPHVDKUinXy51/SpX9n4Zo7uT1 9k5X5KNLn0dfX+DyP3RL/MJ/NtJCvG7TT867FtKVcYLr6I/HDG5fLm6u2XPg2AFdo58blFiKM xINtZiLihMBXAd0+KcCAAA= X-Env-Sender: rcojocaru@bitdefender.com X-Msg-Ref: server-14.tower-31.messagelabs.com!1486544464!84528564!1 X-Originating-IP: [91.199.104.161] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31723 invoked from network); 8 Feb 2017 09:01:04 -0000 Received: from mx01.bbu.dsd.mx.bitdefender.com (HELO mx01.bbu.dsd.mx.bitdefender.com) (91.199.104.161) by server-14.tower-31.messagelabs.com with DHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 8 Feb 2017 09:01:04 -0000 Received: (qmail 22386 invoked from network); 8 Feb 2017 11:01:03 +0200 Received: from unknown (HELO mx-sr.buh.bitdefender.com) (10.17.80.103) by mx01.bbu.dsd.mx.bitdefender.com with AES256-GCM-SHA384 encrypted SMTP; 8 Feb 2017 11:01:03 +0200 Received: from smtp01.buh.bitdefender.com (smtp.bitdefender.biz [10.17.80.75]) by mx-sr.buh.bitdefender.com (Postfix) with ESMTP id AE8307FBE7 for ; Wed, 8 Feb 2017 11:01:02 +0200 (EET) Received: (qmail 23332 invoked from network); 8 Feb 2017 11:01:02 +0200 Received: from xen.dsd.ro (HELO xen.dsd.bitdefender.biz) (rcojocaru@bitdefender.com@10.10.14.109) by smtp01.buh.bitdefender.com with AES128-SHA256 encrypted SMTP; 8 Feb 2017 11:01:02 +0200 From: Razvan Cojocaru To: xen-devel@lists.xen.org Date: Wed, 8 Feb 2017 11:00:52 +0200 Message-Id: <1486544452-28593-1-git-send-email-rcojocaru@bitdefender.com> X-Mailer: git-send-email 1.9.1 X-BitDefender-Scanner: Clean, Agent: BitDefender qmail 3.1.6 on smtp01.buh.bitdefender.com, sigver: 7.69532 X-BitDefender-Spam: No (0) X-BitDefender-SpamStamp: Build: [Engines: 2.15.8.1074, Dats: 439933, Stamp: 3], Multi: [Enabled, t: (0.000007, 0.004449)], BW: [Enabled, t: (0.000007,0.000001)], RBL DNSBL: [Disabled], APM: [Enabled, Score: 500, t: (0.002498), Flags: 85D2ED72; NN_LARGER; NN_S_ENLARGE; NN_MORE_INFO_ADN; NN_SLOTS_IPX; NN_NO_CONTENT_TYPE; NN_NO_LINK_NMD; NN_LEGIT_BITDEFENDER; NN_LEGIT_S_SQARE_BRACKETS; NN_LEGIT_MAILING_LIST_TO], SGN: [Enabled, t: (0.005982,0.000043)], URL: [Enabled, t: (0.000004)], RTDA: [Enabled, t: (0.047929), Hit: No, Details: v2.4.3; Id: 5eu3g4.1b8clcvoc.5ca7], total: 0(775) X-BitDefender-CF-Stamp: none Cc: tamas@tklengyel.com, Razvan Cojocaru Subject: [Xen-devel] [PATCH] common/vm_event: Prevent guest locking with large max_vcpus 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 It is currently possible for the guest to lock when subscribing to synchronous vm_events if max_vcpus is larger than the number of available ring buffer slots. This patch no longer blocks already paused VCPUs, fixing the issue for this use case. Signed-off-by: Razvan Cojocaru --- xen/common/vm_event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c index 82ce8f1..2005a64 100644 --- a/xen/common/vm_event.c +++ b/xen/common/vm_event.c @@ -316,7 +316,8 @@ void vm_event_put_request(struct domain *d, * See the comments above wake_blocked() for more information * on how this mechanism works to avoid waiting. */ avail_req = vm_event_ring_available(ved); - if( current->domain == d && avail_req < d->max_vcpus ) + if( current->domain == d && avail_req < d->max_vcpus && + !atomic_read( ¤t->vm_event_pause_count ) ) vm_event_mark_and_pause(current, ved); vm_event_ring_unlock(ved);