Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7776243rwl; Tue, 10 Jan 2023 05:23:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXvWVctD/4pick0Dv9jnK6bqLcc3kKhPqxUaIwyBlJSjO/z37PVZ98d24XgtrxXLZYiXaq7b X-Received: by 2002:a05:6402:f1e:b0:499:cc2c:bf6f with SMTP id i30-20020a0564020f1e00b00499cc2cbf6fmr1802743eda.35.1673356990996; Tue, 10 Jan 2023 05:23:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673356990; cv=none; d=google.com; s=arc-20160816; b=hubVMje9gFCzx6kB5JTzzA4S1RMzd8ZKZq3gzJzNPevQAgqPQr1sHB6wxLAmE48nnM SaTZH5FFxfH/GPthedVy5ZOsjnmCk/blwt+hzxEG+D3lKjWgu43gDudDgSLVE+0h6DzJ 8k4vLEd9VRM/VpB6ZF6MtwaXdDqCR4rkUSYKpHAE8GeXQRVW/zLl6GuFxnYge91eczc1 D36MP3aiCC6FrizCvnlbujRnDBmVn2DiOsE/Xk3iy7I4GHTTililtHqQc/g0z7t9erCh zwasN8l5jyibOWfaUMSdFEMcSaVNkW5FI70/ryQQjfLHUrJ5MTcEATvc/aNgQwUZozHu ptjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=XzR3xdR9VyYndK6DHw1j1LjNOsVbnmoE1ecwIQrY1G0=; b=XEzv0B23ZpGkASfO3EhHVhkiRi4hmPHlexfBr4ugZmnhR/L4Q36i37ARAr+p2Ft/x/ 0vftlJx07ifXbyfatXescQIEtwX89/zy0uKoKQypF/BkXIE4Mx3ERFAHjuBEypZ6NWFp JzhV3ZoF7Rj5+4YCzOdW6DOZTC6ZJg6NZaYEI9Fw4Ri1L8wga+Y6mTBsc0lj15p8hsDc HqA1OiSyfflhq0PdQJq10663EgF5Lg4163GKl3vGbVJaNnH7scZD9OHlSEcHh365TKkR 0hI8B0Kod9AuHtbDWJ/8O3688K4uL/ZkGThfXmNfQXyRJRtRbk0JzcObQfFRU44Hl0uu iHSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=xKLD1GvL; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b="mBcV/UXg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id by12-20020a0564021b0c00b00485a5f6323bsi10437981edb.12.2023.01.10.05.22.57; Tue, 10 Jan 2023 05:23:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=xKLD1GvL; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b="mBcV/UXg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238153AbjAJM0H (ORCPT + 53 others); Tue, 10 Jan 2023 07:26:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231558AbjAJMZb (ORCPT ); Tue, 10 Jan 2023 07:25:31 -0500 Received: from domac.alu.hr (domac.alu.unizg.hr [161.53.235.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F0095F9D; Tue, 10 Jan 2023 04:25:29 -0800 (PST) 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-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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