From patchwork Mon Aug 8 07:01:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 9266847 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 AC88160754 for ; Mon, 8 Aug 2016 07:01:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D64727B2F for ; Mon, 8 Aug 2016 07:01:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D2D927DB3; Mon, 8 Aug 2016 07:01:59 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C38D27B2F for ; Mon, 8 Aug 2016 07:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751783AbcHHHBz (ORCPT ); Mon, 8 Aug 2016 03:01:55 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:56956 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751150AbcHHHBz (ORCPT ); Mon, 8 Aug 2016 03:01:55 -0400 Received: from trochilidae.toradex.int (unknown [IPv6:2601:602:8802:504f:3e97:eff:fe92:db3b]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 5823E5C0BBB; Mon, 8 Aug 2016 08:57:26 +0200 (CEST) From: Stefan Agner To: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: Marc.Zyngier@arm.com, will.deacon@arm.com, penberg@kernel.org, Stefan Agner Subject: [PATCH] kvmtool: ARM: madvise mergeable and hugepage separately Date: Mon, 8 Aug 2016 00:01:44 -0700 Message-Id: <20160808070144.17712-1-stefan@agner.ch> X-Mailer: git-send-email 2.9.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1470639447; bh=uy+4mqQdAZIU8RPbmrmY/m7qRfPSnlTINKhPhWB/T+k=; h=From:To:Cc:Subject:Date:Message-Id; b=qntvoyWZ9XdNv+Sj37yWcWeRE280TKZhTVOxMjkK9EIwqhw91qmE9uz8hHB3R74CD2H4wStDYlCs9Ax/lRh7NuYUEV1nJlwmJsDpGUDG5f7nxEjj2TR/d00Ka8eQKT+T6J7gCHmGhr8EjxONlwhvmyG/H3c+7EbUzaVUwnZLpm8= Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The madvise behavior is not a bit field and hence can not be or'ed. Also madvise_behavior_valid checks the flag using a case statement hence only one behavior is supposed to be supplied. Call madvise twice, once for MERGEABLE and once for HUGEPAGE. Signed-off-by: Stefan Agner Acked-by: Andre Przywara --- arm/kvm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arm/kvm.c b/arm/kvm.c index ce40897..3cfa90a 100644 --- a/arm/kvm.c +++ b/arm/kvm.c @@ -80,7 +80,10 @@ void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size) SZ_2M); madvise(kvm->arch.ram_alloc_start, kvm->arch.ram_alloc_size, - MADV_MERGEABLE | MADV_HUGEPAGE); + MADV_MERGEABLE); + + madvise(kvm->arch.ram_alloc_start, kvm->arch.ram_alloc_size, + MADV_HUGEPAGE); /* Create the virtual GIC. */ if (gic__create(kvm, kvm->cfg.arch.irqchip))