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 65098C54EBD for ; Mon, 9 Jan 2023 16:42:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E72E68E0002; Mon, 9 Jan 2023 11:42:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E233E8E0001; Mon, 9 Jan 2023 11:42:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC3998E0002; Mon, 9 Jan 2023 11:42:34 -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 BCFF58E0001 for ; Mon, 9 Jan 2023 11:42:34 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8CEAA120473 for ; Mon, 9 Jan 2023 16:42:34 +0000 (UTC) X-FDA: 80335829028.16.E214C36 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 5077F180010 for ; Mon, 9 Jan 2023 16:42:32 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GkJNql7u; spf=pass (imf24.hostedemail.com: domain of david@redhat.com designates 170.10.129.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=1673282552; 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=W9uCN3VQ3btzl2FPuIbtk5ZKyJr6zz6N2a76k393fHs=; b=HvIsELTsDtyCaa/OV/OmzUm68zQtvCPMJH7G26klrsATdba23y+OWZcxpCXYEAh0lEZHfJ /e2TK7OjKstJoPiYBNw89Or4YETmfy++98ZI0VhtLSn9jr8KvM3xLOe7glycsUwF9CHVWu vlbqKC87kSeOwqmK8NPAGVsaaylpv14= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GkJNql7u; spf=pass (imf24.hostedemail.com: domain of david@redhat.com designates 170.10.129.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=1673282552; a=rsa-sha256; cv=none; b=D/l2Jq/RB33EZ4cJaWq6XNSL67Q8LfcgEkz7MOn6bZFIE3sqpB/Y72fR5fqqYuAM1jKLX2 VSBHQQ6jbh6bdT3GJ7srvLWXg6JwZkbvoR1J4+WXEf6GfTqVzPEfaRfJDSCVWfMH90kJsM MyQrlKaMldnd184GIV2+llH6OgY7QEg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673282551; 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=W9uCN3VQ3btzl2FPuIbtk5ZKyJr6zz6N2a76k393fHs=; b=GkJNql7uZofLDWZLQFlXKGDzy7WneGTRdfzFdMRbO0MtJwizJ8h1bsOad2zG3Tz8PQ5pzS bruNT0rinbgT3Dx6uwzXCPg6SRJaSrBXTlPTlmDZ73axsrVMS3jtqGGbJAOYaSkfJYmwny vxO9jOY+OiyDrPsM6pQ95AXU4IqHb3g= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-653-2OldVajnOvmBQgRl34-8hQ-1; Mon, 09 Jan 2023 11:42:27 -0500 X-MC-Unique: 2OldVajnOvmBQgRl34-8hQ-1 Received: by mail-wm1-f71.google.com with SMTP id w8-20020a1cf608000000b003d9bb726833so1815530wmc.6 for ; Mon, 09 Jan 2023 08:42:27 -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=W9uCN3VQ3btzl2FPuIbtk5ZKyJr6zz6N2a76k393fHs=; b=YKx7WEbu5Jst8aPLVZBJPElTFpbuNQPPiavnP9xUf5PlVFkGbCPneHKgMmg8Vhe0ni fycf7mvN0iiWV/eXlGHag9b9TnmlAOicVU0MMVgiIEXBiW6j6qIivL/JxFBc87TpleDb 1BCfMLhcG05dFhjKKIZP2kZ3KYJXb/vmkTWSi6EZ4DXmrhtfv5uVETF0ktYLcCIaJK/W oxsiUduJgk3Idu3rgZkP0vYNORO/5Xt1+EazqwAvjdRfEut5/mMGp5WD4EnK+AfCutFN BKduHsU5WTKSbG7wKkp597FzUyTMNHxj3v/zTZIOQkHRh55ltmpbHzT9R447zWXrBgUw +utg== X-Gm-Message-State: AFqh2kqkEClC069EotHrAHu4HuyMTMzx9z5I3a7N7308me/VQ6wuFqbf Sgr9rts1hlAM13ZxyiDtyV5VFgpb/6wOvQWzmUyN1BpAOgxhMCwfQiotoMk32bQpnN25hDpFmfB Zufc1jDmWWOk= X-Received: by 2002:adf:f402:0:b0:270:c07e:56 with SMTP id g2-20020adff402000000b00270c07e0056mr35801398wro.53.1673282546794; Mon, 09 Jan 2023 08:42:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXuDdRq6l4D7tqj25ezhGwOEQPszZc1qC6Ax7Wv4ZPTyTh7QWw6hCI6gshgkwfk7zWzwDrx/Jg== X-Received: by 2002:adf:f402:0:b0:270:c07e:56 with SMTP id g2-20020adff402000000b00270c07e0056mr35801381wro.53.1673282546464; Mon, 09 Jan 2023 08:42:26 -0800 (PST) Received: from ?IPV6:2003:cb:c703:8f00:ba3:7d27:204f:8e29? (p200300cbc7038f000ba37d27204f8e29.dip0.t-ipconnect.de. [2003:cb:c703:8f00:ba3:7d27:204f:8e29]) by smtp.gmail.com with ESMTPSA id z2-20020a5d6402000000b00297dcfdc90fsm8954756wru.24.2023.01.09.08.42.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Jan 2023 08:42:26 -0800 (PST) Message-ID: <0ee389dc-5e47-5b7e-4db5-637eb2b3fbc9@redhat.com> Date: Mon, 9 Jan 2023 17:42:25 +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 Goran 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> From: David Hildenbrand Organization: Red Hat In-Reply-To: <0f117203-3227-cd16-61c2-2dd3de75ecc7@alu.unizg.hr> 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: rspam05 X-Rspamd-Queue-Id: 5077F180010 X-Stat-Signature: ko16qszb7suni1pwonszmxpxq87n77e8 X-Rspam-User: X-HE-Tag: 1673282552-464296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n+Hb5/9X5g+FtkQeXpXLfgtaA2obBHJ3V2nvCPb1SXitZDIqpw/Aga+bi7KJstgO1dYmsQrnq03bfo6KA7bRJK7vOtxm1SY9aqlQIRC2rcnDEnd1NYQDq 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 08.01.23 11:58, Mirsad Goran Todorovac wrote: > Hi all, > > During "make kselftest" there is an error in selftest/vm/cow.c compilation on > platform: > > - Lenovo desktop 10TX000VCR (LENOVO_MT_10TX_BU_Lenovo_FM_V530S-07ICB) > - AlmaLinux 8.7 (CentOS fork) > - gcc 8.5.0 20210514 (Red Hat 8.5.0-15) > - vanilla kernel 6.2-rc2 from the torvalds mainline tree. > > Compilation fails to find "#define MADV_PAGEOUT": > > [root@pc-mtodorov vm]# make > gcc -Wall -I /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/../../.. -I /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/../../../usr/include -isystem /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/../../../usr/include -no-pie cow.c vm_util.c -lrt -lpthread -o /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/vm/cow > cow.c: In function ‘do_run_with_base_page’: > cow.c:755:26: error: ‘MADV_PAGEOUT’ undeclared (first use in this function); did you mean ‘MADV_RANDOM’? > madvise(mem, pagesize, MADV_PAGEOUT); > ^~~~~~~~~~~~ > MADV_RANDOM > cow.c:755:26: note: each undeclared identifier is reported only once for each function it appears in > cow.c: In function ‘do_run_with_thp’: > cow.c:914:22: error: ‘MADV_PAGEOUT’ undeclared (first use in this function); did you mean ‘MADV_RANDOM’? > madvise(mem, size, MADV_PAGEOUT); > ^~~~~~~~~~~~ > MADV_RANDOM > make: *** [../lib.mk:145: /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/vm/cow] Error 1 > [root@pc-mtodorov vm]# > > MADV_PAGEOUT is defined in #include : > > [root@pc-mtodorov vm]# grep MADV_PAGEOUT -r /usr/include > /usr/include/asm-generic/mman-common.h:#define MADV_PAGEOUT 21 /* reclaim these pages */ > [root@pc-mtodorov vm]# grep MADV_PAGEOUT -r ../../../../usr/include > ../../../../usr/include/asm-generic/mman-common.h:#define MADV_PAGEOUT 21 /* reclaim these pages */ > [root@pc-mtodorov vm]# > > However, gcc -E shows that asm-generic/mman-common.h is somehow never included: > > --------------------------------------------------------------------------------------------- > [root@pc-mtodorov vm]# gcc -Wall -E -I /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/../../.. -I /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/../../../usr/include -isystem /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/../../../usr/include -no-pie cow.c | cat -s | less > # 1 "/usr/include/sys/mman.h" 1 3 4 > # 25 "/usr/include/sys/mman.h" 3 4 > # 1 "/usr/lib/gcc/x86_64-redhat-linux/8/include/stddef.h" 1 3 4 > # 26 "/usr/include/sys/mman.h" 2 3 4 > # 41 "/usr/include/sys/mman.h" 3 4 > # 1 "/usr/include/bits/mman.h" 1 3 4 > # 49 "/usr/include/bits/mman.h" 3 4 > # 1 "/usr/include/bits/mman-linux.h" 1 3 4 > # 117 "/usr/include/bits/mman-linux.h" 3 4 > # 1 "/usr/include/bits/mman-shared.h" 1 3 4 > # 42 "/usr/include/bits/mman-shared.h" 3 4 > > int memfd_create (const char *__name, unsigned int __flags) __attribute__ ((__nothrow__ , __leaf__)); > int mlock2 (const void *__addr, size_t __length, unsigned int __flags) __attribute__ ((__nothrow__ , __leaf__)); > int pkey_alloc (unsigned int __flags, unsigned int __access_rights) __attribute__ ((__nothrow__ , __leaf__)); > int pkey_set (int __key, unsigned int __access_rights) __attribute__ ((__nothrow__ , __leaf__)); > int pkey_get (int __key) __attribute__ ((__nothrow__ , __leaf__)); > int pkey_free (int __key) __attribute__ ((__nothrow__ , __leaf__)); > int pkey_mprotect (void *__addr, size_t __len, int __prot, int __pkey) __attribute__ ((__nothrow__ , __leaf__)); > > # 117 "/usr/include/bits/mman-linux.h" 2 3 4 > # 49 "/usr/include/bits/mman.h" 2 3 4 > # 42 "/usr/include/sys/mman.h" 2 3 4 > > # 57 "/usr/include/sys/mman.h" 3 4 > extern void *mmap (void *__addr, size_t __len, int __prot, > int __flags, int __fd, __off_t __offset) __attribute__ ((__nothrow__ , __leaf__)); > # 70 "/usr/include/sys/mman.h" 3 4 > extern void *mmap64 (void *__addr, size_t __len, int __prot, > int __flags, int __fd, __off64_t __offset) __attribute__ ((__nothrow__ , __leaf__)); > > extern int munmap (void *__addr, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); > extern int mprotect (void *__addr, size_t __len, int __prot) __attribute__ ((__nothrow__ , __leaf__)); > extern int msync (void *__addr, size_t __len, int __flags); > extern int madvise (void *__addr, size_t __len, int __advice) __attribute__ ((__nothrow__ , __leaf__)); > extern int posix_madvise (void *__addr, size_t __len, int __advice) __attribute__ ((__nothrow__ , __leaf__)); > extern int mlock (const void *__addr, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); > extern int munlock (const void *__addr, size_t __len) __attribute__ ((__nothrow__ , __leaf__)); > extern int mlockall (int __flags) __attribute__ ((__nothrow__ , __leaf__)); > extern int munlockall (void) __attribute__ ((__nothrow__ , __leaf__)); > extern int mincore (void *__start, size_t __len, unsigned char *__vec) > __attribute__ ((__nothrow__ , __leaf__)); > > # 133 "/usr/include/sys/mman.h" 3 4 > > extern void *mremap (void *__addr, size_t __old_len, size_t __new_len, > int __flags, ...) __attribute__ ((__nothrow__ , __leaf__)); > extern int remap_file_pages (void *__start, size_t __size, int __prot, > size_t __pgoff, int __flags) __attribute__ ((__nothrow__ , __leaf__)); > extern int shm_open (const char *__name, int __oflag, mode_t __mode); > extern int shm_unlink (const char *__name); > ------------------------------------------------------------------------------------------------------- > > FYI: > > On the platform: > > - Ubuntu 22.10 kinetic kudu > - gcc 12.2.0 > - same 6.2-rc2 > > , MADV_PAGEOUT is also defined in bits/mmap-linux.h, so the compile passes. > > root@marvin-IdeaPad-3-15ITL6:/home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/vm# grep MADV_PAGEOUT -r /usr/include > /usr/include/asm-generic/mman-common.h:#define MADV_PAGEOUT 21 /* reclaim these pages */ > /usr/include/x86_64-linux-gnu/bits/mman-linux.h:# define MADV_PAGEOUT 21 /* Reclaim these pages. */ > root@marvin-IdeaPad-3-15ITL6:/home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/vm# grep MADV_PAGEOUT -r ../../../../usr/include > ../../../../usr/include/asm-generic/mman-common.h:#define MADV_PAGEOUT 21 /* reclaim these pages */ > root@marvin-IdeaPad-3-15ITL6:/home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/vm# > > However, mman-common.h from ../../../../usr/include/asm-generic/mman-common.h is also not included, > as of "gcc -E", but only bits/mman-linux.h: > > root@marvin-IdeaPad-3-15ITL6:/home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/vm# gcc -Wall -E -I /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/../../.. -I /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/../../../usr/include -isystem /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/../../../usr/include -no-pie cow.c | grep mman-common.h > root@marvin-IdeaPad-3-15ITL6:/home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/vm# gcc -Wall -E -I /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/../../.. -I /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/../../../usr/include -isystem /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/../../../usr/include -no-pie cow.c | grep mman-linux.h > # 1 "/usr/include/x86_64-linux-gnu/bits/mman-linux.h" 1 3 4 > # 119 "/usr/include/x86_64-linux-gnu/bits/mman-linux.h" 3 4 > # 120 "/usr/include/x86_64-linux-gnu/bits/mman-linux.h" 2 3 4 > root@marvin-IdeaPad-3-15ITL6:/home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/vm# > > 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. -- Thanks, David / dhildenb