From patchwork Thu Mar 26 03:07:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Xiaoyao Li X-Patchwork-Id: 11459159 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 605B9161F for ; Thu, 26 Mar 2020 03:26:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F4522078A for ; Thu, 26 Mar 2020 03:26:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728065AbgCZDZc (ORCPT ); Wed, 25 Mar 2020 23:25:32 -0400 Received: from mga18.intel.com ([134.134.136.126]:53303 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727655AbgCZDZb (ORCPT ); Wed, 25 Mar 2020 23:25:31 -0400 IronPort-SDR: A0ca+m0uqk9CJSzqnYPy6jmOuyV3xfxzkHJ1fPWbxxVjBOo++XfBqmPbPq0iJfsmkH63Oc/0lr m8r2mBIHAuZg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2020 20:25:30 -0700 IronPort-SDR: QUWJw+k2SY1p2euzekEuWODO1srN4VcPBN5w3SVYTpBm5hdqfTmPNWSMrZB6PcwIzxiMLBhgGB 6bFumWCvIg/w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,306,1580803200"; d="scan'208";a="446842817" Received: from lxy-clx-4s.sh.intel.com ([10.239.43.39]) by fmsmga005.fm.intel.com with ESMTP; 25 Mar 2020 20:25:29 -0700 From: Xiaoyao Li To: Paolo Bonzini , Shuah Khan Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Xiaoyao Li Subject: [RFC v3 1/3] kvm: selftests: Fix no directory error when OUTPUT specified Date: Thu, 26 Mar 2020 11:07:48 +0800 Message-Id: <20200326030750.173972-2-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200326030750.173972-1-xiaoyao.li@intel.com> References: <20200326030750.173972-1-xiaoyao.li@intel.com> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org When build kvm selftests to an specified directory with make OUTPUT=/home/lxy/kvm-selftests it encouters following error: /usr/bin/ld: cannot open output file /home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test: No such file or directory collect2: error: ld returned 1 exit status make: *** [../lib.mk:141: /home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test] Error 1 Use "mkdir -p" to create the directory to fix this issue. Signed-off-by: Xiaoyao Li --- tools/testing/selftests/kvm/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index 67abc1dd50ee..91b41092def6 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -65,6 +65,7 @@ LDFLAGS += -pthread $(no-pie-option) $(pgste-option) # After inclusion, $(OUTPUT) is defined and # $(TEST_GEN_PROGS) starts with $(OUTPUT)/ include ../lib.mk +x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS)))) STATIC_LIBS := $(OUTPUT)/libkvm.a LIBKVM_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM)) From patchwork Thu Mar 26 03:07:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoyao Li X-Patchwork-Id: 11459155 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C924B161F for ; Thu, 26 Mar 2020 03:25:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B34C020746 for ; Thu, 26 Mar 2020 03:25:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728078AbgCZDZd (ORCPT ); Wed, 25 Mar 2020 23:25:33 -0400 Received: from mga18.intel.com ([134.134.136.126]:53303 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728071AbgCZDZc (ORCPT ); Wed, 25 Mar 2020 23:25:32 -0400 IronPort-SDR: 2ZvOUvFipgrtC/+/70ki8SQTCD2EciENnR1DkuLtrmxuJkLUe2ZZIelbXkoam92TicHItSBPgI oSHgj8ykiqJQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2020 20:25:32 -0700 IronPort-SDR: SMMRikgTPE1BcG7jtXIb5vkDyaUwV+cFjknm+8Pef9Wx1N2s5y6KaUmgAuJjGnWo4Z1wP4+mWG cRwc21N7b/sg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,306,1580803200"; d="scan'208";a="446842824" Received: from lxy-clx-4s.sh.intel.com ([10.239.43.39]) by fmsmga005.fm.intel.com with ESMTP; 25 Mar 2020 20:25:30 -0700 From: Xiaoyao Li To: Paolo Bonzini , Shuah Khan Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Xiaoyao Li Subject: [RFC v3 2/3] kvm: selftests: Use the right INSTALL_HDR_PATH when OUTPUT specified and MAKELEVEL is 0 Date: Thu, 26 Mar 2020 11:07:49 +0800 Message-Id: <20200326030750.173972-3-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200326030750.173972-1-xiaoyao.li@intel.com> References: <20200326030750.173972-1-xiaoyao.li@intel.com> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Assume linux headers exist in linux_src/usr works with OUTPUT specified currently, even though headers are installed to $(OUTPUT)/usr based on lib.mk. Because there are building output in linux_src/usr when "make headers_install" to prepare headers and they are not cleaned. Assign the correct path to INSTALL_HDR_PATH is always not bad. Signed-off-by: Xiaoyao Li --- tools/testing/selftests/kvm/Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index 91b41092def6..6a95878b2ab7 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -43,7 +43,15 @@ TEST_GEN_PROGS_s390x += kvm_create_max_vcpus TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M)) LIBKVM += $(LIBKVM_$(UNAME_M)) -INSTALL_HDR_PATH = $(top_srcdir)/usr +ifeq (0,$(MAKELEVEL)) + ifneq ($(OUTPUT),) + INSTALL_HDR_PATH := $(OUTPUT)/usr + else + INSTALL_HDR_PATH := $(top_srcdir)/usr + endif +else + INSTALL_HDR_PATH := $(top_srcdir)/usr +endif LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/ LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/x86/include From patchwork Thu Mar 26 03:07:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Xiaoyao Li X-Patchwork-Id: 11459143 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7D7F161F for ; Thu, 26 Mar 2020 03:25:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A113920848 for ; Thu, 26 Mar 2020 03:25:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728095AbgCZDZf (ORCPT ); Wed, 25 Mar 2020 23:25:35 -0400 Received: from mga18.intel.com ([134.134.136.126]:53303 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728091AbgCZDZe (ORCPT ); Wed, 25 Mar 2020 23:25:34 -0400 IronPort-SDR: l6DxRvyZmYypsM5UXg0z+8FoC/FymFGj+N/iYD65bXOgNEmPckZj6A3BkcR/t10z/yd4jsP+vW A27dT4u8fDLQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2020 20:25:33 -0700 IronPort-SDR: LXjqAhcF6kDMzEy0by7c8b642y5+g9LGiqo6QedAJkauKrkA6dwIpeKt0KeAqWEHLG3W8rhJqF tz6vmJ2tAl3g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,306,1580803200"; d="scan'208";a="446842833" Received: from lxy-clx-4s.sh.intel.com ([10.239.43.39]) by fmsmga005.fm.intel.com with ESMTP; 25 Mar 2020 20:25:32 -0700 From: Xiaoyao Li To: Paolo Bonzini , Shuah Khan Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Xiaoyao Li Subject: [RFC v3 3/3] kvm: selftests: Fix header path when built from parent level with O specified Date: Thu, 26 Mar 2020 11:07:50 +0800 Message-Id: <20200326030750.173972-4-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200326030750.173972-1-xiaoyao.li@intel.com> References: <20200326030750.173972-1-xiaoyao.li@intel.com> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org When build kvm selftests in tools/testing/selftests directory with make O=/home/lxy/kselftests TARGETS=kvm it fails building some kvm test binaries due to lack of header files, e.g., x86_64/vmx_set_nested_state_test.c: In function ‘set_default_vmx_state’: x86_64/vmx_set_nested_state_test.c:85:7: error: ‘struct kvm_nested_state’ has no member named ‘hdr’ state->hdr.vmx.vmxon_pa = 0x1000; ... With "O" is specified, it also takes effect on "make headers_install", which causes no header files generated in "kernel-src/usr". Fix INSTALL_HDR_PATH with correct path for this case. Opportunistically fix the case when KBUILD_OUTPUT specified as well, even though it can work currently. Signed-off-by: Xiaoyao Li --- tools/testing/selftests/kvm/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index 6a95878b2ab7..bf8f56488914 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -50,7 +50,11 @@ ifeq (0,$(MAKELEVEL)) INSTALL_HDR_PATH := $(top_srcdir)/usr endif else + ifneq ($(O)$(KBUILD_OUTPUT),) + INSTALL_HDR_PATH := $(BUILD)/usr + else INSTALL_HDR_PATH := $(top_srcdir)/usr + endif endif LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/ LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include