From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20BE2C43603 for ; Wed, 4 Dec 2019 20:56:11 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1DDE20637 for ; Wed, 4 Dec 2019 20:56:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WtlE1b5V" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1DDE20637 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47Srjh36NKzDqV6 for ; Thu, 5 Dec 2019 07:56:08 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=207.211.31.81; helo=us-smtp-delivery-1.mimecast.com; envelope-from=david@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="WtlE1b5V"; dkim-atps=neutral Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 47SrgL1hgjzDqRk for ; Thu, 5 Dec 2019 07:54:05 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575492842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DjFPZ5urTuKqmC6fst64X7L6zO/s1PJZoDmuLpfMvyg=; b=WtlE1b5Vl/eNPCcDxg0CPbX2kAlh7X9oJE/qnCiYVRkj5kUQoufqxYS3nG+i4KplF+/kUA bUXOujo2LSV+V2lNTxBzhwVS2lfrKG3OL6jO0cwOw/vct7IIhWLln98AkW04AmFyadmQaQ j9j8a0SuRadKPC1F3SA4gQvWIKP/5S8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-OFZlbzXVNM2DmqaCT_swYA-1; Wed, 04 Dec 2019 15:53:17 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C17219057A1; Wed, 4 Dec 2019 20:53:15 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-80.ams2.redhat.com [10.36.116.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 243CF60BE2; Wed, 4 Dec 2019 20:53:09 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Subject: [PATCH] powerpc/pseries/cmm: fix wrong managed page count when migrating between zones Date: Wed, 4 Dec 2019 21:53:09 +0100 Message-Id: <20191204205309.8319-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: OFZlbzXVNM2DmqaCT_swYA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , Greg Kroah-Hartman , Richard Fontana , linux-mm@kvack.org, Paul Mackerras , Arun KS , Andrew Morton , linuxppc-dev@lists.ozlabs.org, Thomas Gleixner Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" In case we have to migrate a ballon page to a newpage of another zone, the managed page count of both zones is wrong. Paired with memory offlining (which will adjust the managed page count), we can trigger kernel crashes and all kinds of different symptoms. Fix it by properly adjusting the managed page count when migrating. I did not try to reproduce on powerpc, however,I just resolved a long known issue when ballooning+offlining in virtio-balloon. The same should apply to powerpc/cmm since it started using the balloon compaction infrastructure (luckily just recently). Fixes: fe030c9b85e6 ("powerpc/pseries/cmm: Implement balloon compaction") Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Andrew Morton Cc: Richard Fontana Cc: Greg Kroah-Hartman Cc: Arun KS Cc: Thomas Gleixner Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: David Hildenbrand --- virtio-ballon fix with more details: https://lkml.kernel.org/r/20191204204807.8025-1-david@redhat.com/ --- arch/powerpc/platforms/pseries/cmm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/= pseries/cmm.c index 91571841df8a..665298fe2990 100644 --- a/arch/powerpc/platforms/pseries/cmm.c +++ b/arch/powerpc/platforms/pseries/cmm.c @@ -551,6 +551,10 @@ static int cmm_migratepage(struct balloon_dev_info *b_= dev_info, =09 */ =09plpar_page_set_active(page); =20 +=09/* fixup the managed page count (esp. of the zone) */ +=09adjust_managed_page_count(page, 1); +=09adjust_managed_page_count(newpage, -1); + =09/* balloon page list reference */ =09put_page(page); =20 --=20 2.21.0