From patchwork Tue Jul 10 09:31:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Wei W" X-Patchwork-Id: 10516743 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 8FDC1600CA for ; Tue, 10 Jul 2018 09:56:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C038285BD for ; Tue, 10 Jul 2018 09:56:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EF1B285C6; Tue, 10 Jul 2018 09:56:56 +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=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19B892855D for ; Tue, 10 Jul 2018 09:56:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 43E686B0269; Tue, 10 Jul 2018 05:56:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3C51E6B026B; Tue, 10 Jul 2018 05:56:55 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 242C26B026C; Tue, 10 Jul 2018 05:56:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f198.google.com (mail-pf0-f198.google.com [209.85.192.198]) by kanga.kvack.org (Postfix) with ESMTP id D37BC6B0269 for ; Tue, 10 Jul 2018 05:56:54 -0400 (EDT) Received: by mail-pf0-f198.google.com with SMTP id g26-v6so10947114pfo.7 for ; Tue, 10 Jul 2018 02:56:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=kOLno4LKhk3T/XPSnPPliijl4UUViLWBO74lue5FG5o=; b=M2Zpt4+ird2RLraUdFgOW4Kle7DvpHQdoYTBGV08yZUW3aExC1jlQmWtpyOCEzNtNJ Kwyfvs/BHUhCMmLbb2Q3zzcA2OZDI/ekLtNGOBNez8PZrdRXkGv1FDx6/YR+kk7dRd7F qAquJYO3snkOjkrJTE7oqFigvhUotVOmbE4y1cgxN/PEmMhEI4inRZYrC7iI9xAY2rqI 4NpA9kJSSsGKDEF6q2m3k0HXuKp0sbWMaGdVwsP9lbSIMuuJ1+d8A9v+fkgYH4+QpuB7 nWMIbSlsWxlYhycqqNtu3TQYmQaRhkU3Ixt8fObXUyxr2PS3pbaCDjYCW28L1/L89any SJ4Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of wei.w.wang@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=wei.w.wang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: APt69E0n2BFNemPTIqGSESaW6sXE3qEK2QlM6iPAf2f1PTZXCEkPMI+m uPCUFP4bvO/a0Nv9kEitPwEwgpT4cFkKkTTWH8ODo/+oE7aRDj7EBPzEeE4E/fXENRXawhvZVMR Vw80o5z6YKI0W+xmMv/uZBKXYeJs8xWbAo8TWDsxjSU58hvhRTvcXZjR/7DDCNyWCBw== X-Received: by 2002:a17:902:6105:: with SMTP id t5-v6mr24128663plj.92.1531216614561; Tue, 10 Jul 2018 02:56:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdSoemQHJUtcxzGCRsVe9+0I4xJu1237ZmQad4e2q1GRmCfUeMB0QzavoyiOg8dWQgBL0aS X-Received: by 2002:a17:902:6105:: with SMTP id t5-v6mr24128637plj.92.1531216613905; Tue, 10 Jul 2018 02:56:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531216613; cv=none; d=google.com; s=arc-20160816; b=Y3qdhpFvAKdfOXoOoMch0Sw3hJmvsHyGinvGgyBUtp02L0ASNc90oVC2hMxXV3BrQ6 UO6ZLlh+oXRWdfkRtZL+I4UnIp19CXAO5SmpxSDNJMfUeLwF3QvHRUQoA/lAAioGLYtK vYssUbHBCIvPGaHnbDdD6dB/sGO9qI7TDsgJ+zVjnORrM7Vcs4ZbeOQPl5Me1wtYyUGf i2brj+ilfNIkVeejr06SObvh2u2chbBilVV/ZA5byjr9Q1w0yeY53M/k6rKL0R++M5ho 7cYm/SblL3rfbQI9NVrEvrLJjQaPcZ+H/MWUsXYMdTXgOi09UjkpA64PtbXIJqizL+gj Yn9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=kOLno4LKhk3T/XPSnPPliijl4UUViLWBO74lue5FG5o=; b=hwxDyhZRogV7Scu4mbArqCgGxhd2mAk9KvxtGEbVvZdwv+924wYfP2PDTonW/o/hgT Nco1D8VRZlRDE0a6f1Z/y8WvRPNRUzI3OQwXXD+92ffSB6PSw5zTJNpazzfpOjrgGpel vIUHZNVXKSuGjOGf9FVgA6Glz5GmStFghQvmRqH7Bw637TpnEpt1w+2f8Tu0GxMK7Jo7 56jAM9pTQ0/nmEn1glyaU6vknOd1cHxbEzNvW3JcOISCY2bLibFQroGPkfu27oEOj+2W rK3FVJaisjZATi8GyDzFNZosd9cfjWkJKpZYeqqRSxQXnN3Ut3elqqXcaetIEXcsJ6UM mRmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of wei.w.wang@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=wei.w.wang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga18.intel.com (mga18.intel.com. [134.134.136.126]) by mx.google.com with ESMTPS id r3-v6si15637780pgo.606.2018.07.10.02.56.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jul 2018 02:56:53 -0700 (PDT) Received-SPF: pass (google.com: domain of wei.w.wang@intel.com designates 134.134.136.126 as permitted sender) client-ip=134.134.136.126; Authentication-Results: mx.google.com; spf=pass (google.com: domain of wei.w.wang@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=wei.w.wang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2018 02:56:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,334,1526367600"; d="scan'208";a="73598568" Received: from devel-ww.sh.intel.com ([10.239.48.110]) by orsmga002.jf.intel.com with ESMTP; 10 Jul 2018 02:56:30 -0700 From: Wei Wang To: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-mm@kvack.org, mst@redhat.com, mhocko@kernel.org, akpm@linux-foundation.org Cc: torvalds@linux-foundation.org, pbonzini@redhat.com, wei.w.wang@intel.com, liliang.opensource@gmail.com, yang.zhang.wz@gmail.com, quan.xu0@gmail.com, nilal@redhat.com, riel@redhat.com, peterx@redhat.com Subject: [PATCH v35 2/5] virtio-balloon: remove BUG() in init_vqs Date: Tue, 10 Jul 2018 17:31:04 +0800 Message-Id: <1531215067-35472-3-git-send-email-wei.w.wang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531215067-35472-1-git-send-email-wei.w.wang@intel.com> References: <1531215067-35472-1-git-send-email-wei.w.wang@intel.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP It's a bit overkill to use BUG when failing to add an entry to the stats_vq in init_vqs. So remove it and just return the error to the caller to bail out nicely. Signed-off-by: Wei Wang Cc: Michael S. Tsirkin --- drivers/virtio/virtio_balloon.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 6b237e3..9356a1a 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -455,9 +455,13 @@ static int init_vqs(struct virtio_balloon *vb) num_stats = update_balloon_stats(vb); sg_init_one(&sg, vb->stats, sizeof(vb->stats[0]) * num_stats); - if (virtqueue_add_outbuf(vb->stats_vq, &sg, 1, vb, GFP_KERNEL) - < 0) - BUG(); + err = virtqueue_add_outbuf(vb->stats_vq, &sg, 1, vb, + GFP_KERNEL); + if (err) { + dev_warn(&vb->vdev->dev, "%s: add stat_vq failed\n", + __func__); + return err; + } virtqueue_kick(vb->stats_vq); } return 0;