From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44A0128C850 for ; Wed, 7 May 2025 20:50:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746651058; cv=none; b=eAoPs+myX3cKDv+bB3Suoh5LHSfuhp8/Al744DqL4m1iN1Wt2v8TmDRoqSpSF4ozHEQ41AykNC1wK9CkmHYvJdNAU3VtCZCOKgENDjYGJR4ZOzrTHko4iibQWo2gLpu8E7l6T5pYuKfnbwoPIT+Pz4jN8cy9tWX4KGG1ck+Gg9U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746651058; c=relaxed/simple; bh=aK1tvNbc65kXi4eTJ4y1WbB1Yq7chC+uIx6eWtLwSdU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JKVcML9IAPD5wiVzkNviN70FhYVDoWpJA81DTVC2oMZofvIrkyFp+09Ug3BqyZLu6Or97Vh9eg/48zLauJDsRUbj2fBBBFRr1GMYJlGkn+kvo0byAxhc08mjv0Fmi5fUxF99X5Pb452+0bLGrKPYvfhmitoGuMYGIl/MeF8RQsE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Qn+qzhC4; arc=none smtp.client-ip=209.85.166.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Qn+qzhC4" Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-86192b64d0bso16215539f.3 for ; Wed, 07 May 2025 13:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1746651055; x=1747255855; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=l1i3VA5pX+AnNv8o3MlfdxwnFv3V4vTyMLMmTMdRyK8=; b=Qn+qzhC4kB08fRop1tL1Iw9IMdwEJAfD0hq8Ox0Hv6jGnIQyF0UH9FAvWsOriDQXX4 6FAMtzPouqa55+FvAwhiBkAImQ9BQhM7X4j3ZVCXf6sDG8WgVh0DBlHSvI6nP3ppFnzY h40Zw77fSuU8H+dF0FMKaPFsZHo5iUhTgXuUk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746651055; x=1747255855; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=l1i3VA5pX+AnNv8o3MlfdxwnFv3V4vTyMLMmTMdRyK8=; b=LdXE9N0ZNZZEeK/V3nTBGMPZL8vLMvrc1JDVoSVzRidOoD4Apn2gHFfJuuOp276b3W cngkUtTfnh9kDz0I4avNVUGlC+hYsaPbZn+TFuC3fwjag7Mx9lxutN+oYJbJ2MhsTHxj uKyXQLCBTUNuEY7q+IKu3kJfdfETIUBHmemRiBGVKSSBAk/JHqWXZ2XqSjNDCKRa4MBP V6sQ1Ex7705bMQjOb6PqI+t6wKoZoBrUHnfIhxea3A4FrrG212p8kBttOtcn1aLbOrQ6 5VDXs47huLlIKTnGuhT5iFgT6GyL+oPHIk17dJLi43qA1ltvKfim0XSxxFBfFshtrZSh N5yg== X-Forwarded-Encrypted: i=1; AJvYcCWylcN040V03OyM1oX3S/BCb5i7nkKUGk+M0hSIrYAZ6SFPwwNvWPomE1kAEB6kPtM/RZjgZjzJk2U=@vger.kernel.org X-Gm-Message-State: AOJu0Yxi2dzQR3icusmN+QioUDOLzpawtBHs8gnk8J4qahD16a1a2uM2 atGGsFu8ZDXZnhoNbCzSZNmUV829/d4p37Kc8X7H7qtDqTclzABRxVNDtuG5EJM= X-Gm-Gg: ASbGncsg33oKh+Mk/jcHZC1HyKeuU5f/sF58fshK/J6k0gCBCUKENOHUyWNW/O67sbu jQXbmpm7J5WiNiVK/Z6iARzF6+Aqi8GvfM1AywV/t0Zr0sGJti9vuls3c1oUZPtfun5ndSz/yk4 uc2QHPUSJD9tMOI2AAOc1MeOiY1HOfQ+8ar/SFX8lF83qnOArIf48PUy+K5r+ZFDssBd/X3/oGc 7E3+yb5RIpq5h54HMEJKbEuAvDhh1GNYuPRVdafp2PbXXfLy/0KqTHJ5GMXnHgrINfU5i4zCqT1 vLZRh7os75kzqZ2MhUS+2Vb8zi7P161qCP01zzYYKYLuUlh8g0I= X-Google-Smtp-Source: AGHT+IGXfbY2TdlADjhrlZDdaegNr623acfnrkFbqKORg+uz4s4neNOrD9k8reaOICCdp3cse52JQw== X-Received: by 2002:a05:6e02:1489:b0:3d9:5d50:e3b1 with SMTP id e9e14a558f8ab-3da739304a7mr62088825ab.18.1746651055223; Wed, 07 May 2025 13:50:55 -0700 (PDT) Received: from [192.168.1.14] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3d975eca7b6sm31478705ab.38.2025.05.07.13.50.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 May 2025 13:50:54 -0700 (PDT) Message-ID: Date: Wed, 7 May 2025 14:50:53 -0600 Precedence: bulk X-Mailing-List: linux-api@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: The "make headers" requirement, revisited: [PATCH v3 3/3] selftests: pidfd: add tests for PIDFD_SELF_* To: John Hubbard , Peter Zijlstra Cc: Shuah Khan , "Liam R . Howlett" , Suren Baghdasaryan , Vlastimil Babka , pedro.falcato@gmail.com, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Sang , Christian Brauner , Lorenzo Stoakes References: <6dd57f0e-34b4-4456-854b-a8abdba9163b@nvidia.com> <3687348f-7ee0-4fe1-a953-d5a2edd02ce8@nvidia.com> Content-Language: en-US From: Shuah Khan In-Reply-To: <3687348f-7ee0-4fe1-a953-d5a2edd02ce8@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 10/17/24 10:47, John Hubbard wrote: > On 10/17/24 9:33 AM, Shuah Khan wrote: >> On 10/16/24 20:01, John Hubbard wrote: >>> On 10/16/24 1:00 PM, Shuah Khan wrote: >>>> On 10/16/24 04:20, Lorenzo Stoakes wrote: > ... >>> The requirement to do "make headers" is not a keeper. Really. >> >> The reason we added the requirement to avoid duplicate defines >> such as this one added to kselftest source files. These are >> error prone and hard to resolve. >> >> In some cases, these don't become uapi and don't make it into >> system headers. selftests are in a category of depending on >> kernel headers to be able to test some features. >> >> Getting rid of this dependency mean, tests will be full of local >> defines such as this one which will become unmanageable overtime. > > Not if we do it correctly...Please do look at the reference I provided > for how that works. Here is is again: [1]. > > The basic idea, which has been discussed and reviewed, is to take > very occasional snapshots and drop them into a static location where > they are available for kselftests, without disurbing other things: > $(top_srcdir)/tools/include/uapi > > This has worked well so far. > >> >> The discussion should be: "How do we get rid of the dependency without >> introducing local defines?" not just "Let's get rid of the dependency" >> > > Yes. Good. We are apparently in violent agreement, because a few lines above, > I wrote: > >     The requirement to do "make headers" is not a keeper. > > The "make headers" is the problem, not the fact that we need to depend > on various includes. And so the solution stops requiring "make headers". > It gets the includes from a less volatile location. > > Yes? > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e076eaca5906 > > thanks, Posting this on this thread as well - Peter, John, There seems to be confusion regarding KHDR_INCLUDES. Tests don't have to use KHDR_INCLUDES if they don't want to. There are 4623 test Makefiles (excluding the main Makefile) under selftests/. Out of those 73 Makefiles reference KHDR_INCLUDES exported by lib.mk and selftests/Makefile. The rest are happy with system headers. The support for this KHDR_INCLUDES was added just for the case when a new test depends on header change. This is the reason why only a few test Makefiles use it. When test rings ran into issues related to dependencies between header changes, we recommended installing headers to solve the problem and introduced KHDR_INCLUDES so test Makefiles can use it in their Makefiles overriding the framework defaults. If your test doesn't need it, you can simply stop referencing it or use the approach used in mm test. It is a manual step. Works well for developers who know what they are doing. This isn't ideal for test rings. This isn't an ideal solution really. It works for the mm developers. # In order to use newer items that haven't yet been added to the user's system # header files, add $(TOOLS_INCLUDES) to the compiler invocation in each # each selftest. # You may need to add files to that location, or to refresh an existing file. In # order to do that, run "make headers" from $(top_srcdir), then copy the # header file that you want from $(top_srcdir)/usr/include/... , to the matching # subdir in $(TOOLS_INCLUDE). TOOLS_INCLUDES := -isystem $(top_srcdir)/tools/include/uapi The issues Peter is seeing regarding KHDR_INCLUDES in the following tests can be easily fixed by simply changing the test Makefile. These aren't framework related. kvm/Makefile.kvm: -I ../rseq -I.. $(EXTRA_CFLAGS) $(KHDR_INCLUDES) x86/Makefile:CFLAGS := -O2 -g -std=gnu99 -pthread -Wall $(KHDR_INCLUDES) futex/functional/Makefile:INCLUDES := -I../include -I../../ $(KHDR_INCLUDES) futex/functional/Makefile:CFLAGS := $(CFLAGS) -g -O2 -Wall -pthread $(INCLUDES) $(KHDR_INCLUDES) You can make the change to remove the reference to KHDR_INCLUDES. If don't have the time/bandwidth to do it, I will take care of it. If test build fails, you can then figure out how to address that. Hopefully build issues related to header changes are infrequent. thanks, -- Shuah