From patchwork Fri Jun 9 14:16:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 9778699 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 E2FCD6034B for ; Fri, 9 Jun 2017 14:19:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D91B12862B for ; Fri, 9 Jun 2017 14:19:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAE492862D; Fri, 9 Jun 2017 14:19:16 +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, UNPARSEABLE_RELAY 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 7CCCA2862B for ; Fri, 9 Jun 2017 14:19:15 +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 1dJKik-0002OQ-ET; Fri, 09 Jun 2017 14:17:02 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJKij-0002OI-Je for xen-devel@lists.xenproject.org; Fri, 09 Jun 2017 14:17:01 +0000 Received: from [85.158.139.211] by server-13.bemta-5.messagelabs.com id D5/61-01709-CDDAA395; Fri, 09 Jun 2017 14:17:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRWlGSWpSXmKPExsXSO6nOVffOWqt Igwn/RC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozdb/gLpnFVHPo9ibmB8Qt7FyMnh5DABCaJ 7Wsduhi5gOyvjBKvtnxjgkhsYJTY8aUSItHNKLH1xBRWiESRxPf1q1m6GDk42ARMJN6scgQJi wgoSdxbNZkJpJ5ZYCmTxKbDX1lAEsICfhL/2w4xgtgsAqoSXb8g5vAKWElMergPzJYQkJO4tO 0LM4RtKHH64TbGCYy8CxgZVjFqFKcWlaUW6RqZ6iUVZaZnlOQmZuboGhqY6uWmFhcnpqfmJCY V6yXn525iBIZDPQMD4w7GXe1+hxglOZiURHmnFVhFCvEl5adUZiQWZ8QXleakFh9ilOHgUJLg FVsDlBMsSk1PrUjLzAEGJkxagoNHSYT34mqgNG9xQWJucWY6ROoUoy7HhtXrvzAJseTl56VKi fO6g8wQACnKKM2DGwGLkkuMslLCvIwMDAxCPAWpRbmZJajyrxjFORiVhHl/rQSawpOZVwK36R XQEUxARyx5ZwFyREkiQkqqgTFa9/NOVfM7d37MZZv/9b1AZi7/TfMpPLf9+bfuseP7nCLofcZ Re/eajT5F7xh/Pl74e9Xk1W/S6/Vfmb762X+wg2c3n27sG5/iRtW/3IIfHztxpT1f/WfBzx9H XThPsU5jvrn/N/Oyztk5Mc/dzq3+xVgl/z3v/HFDRZ6OXk/BjWe+sRu+yN+txFKckWioxVxUn AgAuhFx/Y0CAAA= X-Env-Sender: konrad@char.us.oracle.com X-Msg-Ref: server-9.tower-206.messagelabs.com!1497017817!102781334!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22659 invoked from network); 9 Jun 2017 14:16:59 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-9.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Jun 2017 14:16:59 -0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v59EGoaT013622 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Jun 2017 14:16:51 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v59EGnP1018474 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 9 Jun 2017 14:16:50 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id v59EGnls014094; Fri, 9 Jun 2017 14:16:49 GMT Received: from char.us.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 09 Jun 2017 07:16:49 -0700 Received: by char.us.oracle.com (Postfix, from userid 1000) id 4FE7A6A0103; Fri, 9 Jun 2017 10:16:48 -0400 (EDT) From: Konrad Rzeszutek Wilk To: xen-devel@lists.xenproject.org Date: Fri, 9 Jun 2017 10:16:39 -0400 Message-Id: <20170609141639.8903-1-konrad.wilk@oracle.com> X-Mailer: git-send-email 2.9.3 X-Source-IP: userv0021.oracle.com [156.151.31.71] Cc: Konrad Rzeszutek Wilk , Andrew Cooper , Ross Lagerwall , Julien Grall , Jan Beulich , Boris Ostrovsky Subject: [Xen-devel] [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console. 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 If we have a large amount of livepatches and want to print them on the console using 'xl debug-keys x' we eventually hit the preemption check: if ( i && !(i % 64) ) { spin_unlock(&payload_lock); process_pending_softirqs(); if ( spin_trylock(&payload_lock) ) return The effect is that we have just effectively taken the lock and returned without unlocking! CC: Ross Lagerwall CC: Boris Ostrovsky CC: Jan Beulich CC: Andrew Cooper CC: Julien Grall Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: Jan Beulich Reviewed-by: Ross Lagerwall --- xen/common/livepatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c index f14bcbc..df67a1a 100644 --- a/xen/common/livepatch.c +++ b/xen/common/livepatch.c @@ -1642,7 +1642,7 @@ static void livepatch_printall(unsigned char key) { spin_unlock(&payload_lock); process_pending_softirqs(); - if ( spin_trylock(&payload_lock) ) + if ( !spin_trylock(&payload_lock) ) { printk("Couldn't reacquire lock. Try again.\n"); return;