Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp890636ybg; Mon, 27 Jul 2020 02:20:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznJ6siJvkHHsqphVgJ+Y1KHTPIkUF/un/WAE1iEvMqNTBftWsWovZBuB4qjESDx5uownqb X-Received: by 2002:a17:906:68b:: with SMTP id u11mr5048276ejb.143.1595841606631; Mon, 27 Jul 2020 02:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595841606; cv=none; d=google.com; s=arc-20160816; b=zEIirP2fsJHmm6TV8YZ4nWs2gC0s9aBvlxx/d0FfHf+7d+PL+f/XffohrveNuhqjsM OzmXWWAHf5mm0jwiwajU8h17/Wi0rtkSaLmO+od6uMeXw4xLU6o3/jahzE6czFkZEEZD h2VXilDiKq1EBneC3Ojbpi3hGpxTuonFLWH/o+I4VSqiCtbJZOkIhH0fxrNb91DgpfPS aE1a+HMSgYN3aH6YUNkBpXP0nF5+ua4+avhvJxkKCHluCr2YOgpmb8hUmmIoN4+VaBlR zDYN0Ttb5ANKwwFHqYVnp6FGKVwi96+k8uiGmM0iq0PfIhyy18W2Vq4zAUeAXHNIHEAx GCqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:dkim-signature; bh=Xjg3icHC4wDDbFFtRl9ZFNdMPyGmj2/BXsDTYiKPPiQ=; b=pCqu8WfzPl1svbgXUF2wSXus0Sf4u/yuOpCM1pkwo8vGZ+OhAN9IYy+w1kL+OKVnV+ S6VuOwAEQcQZsNmkC51gYyZoxrTjjCRwSGWyvOlZk1L3KjgTHFGgiLZeV7Qkz72YFpn/ zClZ5srJSb5LZK5HB/ZlTBxiLFMJvo72Td+el7D9EWCh5W5JnhRRfmANdAk0yJ49HZwp 8lr/2yvUCQexTZcE7fCZ5jIPpSelh1WuDqFRSCjIkUgisYf0Fm2CJlcRHKjx+/rQHHnh Az9mHTPEJ5vWjL9Az5PmmxAaBKOqYazQ/NC9+WMPOjXE7PweqxIv1kKVDaVPOiNZo0om 5fZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b=TUqDbBF3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=citrix.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lj13si4900113ejb.357.2020.07.27.02.19.44; Mon, 27 Jul 2020 02:20:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b=TUqDbBF3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=citrix.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727904AbgG0JPJ (ORCPT + 99 others); Mon, 27 Jul 2020 05:15:09 -0400 Received: from esa2.hc3370-68.iphmx.com ([216.71.145.153]:21202 "EHLO esa2.hc3370-68.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726278AbgG0JPH (ORCPT ); Mon, 27 Jul 2020 05:15:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1595841306; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3jbhXHOtCfIXZMzu/xfRs6KCwvTkEik1EFWK3NUjQ5c=; b=TUqDbBF3UM3J3DuvHFMNaIPOrsRtgHOSMbQfNoMvCyKmph/ucBJers0q 1+tg5CB0/m9NCj+VUYCcfS2EjQeolGGu0Km8ZCqb52v16Cp1vPmqMVlF1 euJIcLZPtq5PQYY70QUxk1YgMYHIUXn3rMxRkNWvDgrcDxPNLfiqSFyG+ 4=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: XBCsU74yw3gqieztP4QqoHMKHwPQS43HrGWtokfqoYQFLLraPZfghSADkh+tDlVKFLfYjy+t7V wLpS4OPM3WrCC5ogCSsCLNIU308UvGq9/KoTNu0vq/EKwIwdsM8K6oJgPGIdB0UeQHrLnfH6N4 nBhXexVhbxOjiRM8L3yo31TsUDflXk+vNdRma2GVo9FscqU3iUbZ46O2r587gpwT7DUugcVKgk LWnMbM2lZQSLIKZNj9ffanaC/24ugers1l1uocUJ2wim1ysobo/k1h8q4hRYpKSzGmJHkStpvU haw= X-SBRS: 2.7 X-MesageID: 23254979 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.75,402,1589256000"; d="scan'208";a="23254979" From: Roger Pau Monne To: CC: Roger Pau Monne , Juergen Gross , , Boris Ostrovsky , Stefano Stabellini , Subject: [PATCH v3 2/4] xen/balloon: make the balloon wait interruptible Date: Mon, 27 Jul 2020 11:13:40 +0200 Message-ID: <20200727091342.52325-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727091342.52325-1-roger.pau@citrix.com> References: <20200727091342.52325-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org So it can be killed, or else processes can get hung indefinitely waiting for balloon pages. Signed-off-by: Roger Pau Monné Reviewed-by: Juergen Gross Cc: stable@vger.kernel.org --- Cc: Boris Ostrovsky Cc: Juergen Gross Cc: Stefano Stabellini Cc: xen-devel@lists.xenproject.org --- drivers/xen/balloon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 3cb10ed32557..292413b27575 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -568,11 +568,13 @@ static int add_ballooned_pages(int nr_pages) if (xen_hotplug_unpopulated) { st = reserve_additional_memory(); if (st != BP_ECANCELED) { + int rc; + mutex_unlock(&balloon_mutex); - wait_event(balloon_wq, + rc = wait_event_interruptible(balloon_wq, !list_empty(&ballooned_pages)); mutex_lock(&balloon_mutex); - return 0; + return rc ? -ENOMEM : 0; } } -- 2.27.0