Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1765941pxb; Thu, 14 Apr 2022 13:36:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwapOFI2r8DCHXW0Iakw8lEZjkenfp4STmuencmvc1zwv4ARzIdUSveHdABOGIOzOAb+ZCV X-Received: by 2002:a05:6402:14ce:b0:41d:7cab:b31b with SMTP id f14-20020a05640214ce00b0041d7cabb31bmr4934859edx.273.1649968602036; Thu, 14 Apr 2022 13:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649968602; cv=none; d=google.com; s=arc-20160816; b=oB/ba09zH98yIGF7SCMR5ypvJefgaVp0LgF68HSkDKwJPJMJ7fHn5EhbzXwKyD5/Nz GJjK8idZLf0F0mXFZpNBErermIGBOzquOpf884dY90SuVz2xlxBaV/h2AQHyEr+X/3wB 37uMmaBUlgmVbIXh++e5caSXTZqE/YSun+9f3l6qoKfu5e66k/sxOj1RWXnRAwuGz/b9 qB33rTheKUoh6Y9FnkSZW1ZsZpWFj5rZf9ZYOmPze22RzeJf2RuTJRNVqWatU/waqhEb EeYK+yhp3OMmF6AbqzIKHptrSr150MMqJHGqf/0AY9lbHA2EIdG3ukQk+D8vvah2s0Px Oasw== 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:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=ehEw6AcjvvHLNdKH7BwqeV1pdlUFH+fNGQaoXoy/hk8=; b=g4POEuOC6CYIYgGdL7qPdhsHzuVVyJQsILrVChUH6hYKAoJskZD08qu5Hv7ZckkLug K9DuMtgolbXiCBxCbFCJZEiN0nk/J9p/A2W3nYfQZBUiR937jeV6NuWDi9hFhyR10Cj8 LqWjXkAzfvfTEStpg+26vOxgQJ7UrJklTdTLZ8HpeWM1bD4N+YV4D0VWBSGzULRIiulL rPNdklFiZbRVB8vfpt6IM5XZU1zx2rJGrL2o0CMNojVqQ9fJsEDDbsh0cw81G0XlXmp1 bM01sKgURKGyPEMt/f7vrDUJl9GEwaWBO0qw7/aRKgu7e8C8F+q2iMkWa/MIRsj6WHFp ioRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=BxsBZjuv; 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=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r15-20020a17090638cf00b006e7d2a018a5si2501278ejd.61.2022.04.14.13.36.17; Thu, 14 Apr 2022 13:36:42 -0700 (PDT) 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=pass header.i=@collabora.com header.s=mail header.b=BxsBZjuv; 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=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242572AbiDNLNK (ORCPT + 99 others); Thu, 14 Apr 2022 07:13:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242637AbiDNLMm (ORCPT ); Thu, 14 Apr 2022 07:12:42 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C770275F1; Thu, 14 Apr 2022 04:10:17 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: usama.anjum) with ESMTPSA id BD45B1F47906 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1649934616; bh=+NgjZupD5wwEYhR/W/dOI+H5h6tCv9XM0TMTi/9Tyz0=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=BxsBZjuvqoMbUGWzaRqZe6oW3kPle+jm4aysOI5Urd2tndHUzND+x84Rz86d1Rn+q Dvig8HifOmU0FaSAxecqAfwb/YP7wMVwIPZeENHQy227JbZlp/MWvLH5p4ai+s3OWI n9uhf6JnIldCn9u++GCyNTh+FDhPWZGpHsujWGWpuMJT1mGDy5VozrKjts6wMxXsF0 yuL4kb9MPc5mPPoJMLgb7t12O/lQTjkFfx5YQ9mV/MqygFDRSu1RhSW97tuQWvTu1F MZkWinPXvNx0YSgfpC6l9efecBh9syqJWtcImv+NZD47Mw4kkcj+pbTnG97QtacyLW gTeJVQO4g7J/A== Message-ID: Date: Thu, 14 Apr 2022 16:10:06 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Cc: usama.anjum@collabora.com, Michal Marek , Nick Desaulniers , kernel@collabora.com, kernelci@groups.io, Kees Cook , Linux Kbuild mailing list , Linux Kernel Mailing List , Greg Kroah-Hartman Subject: Re: [PATCH] Makefile: Fix separate output directory build of kselftests Content-Language: en-US To: Masahiro Yamada , Shuah Khan , "open list:KERNEL SELFTEST FRAMEWORK" References: <20220223191016.1658728-1-usama.anjum@collabora.com> <63c5d7ad-b0b2-9b37-16c3-354ac10858b6@collabora.com> From: Muhammad Usama Anjum In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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 Hi, At this time: make kselftest-all (works) make kselftest-all O=/tmp (works) make kselftest-all O=build (doesn't work, investigation was shared) make kselftest-all O=build/build2 (works) I'd shared my final thoughts in the last email. I don't see any other solution. If anybody has any other thoughts on how to cleanly fix `make kselftest-all O=build`, do share. Thanks, Usama On 4/4/22 4:09 PM, Muhammad Usama Anjum wrote: > From [Makefile](https://elixir.bootlin.com/linux/latest/source/Makefile): > ``` > ifeq ($(abs_srctree),$(abs_objtree)) > # building in the source tree > srctree := . > building_out_of_srctree := > else > ifeq ($(abs_srctree)/,$(dir $(abs_objtree))) > # building in a subdirectory of the source tree > srctree := .. > else > srctree := $(abs_srctree) > endif > building_out_of_srctree := 1 > endif > ``` > `ifeq ($(abs_srctree)/,$(dir $(abs_objtree)))` condition is setting > `srctree` to `..`. This is wrong. This condition isn't considering that > `header_install` doesn't depend on `abs_srctree and abs_objtree`. This > condition needs to be tweaked or removed for the `install_headers` to > work fine and fix this issue. I've added `KBUILD_ABS_SRCTREE=1` to the > kselftest target which sets the `srctree` to `abs_srctree` and thus > forcefully affecting only kselftest targets. This seems like the clean > fix. Alternatively we should remove this condition `ifeq > ($(abs_srctree)/,$(dir $(abs_objtree)))` but it'll affect other targets > as well. > > Complete details of investigation can be found here: > https://github.com/kernelci/kernelci-project/issues/92#issuecomment-1087406222 > > On 3/17/22 11:08 PM, Masahiro Yamada wrote: >> On Thu, Mar 17, 2022 at 7:49 PM Muhammad Usama Anjum >> wrote: >>> >>> Reminder. Shuah is okay with this patch. Any thoughts? >> >> I do not think this is the right fix, >> but something you just happen to find working. >> >> >> The Make is working in a wrong directory, that is why >> the relative path does not work >> (and you use the absolute path to work around it) >> > `ifeq ($(abs_srctree)/,$(dir $(abs_objtree))) \ srctree := ..` has > broken the `make headers_install` when called through > selftests/Makefile. We can remove it or use the absolute path each time. > -- Muhammad Usama Anjum