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 2290CC54EBC for ; Tue, 10 Jan 2023 12:25:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A2AD8E0002; Tue, 10 Jan 2023 07:25:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 92B6F8E0001; Tue, 10 Jan 2023 07:25:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7CB468E0002; Tue, 10 Jan 2023 07:25:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 693DD8E0001 for ; Tue, 10 Jan 2023 07:25:33 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EEB0C120691 for ; Tue, 10 Jan 2023 12:25:32 +0000 (UTC) X-FDA: 80338810104.03.E40CAD7 Received: from domac.alu.hr (domac.alu.unizg.hr [161.53.235.3]) by imf16.hostedemail.com (Postfix) with ESMTP id 7A3BC180002 for ; Tue, 10 Jan 2023 12:25:30 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=alu.unizg.hr header.s=mail header.b=xKLD1GvL; dkim=pass header.d=alu.unizg.hr header.s=mail header.b="mBcV/UXg"; spf=pass (imf16.hostedemail.com: domain of mirsad.todorovac@alu.unizg.hr designates 161.53.235.3 as permitted sender) smtp.mailfrom=mirsad.todorovac@alu.unizg.hr; dmarc=pass (policy=none) header.from=alu.unizg.hr ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673353531; 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=XzR3xdR9VyYndK6DHw1j1LjNOsVbnmoE1ecwIQrY1G0=; b=rgpk9UppbXzBdIHM8s5LPGN7k7wHpdKI91p2WHbbpWARl6A48Onu/RmKQTac0H1Z1mpecL 7Lbbcf9uMTlaLkWavbSrKo+J1prSYUB7zeY8phYlbx/6PQJT+Rm6BkAw6whQVMcG6eSBGR hYNnST5qYf/cOwUb23jPkqUSfq5UCqQ= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=alu.unizg.hr header.s=mail header.b=xKLD1GvL; dkim=pass header.d=alu.unizg.hr header.s=mail header.b="mBcV/UXg"; spf=pass (imf16.hostedemail.com: domain of mirsad.todorovac@alu.unizg.hr designates 161.53.235.3 as permitted sender) smtp.mailfrom=mirsad.todorovac@alu.unizg.hr; dmarc=pass (policy=none) header.from=alu.unizg.hr ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673353531; a=rsa-sha256; cv=none; b=I88zmAjd/O0mXwTyFW/O9PBrTq/kIHADh3rHloBwZWGEKapkN0fv3IYvG2XH37i0A0AsLr AsxwdX6r06RfS28o+CyRs6FfheFzBm703TQsIAx5ZAYD7gPtd92C68UI1UaPhIp0FrJrsV XpilKjbR0iAuyagEZiPuPKsfw5txakU= Received: from localhost (localhost [127.0.0.1]) by domac.alu.hr (Postfix) with ESMTP id 9EF07604F1; Tue, 10 Jan 2023 13:25:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1673353527; bh=VeJArPQ6vKqPoHqGVssiiLXxT7q3qqWhs4HV7H9sSyI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=xKLD1GvLLCt3TIKW6MqymB2er08BfC64z3f5fvhPujl0L8C6Ofd3bhCPnUeJbUTf6 gHhX94eR+I+87Zap98I4f/N842p+QbyUyNEYaHsnsEAST0XNpq5d9grWX77HF2Re83 7rmX8O8odRlA0QIwUpAQBTEFLmvLPKXGVK28AbJ7U/zxrhci95T6WSjP50dD8TwqWW L3pltmsbZeW/CJ05nYjFfMF9sk3SIWmLN29GJjDxjN2UwWtj6rrOCbZ39ADisGjCr9 lz5Ouroztk0dd2JNQ50Hxar3/D9dULzOj3Ka7vCbfpYwkk7pkQadbVEiYqd2AOkMde ScwslZ7qzBYJQ== X-Virus-Scanned: Debian amavisd-new at domac.alu.hr Received: from domac.alu.hr ([127.0.0.1]) by localhost (domac.alu.hr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6CvrA81L_uoA; Tue, 10 Jan 2023 13:25:25 +0100 (CET) Received: from [193.198.186.200] (pc-mtodorov.slava.alu.hr [193.198.186.200]) by domac.alu.hr (Postfix) with ESMTPSA id B7978604F0; Tue, 10 Jan 2023 13:25:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1673353525; bh=VeJArPQ6vKqPoHqGVssiiLXxT7q3qqWhs4HV7H9sSyI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=mBcV/UXg0N4GxyNHy9mqg7rk1HhAPErILVk4U/adabEI7PMvnh2/5OHD/si5nmQlc AM4l3YKuAWJVpMMHUeEpdf5weFAjfuzVU6u4PiiSb8yuDLQcHcLz1QLJk3jwGPtzTV v6Zfh0y+ca1Oac48wHJZESto4dJnkhbAT450v8slkUgGyCqIMT67KwhzwTFvZRBWyL vfylKo60c84WnUBkucRL9H0qjROcCNxIuXUiq7gSCB+JsE7pN7gPRaBiMafqb/fKGy YgicNEJtT0hSEOKXHhXvHA5iRNmMuy5Gm/f0wJjiwfI7HCgnzQ4rWYE7K4p3QmRohC eGsyWIsHhwrlA== Message-ID: Date: Tue, 10 Jan 2023 13:25:24 +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==?= Content-Language: en-US, hr To: David Hildenbrand , 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: Mirsad Todorovac In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 7A3BC180002 X-Stat-Signature: mgkc6hquemi5bgdrjzzx1tieyudenyxp X-Rspam-User: X-HE-Tag: 1673353530-983038 X-HE-Meta: U2FsdGVkX1+lEHic623ID2wPNpSDKF0qgTN1+LGkvPKoR2Pfp9jVSkdOmOQztk7N1MJ9agnWEsaeyWaym6Xex6Sm66MySVNP2K8B+srKdw2AfHnoacJUinO2d2ZmGTEiv5NdfXHNxo3A31KlJIhjlRYuRdNqctBEENEKve6bidHO5DuPUUT9Mhau2L+5/G3eSjMXTAZqAsPDSCLCEz2fQEblFqiZXDQld5sU7sTQt27alkyxSLqdkpMYFk0WsR6vP8OjRjcDoxws+miWrX+5ScIRx25EeOiyEPJEc/g/yUjQfPth4VrCKsvijk8tlvaA38F5tdoWrLmi7qqeczlK6u4+zSBnQRxSbsxbuHLjEkb1V87UjcY8zJFNipw+5do+e4j7ePywPWlnLDbAhMG4LUGSzygV7lXqI1D9ewOR0oIgmS2U0i4UqRI3jKbt9r+wsWk2mMLF1b7AI2Y7KyQ30s4DO0E7ekQmFD7MjNAjSrDxkLEQjh5CijFa/ex5b8hvmnXXRFAnbA8FAEdpaQhBGx/Ni4FkL8HjY3qdOw3jzodc5K2CsXtdJiO6eic1tOd2QvaydcK1NjNdaJISy9hdTrb/OzULdq3eBDWlRAVK3npPTRyQpYP+/IsG7hh+6h/FW1tNY1opwcvAmclP5YD0byIfuZGTtz15Tu2wEPASpIMhSBXfj+u+BxsMgrCW1cqPKm/i9WUAIKRv3aj8jOWeBNwvcHrNPB7AoNLyo1TzRlBhdk1RXhEvd7rNqox6aNE9KpfW6Tkxr929G/Xb5RybJR/niP3gk0y7tVNZViw2+FutpPElVhcPoX+vmbgCXkkExqZK6D3L3gXt+OLafd7bz8ORzgeHMJiNMg6GLlMqdhMuzogU6vy4SNFVC21dbIjo4Kfzi/3IlZ4dFSZRVRjaYMjp2Jc/LtN6Q+x5JIDcte9wq7mXW4YE3w== 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 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 :) 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? -- Mirsad Goran Todorovac Sistem inženjer Grafički fakultet | Akademija likovnih umjetnosti Sveučilište u Zagrebu System engineer Faculty of Graphic Arts | Academy of Fine Arts University of Zagreb, Republic of Croatia