Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8246583imu; Thu, 15 Nov 2018 08:40:14 -0800 (PST) X-Google-Smtp-Source: AJdET5fx8B5HOPHcUJPmRJHu9BqA1UZa08S4UGpVt51upDJVnkLjac6/NL9gkFJgwbyAAU7Ic6XM X-Received: by 2002:a62:3687:: with SMTP id d129-v6mr7245431pfa.56.1542300014528; Thu, 15 Nov 2018 08:40:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542300014; cv=none; d=google.com; s=arc-20160816; b=QtnDP5xzIiYeLr2uXe22ZdaSY6n382JuwgasqOQfbrM6FbzyNlFnNZ9c9rGuvygYlz iZjccRWpux8o5MWxUflHiSTKCIqW7g+2n1TeryaKDMuJv/mbsyIgm8mXMv2XhiZhbrgq 6YG+PN6L8uQORPQKU2pctZHVgOOS90Fc/CIN4N8hXbZLIEQI5PmfjMxg2AtLrlF+BAhX cAM14LLMlsMV/1d6MFBvkSXND0AR0M1G8QNXa6iYd1/R6ycpirL+U0llKVLVxcFKG6xw lhd1z40CMM/pVTq9h+/scvdDwNLRgZ3kGiLAyFXaKBcHaTlSI58V9aMzXiS/QgQ2ha+P 0l9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=17dc8vySqmKsB9p+CyeaGcPoLnvCPX/+WwPhXJgyT+E=; b=JXSGycET4sLPsrXLhYfdPgvsDiWWghugsiY+PfrXfPVhGQb8UxdsOsT+/CMzYD7qyX YijOlL86yIjxnY/i9u8yVtwUfjnuXPxUesBpifznZsr9v4joI2ncGRo1p9ZWm9/pMEfZ /eDBBmNfgaIJM7ZqC3z9TlqwtMiOr0uPzS7iuDlMU4M7T7LUzZYrENN8IhThaYYGWrVJ BzLZCBD/nBgnnnQ99XYqnD3i3hodrLIQ3VI6syOyUA/xu+nm7T4AtcmuyQvxTb6pQFC3 sNetu9xjeZ+NuSyxNZeDvXAwb1c+ZnuntwaqCIgSLAqvGbPHOe7pIPy4oTDycFS37TV3 yoOA== 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 b10si5678553plr.196.2018.11.15.08.39.59; Thu, 15 Nov 2018 08:40:14 -0800 (PST) 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 S2388427AbeKPCrn (ORCPT + 99 others); Thu, 15 Nov 2018 21:47:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39174 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387839AbeKPCrn (ORCPT ); Thu, 15 Nov 2018 21:47:43 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D7AB53078A50; Thu, 15 Nov 2018 16:39:10 +0000 (UTC) Received: from vitty.brq.redhat.com.redhat.com (unknown [10.34.244.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CFBE1A92D; Thu, 15 Nov 2018 16:39:03 +0000 (UTC) From: Vitaly Kuznetsov To: Ahmed Soliman Cc: Anders Roxell , Shuah Khan , linux-kselftest@vger.kernel.org, Paolo Bonzini , Peter Xu , linux-kernel@vger.kernel.org, Andrew Jones Subject: Re: KVM selftests are failing In-Reply-To: References: <20181114180807.6crs7awhvo26ldbr@hawk.localdomain> <20181115090203.5z25gwa2yznj6mmu@kamzik.brq.redhat.com> <20181115145028.qijg7hjswcuabrt2@kamzik.brq.redhat.com> Date: Thu, 15 Nov 2018 17:39:01 +0100 Message-ID: <87efbmqore.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 15 Nov 2018 16:39:10 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ahmed Soliman writes: > Hello, > On Thu, Nov 15, 2018 at 4:50 PM Andrew Jones wrote: >> >> On Thu, Nov 15, 2018 at 03:36:44PM +0200, Ahmed Soliman wrote: >> > mmap(NULL, 6291456, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, >> > -1, 0) = 0x7f46ea2a1000 >> > madvise(0x7f46ea2a1000, 6291456, MADV_NOHUGEPAGE) = -1 EINVAL (Invalid argument) >> > >> > For comprehension, this is done on intel core i7-4500U CPU @ 1.80GHz >> >> Argh. I see what it is. Your config doesn't have CONFIG_TRANSPARENT_HUGEPAGE=y, >> so madvise_behavior_valid() returns false, which causes madvise() to >> immediately return EINVAL. We should be more careful in kvm selftests with >> our madvise behavior use. >> >> > >> > As for now I will comment the madvise line and the assert when writing >> > my own kvm self test. I think it wouldn't cause any trouble?, If it is >> > not the case, please let me know. >> > >> >> You may not need madvise() at all for your test, depending on what you're >> doing. So leaving it out may be fine. Reworking kvm selftests to ensure >> only valid madvise behaviors are used (and only when necessary), before >> adding new tests, would be best. > > Confirmed it worked after CONFIG_TRANSPARENT_HUGEPAGE=y > I will send a patch soon that should make the self test check if > Transparent huge pages are enabled first before issuing the related > madvise() Just ignore -EINVAL returned from madvise(), QEMU went even further, see: commit 1d7414396f926651c4d7a673eb3a10aca5246d76 Author: Dr. David Alan Gilbert Date: Thu Nov 19 15:27:48 2015 +0000 Assume madvise for (no)hugepage works -- Vitaly