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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BEDBC54EBC for ; Tue, 10 Jan 2023 12:29:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 99F0F8E0002; Tue, 10 Jan 2023 07:29:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 94F918E0001; Tue, 10 Jan 2023 07:29:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7EF7D8E0002; Tue, 10 Jan 2023 07:29:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 6F6408E0001 for ; Tue, 10 Jan 2023 07:29:23 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2F770120CD7 for ; Tue, 10 Jan 2023 12:29:23 +0000 (UTC) X-FDA: 80338819806.01.CCF7271 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id CA40D40013 for ; Tue, 10 Jan 2023 12:29:20 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FEO6LfoL; spf=pass (imf12.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673353761; h=from:from:sender: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:dkim-signature; bh=zj7O7BsTwrlQivuxli/b/DVop3RoAUc26KLutE6aqJA=; b=Z61Iu6WSYBjGl1OVNZWzixg7HJtl5uCYQDUMnGnebiqHlBY7NFyPdWaPIyRLuiWD4URsEa ppRHGI8sRrRtTrqfKWwwtRkwM14Sf1YDwSmKGc2pgcxozwKAWVBXPJTZHRwa9hFQdRX1TL /kE4xVeOsspUAErLOBlIIRybUDxa2Qc= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FEO6LfoL; spf=pass (imf12.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673353761; a=rsa-sha256; cv=none; b=T4DqI/tyXuPTI+V4EINnM39BGYa+48t/6WgRu5Nb3fht2alxSugB4n9xSH0+1CjVO33s+z QrI8uk4koLwp5xSjuX4OI3Pi+jYwYZoR52Q7CAReQRbYuhyyujKIy3MSCYXZeuFnMYjo2i sibl2gdg1kU2IKWVtVLJcBgQYmWTnfY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673353760; 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=zj7O7BsTwrlQivuxli/b/DVop3RoAUc26KLutE6aqJA=; b=FEO6LfoLnF5pquvPFLQmsjSJEzvlSYe85l9L9vo3tl1rR+6PQ8sdtb3A2yE5KCbKURUAFA 0//DYJg/baz4zQ7MxktzfB4zPEkRkglM7GUTf8xLAFenqF1cash2Jwsy4mube+hh1pDxU1 PJzwgSsX9b6vMCwGJByLjSPLVLO4NbU= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-660-9AWSfCmJOU-SI6PTENzo9w-1; Tue, 10 Jan 2023 07:29:19 -0500 X-MC-Unique: 9AWSfCmJOU-SI6PTENzo9w-1 Received: by mail-wm1-f70.google.com with SMTP id c66-20020a1c3545000000b003d355c13229so8954217wma.0 for ; Tue, 10 Jan 2023 04:29:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zj7O7BsTwrlQivuxli/b/DVop3RoAUc26KLutE6aqJA=; b=ZFXu+4P+9276ohasp70c8JLu0wvCf9vwJFRJ094lMGHdDC6GiqscgRW84VpVGotXMr xipys8T8hhhK+6++dH8KWQZjH/uAsm4SmZO2J+7jsCqpcsp7fV5dbAo/qiCvhjm5NxHn eVMPJ/xoiIVHwEXA/+1lMo+aTQm889oHOglq+4ZutRsfquzmiFPgH+olKTxfFA/NAtqH SeFyeefVgPHBTsxqbmA+xocbFZCKsWgJctmL4ulOjM1iAWXly50ODtaY3m9CDzAQB30r d4SPi7xRd2Iz7tgAqQ3mGrKxv7IYKFOhwp6DR1EYK1WYZNfOkHUlzs3P7mzlV0X21u8j ODng== X-Gm-Message-State: AFqh2kozPK8/JWWJJYl3mpkcJIh5aOS5Dqc7nFelD2x9HMeucNHZby4h V1VZJu5Z7f6i/s1tzDepU5L28ycfFDQ95utEMC9isCfwAFXpW3jWlr32Oji3GP1wnxDPLLos5ZC LPPDl9N7Ix9A= X-Received: by 2002:a05:600c:a51:b0:3cf:6f4d:c259 with SMTP id c17-20020a05600c0a5100b003cf6f4dc259mr47849232wmq.39.1673353757989; Tue, 10 Jan 2023 04:29:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXt74bXfj7jrQJ4WS8z+NMklJ4YVza2YaN6bDMjEL1Hh4N7QrP6Tx6DHyCHQc6eNCWGeQcwsrQ== X-Received: by 2002:a05:600c:a51:b0:3cf:6f4d:c259 with SMTP id c17-20020a05600c0a5100b003cf6f4dc259mr47849214wmq.39.1673353757618; Tue, 10 Jan 2023 04:29:17 -0800 (PST) Received: from ?IPV6:2003:cb:c708:4200:65d9:4d0d:bb61:14c8? (p200300cbc708420065d94d0dbb6114c8.dip0.t-ipconnect.de. [2003:cb:c708:4200:65d9:4d0d:bb61:14c8]) by smtp.gmail.com with ESMTPSA id o19-20020a05600c511300b003d9862ec435sm2609591wms.20.2023.01.10.04.29.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Jan 2023 04:29:17 -0800 (PST) Message-ID: Date: Tue, 10 Jan 2023 13:29:16 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: =?UTF-8?Q?Re=3a_PROBLEM=3a_selftest/vm/cow=2ec_failed_to_compile_?= =?UTF-8?B?KOKAmE1BRFZfUEFHRU9VVOKAmSB1bmRlY2xhcmVkKQ==?= To: Mirsad Todorovac , linux-mm@kvack.org Cc: Andrew Morton , Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org References: <0f117203-3227-cd16-61c2-2dd3de75ecc7@alu.unizg.hr> <0ee389dc-5e47-5b7e-4db5-637eb2b3fbc9@redhat.com> <0e692e52-0a4f-3892-ed25-f3fa12892b6f@alu.unizg.hr> From: David Hildenbrand Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: CA40D40013 X-Rspam-User: X-Stat-Signature: eqbbr69q6pz4jnoro5o5d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zGzOhGTdWyzg+F2lN23woJoYUADzcEd8UVnORbBerRJne8mFkFRWBEiq3vatq5XdXCUTum5pof36M49KUl9iTA81CxiuftrAoFRmTIXsb/II1s92NW7V3F7ccxB9aiblC/UzwuMNpHzkaE0OoIAu3nS18aqBd X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 10.01.23 13:25, Mirsad Todorovac wrote: > On 1/10/23 11:05, David Hildenbrand wrote: >> On 09.01.23 22:41, Mirsad Goran Todorovac wrote: >>> On 1/9/2023 5:42 PM, David Hildenbrand wrote: >>> >>> Hi, thank you for your reply. >>> >>>>> I hope this is enough information for you to debug the issue. >>>>> >>>>> I am standing by for any additional diagnostics needed. >>>> >>>> Won't userfaultfd.c fail in a similar way? >>>> >>>> Anyhow, khugepaged.c jas >>>> >>>> #ifndef MADV_PAGEOUT >>>> #define MADV_PAGEOUT 21 >>>> #endif >>>> >>>> So most probably we should do the same. >>> >>> Actually, David, it turned out that userfaultfd.c compiled >>> out-of-the-box, and side-by-side comparison showed that it also included >>> "/home/marvin/linux/kernel/linux_torvalds/usr/include/asm-generic/mman-common.h" >>> >>> The only remaining difference was including , which fixed >>> the issue w/o #ifdef ... #endif >>> >>> Hope this helps. >>> >>> Please find the following diff. >>> >>> Regards, >>> Mirsad >>> >>> ------------------------------------------------------------------------------ >>> diff --git a/tools/testing/selftests/vm/cow.c >>> b/tools/testing/selftests/vm/cow.c >>> index 26f6ea3079e2..dd8cf12c6776 100644 >>> --- a/tools/testing/selftests/vm/cow.c >>> +++ b/tools/testing/selftests/vm/cow.c >>> @@ -16,6 +16,7 @@ >>>    #include >>>    #include >>>    #include >>> +#include >>>    #include >>>    #include >>>    #include >>> >> >> I already sent a different fix [1]. I suspect when including >> linux/mman.h, it would still be problematic with older kernel >> headers that lack MADV_PAGEOUT (< v5.4). > > I see your point. > >> But yeah, I saw that userfaultfd.c was fixed that way: >> >> commit b773827e361952b3f53ac6fa4c4e39ccd632102e >> Author: Chengming Zhou >> Date:   Fri Mar 4 20:29:04 2022 -0800 >> >>     kselftest/vm: fix tests build with old libc >>     The error message when I build vm tests on debian10 (GLIBC 2.28): >>         userfaultfd.c: In function `userfaultfd_pagemap_test': >>         userfaultfd.c:1393:37: error: `MADV_PAGEOUT' undeclared (first use >>         in this function); did you mean `MADV_RANDOM'? >>           if (madvise(area_dst, test_pgsize, MADV_PAGEOUT)) >>                                              ^~~~~~~~~~~~ >>                                              MADV_RANDOM >>     This patch includes these newer definitions from UAPI linux/mman.h, is >>     useful to fix tests build on systems without these definitions in >> glibc >>     sys/mman.h. >> >> >> [1] https://lkml.kernel.org/r/20230109171255.488749-1-david@redhat.com > > You're the boss :) Heh, no I'm not :) I'm just raising that this turned out to be problematic unfortunately. > > However, IMHO, having MADV_PAGEOUT defined in three or four places could > make like miserable. OK, it is unlikely to change value, but something > tells me that the right way to do it is to guarantee that the macro > definition is unique. > > I don't know what would be the right thing to do in pre-5.4 kernels > w/o MADV_PAGEOUT defined. > > Probably then the "(madvise(area_dst, test_pgsize, MADV_PAGEOUT)" gives > EINVAL or is undefined? Yes. The expectation is that it fails with ENOSYS or EINVAL if the kernel doesn't support it. The kernel might be different to the installed kernel headers. In an ideal world, we'd be using the in-tree headers -- they are guaranteed to define what we need. So far, I failed to make it work (I thought it would work as expected before I had to do above mentioned fix). Maybe that can be made working? -- Thanks, David / dhildenb