Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp991662rdb; Fri, 19 Jan 2024 05:12:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGQ/lQRpVMxW28+tYmxaOrujPUoEq9kstaDUv/XEdHarrPy2ZA/hf20+2vmvLO21y7IOcau X-Received: by 2002:a05:6512:49b:b0:50e:8487:1ec6 with SMTP id v27-20020a056512049b00b0050e84871ec6mr609232lfq.56.1705669953816; Fri, 19 Jan 2024 05:12:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705669953; cv=pass; d=google.com; s=arc-20160816; b=Hd1Tlsv69ZjY/bteAGKi+RfALd0NwHnXAi8eHKHqiFtuwJ8G+6XBtGhzs+ugZgeeNs nZB3tBKU1+m1U0XVrM5+wDcy18F+ZAet/E4hr3WksYKnL/BmebZBK7SPomXobdSkYgWM fCCTg5hGG/eBuhawnZK8BGaehvleg6wq5wcQgSwlRue4I9N1zRdi+I4oX13zzN5lpqbp HvZc7wHnKDNW2aYZKSmMRVOYIY730vJ6tOCBEsodLVz4KFbSXu//iYNuPf6wCnzuAs+h JBG2NZduni34mnoJppLPfoZzqYY84Q9ugEx2NrDZYkUHB0g7daVBdJYfb8VzoFR8xeu9 SOYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=vi/ghrBJ2abck4Wwi0h7DJOTr7ObAnQ+55jlxgP3HjA=; fh=ZPY9JeJLmTgS9LZKdhZ5ggio5HJ93IiZ6ENH9S+9zM0=; b=TuhmIk3Zx97Tom8QdDFg4EDxQ9OxslOvU8kNmSpB2NYanKm51d5CCtZ8s1MnP6IxIs J8m5zSD969bc16c5ds+b6Np3khuUmqTeYd+gc6/im9px6t9qYsqvY/KzmIqSMwIJ9eZ8 6x1siwziyYHdM5O/1cMFLYtUcCadS8qsfu4j2b3YpSn2W8CJCB00b73ldjh3lBzFJREM 91lh5sUyikCdcf4b+O3l0QH+9akmK/kwQASe+iGgU8pVl85dnN+b8jNVz9uALTASclvF arrykCmGCE1kXoGVOPIOPnfPDtrCu0TaB/FZEtdhj2xt5K3qQzuUl88rIsLzPlhJQE6Q YEaQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="OuUH4I/E"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-31175-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31175-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id u20-20020a17090626d400b00a2c20f5dc30si7679276ejc.907.2024.01.19.05.12.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 05:12:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31175-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="OuUH4I/E"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-31175-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31175-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 782B11F21C62 for ; Fri, 19 Jan 2024 13:12:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E404B524BF; Fri, 19 Jan 2024 13:12:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OuUH4I/E" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7D263C680 for ; Fri, 19 Jan 2024 13:12:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705669944; cv=none; b=Xr7ZLfCWOhJi6EqzIHC1xQuvJHXWQoup9zAjZTdp4VbEiuMj/r8/5KjPoYqSoIDinP5MdmMo3hV6QwSOwh3j/ZTUi+4ZO2BGKadAizDatf1K42shOXMYJkrod531ZVg6ToQwOGgQqFgYoM5AQ8VRXkjespFOKHp/urFkZbkhr7o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705669944; c=relaxed/simple; bh=Ib20zY68P2ii/G09SSPsak2hYrVP9F1ZwDcarzVgh9M=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=M4KReerHGPTWdoruiM/usqgNHwHviGtPjBBW5SBf0fps//AKYNtiXkXVh2ntGHDz8Jdj/8Y7FlqUJ51g1TPL6+NLUVe8NjxXDAIG+lr5pSOKR1dU1oO/8JLqOInGgNaLd9E8w59WiXZBa5K35ZISIkLgUoOEszVcHSMa1oGdYAc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=OuUH4I/E; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705669941; 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: in-reply-to:in-reply-to:references:references; bh=vi/ghrBJ2abck4Wwi0h7DJOTr7ObAnQ+55jlxgP3HjA=; b=OuUH4I/ElixPlLjwG0toH+dcDBtPYPdQ2h+bZSbS7NLVtPUq5bZuPE6LGFWVAu6KwU6b0D GO4+xD+hQe5H3v8SpzkQFgVtyCHoCV/YNkBNQXHYaLYk/x1fA+cBIqDdzeAGRtN+xYr6bc artYrVSH6fwOYafBDEy0z4wJA+YAgY4= Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-135-IVlo97J6N0i4a8b_XZ-HPA-1; Fri, 19 Jan 2024 08:12:20 -0500 X-MC-Unique: IVlo97J6N0i4a8b_XZ-HPA-1 Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-5ffa2bb4810so3804817b3.0 for ; Fri, 19 Jan 2024 05:12:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705669939; x=1706274739; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vi/ghrBJ2abck4Wwi0h7DJOTr7ObAnQ+55jlxgP3HjA=; b=DTkpEAz25c92u9Tt9x8YTS+5HSUaoQY1xH3nv7pBWvrXl+qi7LwdENtUSND8dL3+IF xTJvtE5Q8wLBb7SqwASg8Q69iQInwKy07S31n/hZXCXqSQPtOm15q5WOgxU5ajt2UJAb pCv/pbZwW4makKqRqSQjrUY+rkTlGSHWrRuHgCRMwOgAlwV+uXOIEvq24vpl/hpCkIxI qUVE8M/lq5DDFo/kIglk3FYgvFH9pAkUMkP82PVoeud/L4xWqmkSqMNtDYWVW1iQRFTY WjnJKjHkyiAcwklAHXsF9AGJjlqb4JMp1gj+6PQWIAIORffjqRLuJwrtWz/ty+p77eGU C8Fw== X-Gm-Message-State: AOJu0Yyh2D3q9cNUrv7PVMw8g0Z1qR/QtKIvpkWnQMBK/QmipzrvS9jS MyOAH7rt0dpWsybjOyGZusd7eHYIdYh8XcaLJmn130t19MXRORqFspnZrdwcjMJ0MOVS4zPml0D BhW4Vvll8zV+phEoR2s0R/47L6tipbUb6ztXFxBMiuhoiQlCbzjNFJZT35c8mdNoBfez9hGU0Ij 6mgnBmm84q9b21A8jkS04KGM2svAAilM6noJMlfmH9JN51 X-Received: by 2002:a0d:c645:0:b0:5ff:a425:d64c with SMTP id i66-20020a0dc645000000b005ffa425d64cmr315875ywd.81.1705669939706; Fri, 19 Jan 2024 05:12:19 -0800 (PST) X-Received: by 2002:a0d:c645:0:b0:5ff:a425:d64c with SMTP id i66-20020a0dc645000000b005ffa425d64cmr315869ywd.81.1705669939501; Fri, 19 Jan 2024 05:12:19 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240119125753.152354-1-npache@redhat.com> In-Reply-To: <20240119125753.152354-1-npache@redhat.com> From: Nico Pache Date: Fri, 19 Jan 2024 06:11:53 -0700 Message-ID: Subject: Re: [PATCH] selftests: mm: fix map_hugetlb failure on 64K page size systems To: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, shuah@kernel.org, donettom@linux.vnet.ibm.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable NACK. I accidentally sent an older version of this patch. Following up with V2. On Fri, Jan 19, 2024 at 5:58=E2=80=AFAM Nico Pache wrot= e: > > On systems with 64k page size and 512M huge page sizes, the allocation > and test succeeds but errors out at the munmap. As the comment states, > munmap will failure if its not HUGEPAGE aligned. This is due to the > length of the mapping being 1/2 the size of the hugepage causing the > munmap to not be hugepage aligned. Fix this by making the mapping length > the full hugepage if the hugepage is larger than the length of the > mapping. > > Signed-off-by: Nico Pache > --- > tools/testing/selftests/mm/map_hugetlb.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/tools/testing/selftests/mm/map_hugetlb.c b/tools/testing/sel= ftests/mm/map_hugetlb.c > index 193281560b61..dcb8095fcd45 100644 > --- a/tools/testing/selftests/mm/map_hugetlb.c > +++ b/tools/testing/selftests/mm/map_hugetlb.c > @@ -58,10 +58,16 @@ int main(int argc, char **argv) > { > void *addr; > int ret; > + size_t maplength; > size_t length =3D LENGTH; > int flags =3D FLAGS; > int shift =3D 0; > > + maplength =3D default_huge_page_size(); > + /* mmap with fail if the length is not page */ > + if (maplength > length) > + length =3D maplength; > + > if (argc > 1) > length =3D atol(argv[1]) << 20; > if (argc > 2) { > -- > 2.43.0 >