Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2236120ybi; Thu, 18 Jul 2019 05:27:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6nfejDab51ipO9RzuIVFNm4Uviwfe44iWlkjsIK7xX9Iofp9VihZ0lIP1jpRMyH7defLL X-Received: by 2002:a17:902:6b81:: with SMTP id p1mr47024599plk.91.1563452838452; Thu, 18 Jul 2019 05:27:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563452838; cv=none; d=google.com; s=arc-20160816; b=ff7+uAHlC7DsPB6NJHjZ8jrQ7kTd7ywFIp4mcLN2NNCEmWYiuhC9HdlziGNtsl8SB1 k5oeSc+yIbrsjJTaOiEyJCcc8dRp4zRoNK3Paq/DDQKqtxxGEip54nSoZDZ8DYjdlh16 DZ5qjCCwAnUhm6uXS21N0wRDRqwzgp2IprG/HnnA4Pfzb20kuRZXIA9HsjGI4jpcwAXk B53DD0K9/pdEPkojjeuNtRzFQmiiPe9wAOc3vaEGA7EnoLX6rT4mK1lHzQefKJuT5JiH bosOjNIItKP2XyBrFpvOC1Iwkewsq68In+b8k1xGNVVQ9xMiH1RmEdU7pv5migH3Q7H3 kHLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=L7sUTXkpil8lGGW6uIRJo6nFXE6R0Nebf1DOcmrGXRM=; b=bKZ2gf5K+SzSJx3tgX4EI386fm4mJahxYzf5acU5mgtgdczFmqwUzbqZE/OdbBNcp5 Pb5i7jBRC+pDo1ZNHCZLN+p9YcAwzi7MhR32IVXQ9vzDdokZwF4TD5rxdgI45r2wyhxX dDaC7WamGwqLdDEqfVcLyi7VEAWSqnDPXCCxmG8V2epyZ2GGvJT/KqFncO7PGRIXh9DE y3DvcvIyVTV4tvkBW0OmV3JrN/1Sm53RURGFlo6mXePrfT72C2cLK2+6aNSAPzahed8e neuyLFDyoXDmliIpEFJPmlv35tcYyUV3r56kKWLKxg2NO0oDL9IzDKWXv3L3236qZs1y 24JA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3si2351708pgn.467.2019.07.18.05.27.01; Thu, 18 Jul 2019 05:27:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727692AbfGRM0d (ORCPT + 99 others); Thu, 18 Jul 2019 08:26:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48338 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726715AbfGRM0c (ORCPT ); Thu, 18 Jul 2019 08:26:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0D1E58553B; Thu, 18 Jul 2019 12:26:32 +0000 (UTC) Received: from redhat.com (ovpn-120-147.rdu2.redhat.com [10.10.120.147]) by smtp.corp.redhat.com (Postfix) with SMTP id 5B13360A35; Thu, 18 Jul 2019 12:26:18 +0000 (UTC) Date: Thu, 18 Jul 2019 08:26:11 -0400 From: "Michael S. Tsirkin" To: Wei Wang Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, xdeguillard@vmware.com, namit@vmware.com, akpm@linux-foundation.org, pagupta@redhat.com, riel@surriel.com, dave.hansen@intel.com, david@redhat.com, konrad.wilk@oracle.com, yang.zhang.wz@gmail.com, nitesh@redhat.com, lcapitulino@redhat.com, aarcange@redhat.com, pbonzini@redhat.com, alexander.h.duyck@linux.intel.com, dan.j.williams@intel.com Subject: Re: [PATCH v2] mm/balloon_compaction: avoid duplicate page removal Message-ID: <20190718082535-mutt-send-email-mst@kernel.org> References: <1563442040-13510-1-git-send-email-wei.w.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1563442040-13510-1-git-send-email-wei.w.wang@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 18 Jul 2019 12:26:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 18, 2019 at 05:27:20PM +0800, Wei Wang wrote: > Fixes: 418a3ab1e778 (mm/balloon_compaction: List interfaces) > > A #GP is reported in the guest when requesting balloon inflation via > virtio-balloon. The reason is that the virtio-balloon driver has > removed the page from its internal page list (via balloon_page_pop), > but balloon_page_enqueue_one also calls "list_del" to do the removal. > This is necessary when it's used from balloon_page_enqueue_list, but > not from balloon_page_enqueue_one. > > So remove the list_del balloon_page_enqueue_one, and update some > comments as a reminder. > > Signed-off-by: Wei Wang ok I posted v3 with typo fixes. 1/2 is this patch with comment changes. Pls take a look. > --- > ChangeLong: > v1->v2: updated some comments > > mm/balloon_compaction.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c > index 83a7b61..8639bfc 100644 > --- a/mm/balloon_compaction.c > +++ b/mm/balloon_compaction.c > @@ -21,7 +21,6 @@ static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info, > * memory corruption is possible and we should stop execution. > */ > BUG_ON(!trylock_page(page)); > - list_del(&page->lru); > balloon_page_insert(b_dev_info, page); > unlock_page(page); > __count_vm_event(BALLOON_INFLATE); > @@ -33,7 +32,7 @@ static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info, > * @b_dev_info: balloon device descriptor where we will insert a new page to > * @pages: pages to enqueue - allocated using balloon_page_alloc. > * > - * Driver must call it to properly enqueue a balloon pages before definitively > + * Driver must call it to properly enqueue balloon pages before definitively > * removing it from the guest system. > * > * Return: number of pages that were enqueued. > @@ -47,6 +46,7 @@ size_t balloon_page_list_enqueue(struct balloon_dev_info *b_dev_info, > > spin_lock_irqsave(&b_dev_info->pages_lock, flags); > list_for_each_entry_safe(page, tmp, pages, lru) { > + list_del(&page->lru); > balloon_page_enqueue_one(b_dev_info, page); > n_pages++; > } > @@ -128,13 +128,19 @@ struct page *balloon_page_alloc(void) > EXPORT_SYMBOL_GPL(balloon_page_alloc); > > /* > - * balloon_page_enqueue - allocates a new page and inserts it into the balloon > - * page list. > + * balloon_page_enqueue - inserts a new page into the balloon page list. > + * > * @b_dev_info: balloon device descriptor where we will insert a new page to > * @page: new page to enqueue - allocated using balloon_page_alloc. > * > * Driver must call it to properly enqueue a new allocated balloon page > * before definitively removing it from the guest system. > + * > + * Drivers must not call balloon_page_enqueue on pages that have been > + * pushed to a list with balloon_page_push before removing them with > + * balloon_page_pop. To all pages on a list, use balloon_page_list_enqueue > + * instead. > + * > * This function returns the page address for the recently enqueued page or > * NULL in the case we fail to allocate a new page this turn. > */ > -- > 2.7.4