From nobody Wed May 1 20:13:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1606144879; cv=none; d=zohomail.com; s=zohoarc; b=at4LCv2WogX+IMbgz96SnZ7lBZPR3egIeWtwYgHjJucVz0/cLFHt0oiyt0P8K7lMBNS9EEv+y1HZkGSGupNy4CynDyOAsHrn2ZhVnsL7Icrri/ghy0ZpYlJYUjT+18j+exKnUYHNuMRQiHQWxvvollrh19kaW97+6JsOILZG+lI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606144879; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jLxsRc45eh7UkRXObTXpepNvE2qyML0sy1x3+LOrMrU=; b=Y/sMb667ZAbQRbnR9piSqaQlkpeqJ2Lr/Y/8hrBxzhZ8Zoh8d/7THoPfuFOob5zT9vZweAAfCaUDvG0lHniGLte8Fcl3Nmk8zZHxy61F14Ev2rU9HAWuXEyA583cfgFXR926TREQkjOtfO8NODggBo7ZbBFGkA4BCX6KJR9nCEs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1606144878992444.40825529528297; Mon, 23 Nov 2020 07:21:18 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.34634.65783 (Exim 4.92) (envelope-from ) id 1khDeC-0006YU-Gf; Mon, 23 Nov 2020 15:20:56 +0000 Received: by outflank-mailman (output) from mailman id 34634.65783; Mon, 23 Nov 2020 15:20:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDeC-0006YN-Dh; Mon, 23 Nov 2020 15:20:56 +0000 Received: by outflank-mailman (input) for mailman id 34634; Mon, 23 Nov 2020 15:20:55 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDeB-0006YI-0G for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:20:55 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 00327f36-3284-496e-a046-bd44e03cc72f; Mon, 23 Nov 2020 15:20:53 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0EE9BAFC1; Mon, 23 Nov 2020 15:20:53 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDeB-0006YI-0G for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:20:55 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 00327f36-3284-496e-a046-bd44e03cc72f; Mon, 23 Nov 2020 15:20:53 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0EE9BAFC1; Mon, 23 Nov 2020 15:20:53 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 00327f36-3284-496e-a046-bd44e03cc72f X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606144853; h=from:from:reply-to: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=jLxsRc45eh7UkRXObTXpepNvE2qyML0sy1x3+LOrMrU=; b=k16gwm0wi2qK6YZWAoiu+PkDnP8FvHs/UO62GKE0xjxPSoa5xAIb1+r0jCUN9MbAZeXnM2 SxIq98z5NlP0LHrWdMs2WpMMTawp2zydAc8MY9kgDT6ubqqQEJB0apGraDjRGXbqu4b4kW ZaV8ZFz49CFhcc5hLEx8mVjtvejZfck= Subject: [PATCH v3 1/8] xen: fix build when $(obj-y) consists of just blanks From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini , Anthony Perard References: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Message-ID: <511be84d-9a13-17ae-f3d9-d6daf9c02711@suse.com> Date: Mon, 23 Nov 2020 16:20:52 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" This case can occur when combining empty lists obj-y :=3D ... obj-y +=3D $(empty) or obj-y :=3D $(empty) $(empty) where (only) blanks would accumulate. This was only a latent issue until now, but would become an active issue for Arm once lib/ gets populated with all respective objects going into the to be introduced lib.a. Also address a related issue at this occasion: When an empty built_in.o gets created, .built_in.o.d will have its dependencies recorded. If, on a subsequent incremental build, an actual constituent of built_in.o appeared, the $(filter-out ) would leave these recorded dependencies in place. But of course the linker won't know what to do with C header files. (The apparent alternative of avoiding to pass $(c_flags) or $(a_flags) would not be reliable afaict, as among these flags there may be some affecting information conveyed via the object file to the linker. The linker, finding inconsistent flags across object files, may then error out.) Using just $(obj-y) won't work either: It breaks when the same object file is listed more than once. Reported-by: Julien Grall Signed-off-by: Jan Beulich Acked-by: Wei Liu Reviewed-by: Anthony PERARD Reviewed-by: Bertrand Marquis --- xen/Rules.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/Rules.mk b/xen/Rules.mk index 333e19bec343..d5e5eb33de39 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -130,13 +130,13 @@ c_flags +=3D $(CFLAGS-y) a_flags +=3D $(CFLAGS-y) $(AFLAGS-y) =20 built_in.o: $(obj-y) $(extra-y) -ifeq ($(obj-y),) +ifeq ($(strip $(obj-y)),) $(CC) $(c_flags) -c -x c /dev/null -o $@ else ifeq ($(CONFIG_LTO),y) - $(LD_LTO) -r -o $@ $(filter-out $(extra-y),$^) + $(LD_LTO) -r -o $@ $(filter $(obj-y),$^) else - $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out $(extra-y),$^) + $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter $(obj-y),$^) endif endif =20 @@ -145,10 +145,10 @@ targets +=3D $(filter-out $(subdir-obj-y), $(obj-y)) = $(extra-y) targets +=3D $(MAKECMDGOALS) =20 built_in_bin.o: $(obj-bin-y) $(extra-y) -ifeq ($(obj-bin-y),) +ifeq ($(strip $(obj-bin-y)),) $(CC) $(a_flags) -c -x assembler /dev/null -o $@ else - $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out $(extra-y),$^) + $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter $(obj-bin-y),$^) endif =20 # Force execution of pattern rules (for which PHONY cannot be directly use= d). --=20 2.22.0 From nobody Wed May 1 20:13:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1606144901; cv=none; d=zohomail.com; s=zohoarc; b=UFUKXRSS8yfXU8Ue+W/SYOdsyRwIZL+eGMX5BV3bn9HBGuz8su11X4Ec7XqFSkaiHCXhtsLGxHtRxpPJVO4vfMRRGX3ZfXqRWqI53kBmv7JuQlB9qiSnKYi9wsqJaMcILAo5gx6zvy6/MdQD+y5k71txY9eson85KMIvr9rm+bU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606144901; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cuO4qVJ1llY0PSDhrVuUhRfZB05Gf7cWsKZi8aM03oE=; b=GblaKQP4uXut8lWSKW3I1amp4NED3du/60xNG0/vHlZheh40UjxqzNh51HSaLPwQOyfSeRqWAkRwIUfnnAawB83UfPB0f02Do5XrCPWqayILUyghtUcjZ1/haRt+c/vF4aMgNhLxFxq4lakoEp83kYfxJW2ceO9jnzX44S3dy4o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1606144901808864.0130008824144; Mon, 23 Nov 2020 07:21:41 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.34637.65796 (Exim 4.92) (envelope-from ) id 1khDed-0006eC-VE; Mon, 23 Nov 2020 15:21:23 +0000 Received: by outflank-mailman (output) from mailman id 34637.65796; Mon, 23 Nov 2020 15:21:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDed-0006e5-Ru; Mon, 23 Nov 2020 15:21:23 +0000 Received: by outflank-mailman (input) for mailman id 34637; Mon, 23 Nov 2020 15:21:22 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDec-0006du-J9 for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:21:22 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1625aba3-5ee8-4a01-9fc2-df14e972cbcb; Mon, 23 Nov 2020 15:21:21 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 91B61AF9E; Mon, 23 Nov 2020 15:21:20 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDec-0006du-J9 for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:21:22 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1625aba3-5ee8-4a01-9fc2-df14e972cbcb; Mon, 23 Nov 2020 15:21:21 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 91B61AF9E; Mon, 23 Nov 2020 15:21:20 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1625aba3-5ee8-4a01-9fc2-df14e972cbcb X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606144880; h=from:from:reply-to: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=cuO4qVJ1llY0PSDhrVuUhRfZB05Gf7cWsKZi8aM03oE=; b=lVpak4STOi/mO4KPxsT9oV8uBjAXmOU+ouQke8fqwI3v8KtrGsZapuH4IfJ5hsAU4Vfjfo DEUo7okw7j6LVAog0Yj37lAwfnK8iqAkFv2dfOhMxt3R8pcwQCYOAWnA0NL8qz/kz+CRXB RCMrQGqh//x4DRVBkB7na8+qka856E8= Subject: [PATCH v3 2/8] lib: collect library files in an archive From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini , Anthony Perard References: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Message-ID: <21714b83-8619-5aa9-be5b-3015d05a26a4@suse.com> Date: Mon, 23 Nov 2020 16:21:19 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" In order to (subsequently) drop odd things like CONFIG_NEEDS_LIST_SORT just to avoid bloating binaries when only some arch-es and/or configurations need generic library routines, combine objects under lib/ into an archive, which the linker then can pick the necessary objects out of. Note that we can't use thin archives just yet, until we've raised the minimum required binutils version suitably. Signed-off-by: Jan Beulich Acked-by: Julien Grall Acked-by: Wei Liu Reviewed-by: Anthony PERARD Reviewed-by: Bertrand Marquis --- xen/Rules.mk | 29 +++++++++++++++++++++++++---- xen/arch/arm/Makefile | 6 +++--- xen/arch/x86/Makefile | 8 ++++---- xen/lib/Makefile | 3 ++- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/xen/Rules.mk b/xen/Rules.mk index d5e5eb33de39..aba6ca2a90f5 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -41,12 +41,16 @@ ALL_OBJS-y +=3D $(BASEDIR)/xsm/built_in.o ALL_OBJS-y +=3D $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o ALL_OBJS-$(CONFIG_CRYPTO) +=3D $(BASEDIR)/crypto/built_in.o =20 +ALL_LIBS-y :=3D $(BASEDIR)/lib/lib.a + # Initialise some variables +lib-y :=3D targets :=3D CFLAGS-y :=3D AFLAGS-y :=3D =20 ALL_OBJS :=3D $(ALL_OBJS-y) +ALL_LIBS :=3D $(ALL_LIBS-y) =20 SPECIAL_DATA_SECTIONS :=3D rodata $(foreach a,1 2 4 8 16, \ $(foreach w,1 2 4, \ @@ -60,7 +64,14 @@ include Makefile # ------------------------------------------------------------------------= --- =20 quiet_cmd_ld =3D LD $@ -cmd_ld =3D $(LD) $(XEN_LDFLAGS) -r -o $@ $(real-prereqs) +cmd_ld =3D $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out %.a,$(real-prereqs))= \ + --start-group $(filter %.a,$(real-prereqs)) --end-group + +# Archive +# ------------------------------------------------------------------------= --- + +quiet_cmd_ar =3D AR $@ +cmd_ar =3D rm -f $@; $(AR) cPrs $@ $(real-prereqs) =20 # Objcopy # ------------------------------------------------------------------------= --- @@ -86,6 +97,10 @@ obj-y :=3D $(patsubst %/, %/built_in.o, $(obj-y)) # tell kbuild to descend subdir-obj-y :=3D $(filter %/built_in.o, $(obj-y)) =20 +# Libraries are always collected in one lib file. +# Filter out objects already built-in +lib-y :=3D $(filter-out $(obj-y), $(sort $(lib-y))) + $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS-y +=3D -DINIT_= SECTIONS_ONLY =20 ifeq ($(CONFIG_COVERAGE),y) @@ -129,7 +144,7 @@ include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk c_flags +=3D $(CFLAGS-y) a_flags +=3D $(CFLAGS-y) $(AFLAGS-y) =20 -built_in.o: $(obj-y) $(extra-y) +built_in.o: $(obj-y) $(if $(strip $(lib-y)),lib.a) $(extra-y) ifeq ($(strip $(obj-y)),) $(CC) $(c_flags) -c -x c /dev/null -o $@ else @@ -140,8 +155,14 @@ else endif endif =20 +lib.a: $(lib-y) FORCE + $(call if_changed,ar) + targets +=3D built_in.o -targets +=3D $(filter-out $(subdir-obj-y), $(obj-y)) $(extra-y) +ifneq ($(strip $(lib-y)),) +targets +=3D lib.a +endif +targets +=3D $(filter-out $(subdir-obj-y), $(obj-y) $(lib-y)) $(extra-y) targets +=3D $(MAKECMDGOALS) =20 built_in_bin.o: $(obj-bin-y) $(extra-y) @@ -155,7 +176,7 @@ endif PHONY +=3D FORCE FORCE: =20 -%/built_in.o: FORCE +%/built_in.o %/lib.a: FORCE $(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o =20 %/built_in_bin.o: FORCE diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 296c5e68bbc3..612a83b315c8 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -90,14 +90,14 @@ endif =20 ifeq ($(CONFIG_LTO),y) # Gather all LTO objects together -prelink_lto.o: $(ALL_OBJS) - $(LD_LTO) -r -o $@ $^ +prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS) + $(LD_LTO) -r -o $@ $(filter-out %.a,$^) --start-group $(filter %.a,$^) --= end-group =20 # Link it with all the binary objects prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_l= to.o $(call if_changed,ld) else -prelink.o: $(ALL_OBJS) FORCE +prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE $(call if_changed,ld) endif =20 diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 9b368632fb43..8f2180485b2b 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -132,8 +132,8 @@ EFI_OBJS-$(XEN_BUILD_EFI) :=3D efi/relocs-dummy.o =20 ifeq ($(CONFIG_LTO),y) # Gather all LTO objects together -prelink_lto.o: $(ALL_OBJS) - $(LD_LTO) -r -o $@ $^ +prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS) + $(LD_LTO) -r -o $@ $(filter-out %.a,$^) --start-group $(filter %.a,$^) --= end-group =20 # Link it with all the binary objects prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_l= to.o $(EFI_OBJS-y) FORCE @@ -142,10 +142,10 @@ prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$= (ALL_OBJS)) prelink_lto.o $ prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) preli= nk_lto.o FORCE $(call if_changed,ld) else -prelink.o: $(ALL_OBJS) $(EFI_OBJS-y) FORCE +prelink.o: $(ALL_OBJS) $(ALL_LIBS) $(EFI_OBJS-y) FORCE $(call if_changed,ld) =20 -prelink-efi.o: $(ALL_OBJS) FORCE +prelink-efi.o: $(ALL_OBJS) $(ALL_LIBS) FORCE $(call if_changed,ld) endif =20 diff --git a/xen/lib/Makefile b/xen/lib/Makefile index 53b1da025e0d..b8814361d63e 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -1,2 +1,3 @@ -obj-y +=3D ctype.o obj-$(CONFIG_X86) +=3D x86/ + +lib-y +=3D ctype.o From nobody Wed May 1 20:13:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1606144937; cv=none; d=zohomail.com; s=zohoarc; b=BpWE+/5mVTQ2GM27dYK9hlv2SIfAx2DAmoXlzMkRgkPWd0tyy1/kcTgcDaUSbmAmkika/ECSVsMuKFwYRNPlxFavzB0QABg55Mn9adfGi4ZciJcvbl1HsP/vf/ljxJDTEX/LepS57iKp8JKrmhpvfYxf49CfmO7MdXDo+VIz+Uc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606144937; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/ldUqwFP54C4R/7w401QZG+FeOKXlfpX2Gg3oaRW57A=; b=Bsf1qc0IzMmfymS+gH3DcZdoF2nYlukLalRskaRhtwkP/6xMqHdqy23xeqwcb2U684K5T2aTdjTvkyLE8SiaxajuTWOp2BUl/MoCR4sc58Rr1Lk9PD9DrRNxe372u+RzEtA6zXcf5+d2bQfuxHCxQHrEu3wsrRitqGJF6JXRWkI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1606144937648392.34427170690935; Mon, 23 Nov 2020 07:22:17 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.34643.65808 (Exim 4.92) (envelope-from ) id 1khDf9-0006kr-9O; Mon, 23 Nov 2020 15:21:55 +0000 Received: by outflank-mailman (output) from mailman id 34643.65808; Mon, 23 Nov 2020 15:21:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDf9-0006kk-5C; Mon, 23 Nov 2020 15:21:55 +0000 Received: by outflank-mailman (input) for mailman id 34643; Mon, 23 Nov 2020 15:21:53 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDf7-0006kV-Dm for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:21:53 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9e3d3f61-ee19-4ff6-b288-ca9cb0580c30; Mon, 23 Nov 2020 15:21:52 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A4AAFB00D; Mon, 23 Nov 2020 15:21:51 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDf7-0006kV-Dm for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:21:53 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9e3d3f61-ee19-4ff6-b288-ca9cb0580c30; Mon, 23 Nov 2020 15:21:52 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A4AAFB00D; Mon, 23 Nov 2020 15:21:51 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9e3d3f61-ee19-4ff6-b288-ca9cb0580c30 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606144911; h=from:from:reply-to: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=/ldUqwFP54C4R/7w401QZG+FeOKXlfpX2Gg3oaRW57A=; b=qiLShgIg0egBAZqvag3aTqfWVsVr6aQi7sHrBUi1VHu6DKM9gPe38Kua5oMXFYE4Eq7Vo0 a5EPQnG6qHxNRK0OdH+Gf7Y5W9u8JJNgRdBoqwgEm3uTMezxKV9jTTE6Ijl2G7bBf0A9fx bYSGyqYiPy3yF2TYewyibcq6zm6bOjA= Subject: [PATCH v3 3/8] lib: move list sorting code From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini References: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Message-ID: <9e855f2f-c654-6515-ae4f-9c69859c1c88@suse.com> Date: Mon, 23 Nov 2020 16:21:51 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Build the source file always, as by putting it into an archive it still won't be linked into final binaries when not needed. This way possible build breakage will be easier to notice, and it's more consistent with us unconditionally building other library kind of code (e.g. sort() or bsearch()). While moving the source file, take the opportunity and drop the pointless EXPORT_SYMBOL() and an unnecessary #include. Signed-off-by: Jan Beulich Acked-by: Wei Liu Reviewed-by: Bertrand Marquis --- xen/arch/arm/Kconfig | 4 +--- xen/common/Kconfig | 3 --- xen/common/Makefile | 1 - xen/lib/Makefile | 1 + xen/{common/list_sort.c =3D> lib/list-sort.c} | 2 -- 5 files changed, 2 insertions(+), 9 deletions(-) rename xen/{common/list_sort.c =3D> lib/list-sort.c} (98%) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index f5b1bcda0323..38b6c31ba5dd 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -56,9 +56,7 @@ config HVM def_bool y =20 config NEW_VGIC - bool - prompt "Use new VGIC implementation" - select NEEDS_LIST_SORT + bool "Use new VGIC implementation" ---help--- =20 This is an alternative implementation of the ARM GIC interrupt diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 3e2cf2508899..0661328a99e7 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -66,9 +66,6 @@ config MEM_ACCESS config NEEDS_LIBELF bool =20 -config NEEDS_LIST_SORT - bool - menu "Speculative hardening" =20 config SPECULATIVE_HARDEN_ARRAY diff --git a/xen/common/Makefile b/xen/common/Makefile index d109f279a490..332e7d667cec 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -21,7 +21,6 @@ obj-y +=3D keyhandler.o obj-$(CONFIG_KEXEC) +=3D kexec.o obj-$(CONFIG_KEXEC) +=3D kimage.o obj-y +=3D lib.o -obj-$(CONFIG_NEEDS_LIST_SORT) +=3D list_sort.o obj-$(CONFIG_LIVEPATCH) +=3D livepatch.o livepatch_elf.o obj-$(CONFIG_MEM_ACCESS) +=3D mem_access.o obj-y +=3D memory.o diff --git a/xen/lib/Makefile b/xen/lib/Makefile index b8814361d63e..764f3624b5f9 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -1,3 +1,4 @@ obj-$(CONFIG_X86) +=3D x86/ =20 lib-y +=3D ctype.o +lib-y +=3D list-sort.o diff --git a/xen/common/list_sort.c b/xen/lib/list-sort.c similarity index 98% rename from xen/common/list_sort.c rename to xen/lib/list-sort.c index af2b2f6519f1..f8d8bbf28178 100644 --- a/xen/common/list_sort.c +++ b/xen/lib/list-sort.c @@ -15,7 +15,6 @@ * this program; If not, see . */ =20 -#include #include =20 #define MAX_LIST_LENGTH_BITS 20 @@ -154,4 +153,3 @@ void list_sort(void *priv, struct list_head *head, =20 merge_and_restore_back_links(priv, cmp, head, part[max_lev], list); } -EXPORT_SYMBOL(list_sort); From nobody Wed May 1 20:13:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1606144965; cv=none; d=zohomail.com; s=zohoarc; b=KSCrTt0CK/qS60bjbkCtggj4dR3y32ahyjxCUYH+ymcrKWia3yn2YmjCFENWzhWPqgFLXGBI3rMvKclgPHbBnj5mX6VB39ysEuV3dIl9t7xv/0e0EGaS/5SSBotZnKggxhY7TrlTYEBXdyj/NeoXm+2wAY6R3cpOkOt7b46cSf0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606144965; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hAAsFxAwY1+LMn7V37iA5/bcKSLQ7I5O5Ww6wo1JjgI=; b=kghKq7uOqv8UPffWhmZuDOlDX7j8sgg6WtNiYIYqUczB7cyrskHT56KIlHhrsIKSWCWIxE5vNQ94TyWUvJMUhFdOK3yDGyhzZdetRuwA7id22KWJNotiZvddmN75JZBckVaczv82fz15RaSTePJoGaPdX7ObHGYSbAJH4ZdfbLA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1606144965229786.3661046076114; Mon, 23 Nov 2020 07:22:45 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.34647.65820 (Exim 4.92) (envelope-from ) id 1khDff-0006rE-HX; Mon, 23 Nov 2020 15:22:27 +0000 Received: by outflank-mailman (output) from mailman id 34647.65820; Mon, 23 Nov 2020 15:22:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDff-0006r7-EQ; Mon, 23 Nov 2020 15:22:27 +0000 Received: by outflank-mailman (input) for mailman id 34647; Mon, 23 Nov 2020 15:22:27 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDff-0006r0-1K for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:22:27 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 8b20ca46-c071-4c66-af73-a01d9b8724bb; Mon, 23 Nov 2020 15:22:26 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 52C8CAFD8; Mon, 23 Nov 2020 15:22:25 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDff-0006r0-1K for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:22:27 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 8b20ca46-c071-4c66-af73-a01d9b8724bb; Mon, 23 Nov 2020 15:22:26 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 52C8CAFD8; Mon, 23 Nov 2020 15:22:25 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8b20ca46-c071-4c66-af73-a01d9b8724bb X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606144945; h=from:from:reply-to: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=hAAsFxAwY1+LMn7V37iA5/bcKSLQ7I5O5Ww6wo1JjgI=; b=eLAR4Po6k9wxgEstIlr7BI75HvZw2KPCxVJw8xQ6BECGmLTNvihsJFNuSCqBvPq5q5o9KK ZrCGzdDy//vGRg/OZB4Ze+bIPSF2oCBccHRLptBa6nLUuPBkFJkAZ0aQjtEW+NJrfCEWVe pwfsznhTU1/M3SzQqlYzXclBYv7Lr7Q= Subject: [PATCH v3 4/8] lib: move parse_size_and_unit() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini References: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Message-ID: <489b3707-9e9c-184b-3e1f-1d28fd1fb0ee@suse.com> Date: Mon, 23 Nov 2020 16:22:24 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" ... into its own CU, to build it into an archive. Signed-off-by: Jan Beulich Acked-by: Julien Grall Acked-by: Wei Liu Reviewed-by: Bertrand Marquis --- xen/common/lib.c | 39 ---------------------------------- xen/lib/Makefile | 1 + xen/lib/parse-size.c | 50 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 39 deletions(-) create mode 100644 xen/lib/parse-size.c diff --git a/xen/common/lib.c b/xen/common/lib.c index a224efa8f6e8..6cfa332142a5 100644 --- a/xen/common/lib.c +++ b/xen/common/lib.c @@ -423,45 +423,6 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) #endif } =20 -unsigned long long parse_size_and_unit(const char *s, const char **ps) -{ - unsigned long long ret; - const char *s1; - - ret =3D simple_strtoull(s, &s1, 0); - - switch ( *s1 ) - { - case 'T': case 't': - ret <<=3D 10; - /* fallthrough */ - case 'G': case 'g': - ret <<=3D 10; - /* fallthrough */ - case 'M': case 'm': - ret <<=3D 10; - /* fallthrough */ - case 'K': case 'k': - ret <<=3D 10; - /* fallthrough */ - case 'B': case 'b': - s1++; - break; - case '%': - if ( ps ) - break; - /* fallthrough */ - default: - ret <<=3D 10; /* default to kB */ - break; - } - - if ( ps !=3D NULL ) - *ps =3D s1; - - return ret; -} - typedef void (*ctor_func_t)(void); extern const ctor_func_t __ctors_start[], __ctors_end[]; =20 diff --git a/xen/lib/Makefile b/xen/lib/Makefile index 764f3624b5f9..99f857540c99 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_X86) +=3D x86/ =20 lib-y +=3D ctype.o lib-y +=3D list-sort.o +lib-y +=3D parse-size.o diff --git a/xen/lib/parse-size.c b/xen/lib/parse-size.c new file mode 100644 index 000000000000..ec980cadfff3 --- /dev/null +++ b/xen/lib/parse-size.c @@ -0,0 +1,50 @@ +#include + +unsigned long long parse_size_and_unit(const char *s, const char **ps) +{ + unsigned long long ret; + const char *s1; + + ret =3D simple_strtoull(s, &s1, 0); + + switch ( *s1 ) + { + case 'T': case 't': + ret <<=3D 10; + /* fallthrough */ + case 'G': case 'g': + ret <<=3D 10; + /* fallthrough */ + case 'M': case 'm': + ret <<=3D 10; + /* fallthrough */ + case 'K': case 'k': + ret <<=3D 10; + /* fallthrough */ + case 'B': case 'b': + s1++; + break; + case '%': + if ( ps ) + break; + /* fallthrough */ + default: + ret <<=3D 10; /* default to kB */ + break; + } + + if ( ps !=3D NULL ) + *ps =3D s1; + + return ret; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ From nobody Wed May 1 20:13:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1606144988; cv=none; d=zohomail.com; s=zohoarc; b=CUEhk6695k7DEEXK5gLjPkiqliR9Ntelye7WGYNOFgA3ZbLSoyGdrTI21eecCJXX8Y1PyFEy8IF6YVbWRGTSFngupEo0yjb5Jl6uyQo7VGc7bms2ssopo37TuOIzjf9ljf5f6TDLrvUrtKem426w54NVEpQpaSq6DjKJ7TXKUGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606144988; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8fmfCVpbzWpimEPZJkVHrvDAFBSfAhhMSPnv3DhM26s=; b=FkdLlw3iHhC7DtfH3vEj1gn5mANY8oYKJ/SedzlCKIsTR8B6oKmnQ2ynoye56bv5XUSkGwIKjDEIYBwHZdh+y30u9E7bRCP6Qp4hzP8Qbp2CosH8Sy+AhdC5C71Jcyqds4nAGPIziabpT0a7s/3OZAlLq+TFYIoO59eSm7aWnuc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1606144988562236.83037171591877; Mon, 23 Nov 2020 07:23:08 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.34653.65831 (Exim 4.92) (envelope-from ) id 1khDg2-0006y3-Ql; Mon, 23 Nov 2020 15:22:50 +0000 Received: by outflank-mailman (output) from mailman id 34653.65831; Mon, 23 Nov 2020 15:22:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDg2-0006xw-NL; Mon, 23 Nov 2020 15:22:50 +0000 Received: by outflank-mailman (input) for mailman id 34653; Mon, 23 Nov 2020 15:22:50 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDg1-0006xj-Ve for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:22:50 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 542f9c41-7242-4cec-abaf-df9059b01856; Mon, 23 Nov 2020 15:22:49 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6E2D3B01E; Mon, 23 Nov 2020 15:22:48 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDg1-0006xj-Ve for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:22:50 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 542f9c41-7242-4cec-abaf-df9059b01856; Mon, 23 Nov 2020 15:22:49 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6E2D3B01E; Mon, 23 Nov 2020 15:22:48 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 542f9c41-7242-4cec-abaf-df9059b01856 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606144968; h=from:from:reply-to: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=8fmfCVpbzWpimEPZJkVHrvDAFBSfAhhMSPnv3DhM26s=; b=cAP4j0Jlb/yiQ5VcN3xmT3RACuC6QRyEliTufHXhlkCWrOFQixEZmfxEvq3Msqin4xANcX 83rnHESxwcz5adoXjHz5Sw01QyysMAwr73SWc+rdvz+bt36DKPg4i6Zw0XsTegqmD+l1Sl ubM2RYM0QTAwHx7mh9zBLlZju+VKhUA= Subject: [PATCH v3 5/8] lib: move init_constructors() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini , Anthony Perard References: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Message-ID: Date: Mon, 23 Nov 2020 16:22:47 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" ... into its own CU, for being unrelated to other things in common/lib.c. Signed-off-by: Jan Beulich Acked-by: Wei Liu Reviewed-by: Bertrand Marquis --- xen/common/lib.c | 14 -------------- xen/lib/Makefile | 1 + xen/lib/ctors.c | 25 +++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 xen/lib/ctors.c diff --git a/xen/common/lib.c b/xen/common/lib.c index 6cfa332142a5..f5ca179a0af4 100644 --- a/xen/common/lib.c +++ b/xen/common/lib.c @@ -1,6 +1,5 @@ #include #include -#include #include =20 /* @@ -423,19 +422,6 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) #endif } =20 -typedef void (*ctor_func_t)(void); -extern const ctor_func_t __ctors_start[], __ctors_end[]; - -void __init init_constructors(void) -{ - const ctor_func_t *f; - for ( f =3D __ctors_start; f < __ctors_end; ++f ) - (*f)(); - - /* Putting this here seems as good (or bad) as any other place. */ - BUILD_BUG_ON(sizeof(size_t) !=3D sizeof(ssize_t)); -} - /* * Local variables: * mode: C diff --git a/xen/lib/Makefile b/xen/lib/Makefile index 99f857540c99..72c72fffecf2 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -1,5 +1,6 @@ obj-$(CONFIG_X86) +=3D x86/ =20 +lib-y +=3D ctors.o lib-y +=3D ctype.o lib-y +=3D list-sort.o lib-y +=3D parse-size.o diff --git a/xen/lib/ctors.c b/xen/lib/ctors.c new file mode 100644 index 000000000000..5bdc591cd50a --- /dev/null +++ b/xen/lib/ctors.c @@ -0,0 +1,25 @@ +#include +#include + +typedef void (*ctor_func_t)(void); +extern const ctor_func_t __ctors_start[], __ctors_end[]; + +void __init init_constructors(void) +{ + const ctor_func_t *f; + for ( f =3D __ctors_start; f < __ctors_end; ++f ) + (*f)(); + + /* Putting this here seems as good (or bad) as any other place. */ + BUILD_BUG_ON(sizeof(size_t) !=3D sizeof(ssize_t)); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ From nobody Wed May 1 20:13:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1606145011; cv=none; d=zohomail.com; s=zohoarc; b=fskwhMwYjIY9+mMwBS3lsgag7IbwFGqknmnAMMI3mFEMATHxBJQCTMLshY+QUJE19DN30bcT7NG6WXX6Xw8UhAmDELeiQG4iqrzBdKVNuP6FBXeNgqySOVaYr2aPDiDXhiuTopJBEdwnAF5KCxpgWbfpR2YHWVG6W4x2st+3zbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606145011; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YDkXTDAOobi6xJ5cnvbE+OQk8dJ5rRtfEWvkVEPSe/g=; b=b2dAN1hGCXkziMH3EAUfMyXy9kIt8fars9udS3McfMtl73vZg6hd6uSUhNksL5jmnaqUHMJd1bnkg6ilJWn4WvgUDtPYkpCGxlEVufFXvsIix48DGsVvSHlKDoGqwkZGpCwr6lNtJBynNndpjmoBKXNPHWBAGuyjIFtbK2Bfjfw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 160614501173926.14693043963655; Mon, 23 Nov 2020 07:23:31 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.34660.65843 (Exim 4.92) (envelope-from ) id 1khDgQ-00077E-4v; Mon, 23 Nov 2020 15:23:14 +0000 Received: by outflank-mailman (output) from mailman id 34660.65843; Mon, 23 Nov 2020 15:23:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDgQ-000776-1e; Mon, 23 Nov 2020 15:23:14 +0000 Received: by outflank-mailman (input) for mailman id 34660; Mon, 23 Nov 2020 15:23:12 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDgO-00073t-Oc for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:23:12 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1bc9a156-806b-4d8c-9393-0b56d5cc388c; Mon, 23 Nov 2020 15:23:11 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 89CDCAE42; Mon, 23 Nov 2020 15:23:10 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDgO-00073t-Oc for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:23:12 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1bc9a156-806b-4d8c-9393-0b56d5cc388c; Mon, 23 Nov 2020 15:23:11 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 89CDCAE42; Mon, 23 Nov 2020 15:23:10 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1bc9a156-806b-4d8c-9393-0b56d5cc388c X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606144990; h=from:from:reply-to: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=YDkXTDAOobi6xJ5cnvbE+OQk8dJ5rRtfEWvkVEPSe/g=; b=fHNjIIwoFNC7QCFV0gmsGacLniA7WxmVKEa9wJhKeTuyLL28Nyd7eRk6ErHjwG0nr8aXCu XxzOy6heVKvj/P6p8XUsLV7LkhtiBUJIWjZg7tvO7PqnFkL3Svje7YoDdAB8mcqGbbcP4+ paH8s42GVGmzdI0cA+ZE5fQBrwvhbOU= Subject: [PATCH v3 6/8] lib: move rbtree code From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini , Anthony Perard References: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Message-ID: <749adfdd-70d6-c653-7fcf-dad13fd8463f@suse.com> Date: Mon, 23 Nov 2020 16:23:09 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Build this code into an archive, which results in not linking it into x86 final binaries. This saves about 1.5k of dead code. While moving the source file, take the opportunity and drop the pointless EXPORT_SYMBOL() and an instance of trailing whitespace. Signed-off-by: Jan Beulich Acked-by: Wei Liu Reviewed-by: Bertrand Marquis --- xen/common/Makefile | 1 - xen/lib/Makefile | 1 + xen/{common =3D> lib}/rbtree.c | 9 +-------- 3 files changed, 2 insertions(+), 9 deletions(-) rename xen/{common =3D> lib}/rbtree.c (98%) diff --git a/xen/common/Makefile b/xen/common/Makefile index 332e7d667cec..d65c9fe9cb4e 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -33,7 +33,6 @@ obj-y +=3D preempt.o obj-y +=3D random.o obj-y +=3D rangeset.o obj-y +=3D radix-tree.o -obj-y +=3D rbtree.o obj-y +=3D rcupdate.o obj-y +=3D rwlock.o obj-y +=3D shutdown.o diff --git a/xen/lib/Makefile b/xen/lib/Makefile index 72c72fffecf2..b0fe8c72acf5 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -4,3 +4,4 @@ lib-y +=3D ctors.o lib-y +=3D ctype.o lib-y +=3D list-sort.o lib-y +=3D parse-size.o +lib-y +=3D rbtree.o diff --git a/xen/common/rbtree.c b/xen/lib/rbtree.c similarity index 98% rename from xen/common/rbtree.c rename to xen/lib/rbtree.c index 9f5498a89d4e..95e045d52461 100644 --- a/xen/common/rbtree.c +++ b/xen/lib/rbtree.c @@ -25,7 +25,7 @@ #include =20 /* - * red-black trees properties: http://en.wikipedia.org/wiki/Rbtree=20 + * red-black trees properties: http://en.wikipedia.org/wiki/Rbtree * * 1) A node is either red or black * 2) The root is black @@ -223,7 +223,6 @@ void rb_insert_color(struct rb_node *node, struct rb_ro= ot *root) } } } -EXPORT_SYMBOL(rb_insert_color); =20 static void __rb_erase_color(struct rb_node *parent, struct rb_root *root) { @@ -467,7 +466,6 @@ void rb_erase(struct rb_node *node, struct rb_root *roo= t) if (rebalance) __rb_erase_color(rebalance, root); } -EXPORT_SYMBOL(rb_erase); =20 /* * This function returns the first node (in sort order) of the tree. @@ -483,7 +481,6 @@ struct rb_node *rb_first(const struct rb_root *root) n =3D n->rb_left; return n; } -EXPORT_SYMBOL(rb_first); =20 struct rb_node *rb_last(const struct rb_root *root) { @@ -496,7 +493,6 @@ struct rb_node *rb_last(const struct rb_root *root) n =3D n->rb_right; return n; } -EXPORT_SYMBOL(rb_last); =20 struct rb_node *rb_next(const struct rb_node *node) { @@ -528,7 +524,6 @@ struct rb_node *rb_next(const struct rb_node *node) =20 return parent; } -EXPORT_SYMBOL(rb_next); =20 struct rb_node *rb_prev(const struct rb_node *node) { @@ -557,7 +552,6 @@ struct rb_node *rb_prev(const struct rb_node *node) =20 return parent; } -EXPORT_SYMBOL(rb_prev); =20 void rb_replace_node(struct rb_node *victim, struct rb_node *new, struct rb_root *root) @@ -574,4 +568,3 @@ void rb_replace_node(struct rb_node *victim, struct rb_= node *new, /* Copy the pointers/colour from the victim to the replacement */ *new =3D *victim; } -EXPORT_SYMBOL(rb_replace_node); From nobody Wed May 1 20:13:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1606145033; cv=none; d=zohomail.com; s=zohoarc; b=Y0BFLC7Z7PbzHSbqcGfgz4ZsKNnZ/EehocMtfYOtDTnnmL68QJ2vx+H5xM4uErdz+28yhs3UfCStboQMWtNyzxfXIJkG6cXHLJ8Xt4CYwhnaG0N3J5cUGI0C4KovUcf7BSkWoeo8IielyOBm2WT5SqL9I4nBDyrS2i+F98QDLNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606145033; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=23oE8NeUoAj9T9FiFgiIcEmaLzXlZefKvQvHgfauRUg=; b=fyD5njgXTnETM4yk/TWWBUQEx1o+cf8/2YD5dPcW3O1VQJPzVv6T0R7EmM2lG8Ahe0AseWQae0ThdVauST9566P/yCEt4rotIwyJO96Ul/iMGmpUIy+LlM5hshsh9tn3flSwy/UBFEDDmQrfM2FxcmVdlW9qYJesdkVqvOrNfPk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1606145033487203.34170260616838; Mon, 23 Nov 2020 07:23:53 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.34670.65855 (Exim 4.92) (envelope-from ) id 1khDgn-0007F2-F6; Mon, 23 Nov 2020 15:23:37 +0000 Received: by outflank-mailman (output) from mailman id 34670.65855; Mon, 23 Nov 2020 15:23:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDgn-0007Ev-C4; Mon, 23 Nov 2020 15:23:37 +0000 Received: by outflank-mailman (input) for mailman id 34670; Mon, 23 Nov 2020 15:23:35 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDgl-0007EG-Ha for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:23:35 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fa93e399-45c3-45b4-8d0d-19fd44d70e05; Mon, 23 Nov 2020 15:23:34 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2EA1BAF9E; Mon, 23 Nov 2020 15:23:33 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDgl-0007EG-Ha for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:23:35 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fa93e399-45c3-45b4-8d0d-19fd44d70e05; Mon, 23 Nov 2020 15:23:34 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2EA1BAF9E; Mon, 23 Nov 2020 15:23:33 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: fa93e399-45c3-45b4-8d0d-19fd44d70e05 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606145013; h=from:from:reply-to: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=23oE8NeUoAj9T9FiFgiIcEmaLzXlZefKvQvHgfauRUg=; b=RjjNqObEtvRblsBMrTgZSuG0MDW0CYjNGXDJYciTv0qRDsjQc6MB8CuUscfPDTs8PqsRS7 VMjqLrLI+cRjq9sYcX7TICbCz6H1sAmT5xXSR8ZBWmk/2xtKmWHywazV64NPJwOK14/Do+ ntGtkPwlSvQeuBaxNuLPcCqfFZwKVNo= Subject: [PATCH v3 7/8] lib: move bsearch code From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini , Anthony Perard References: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Message-ID: <0b676274-e7a0-9591-ddc9-7c7d5c0e1e2d@suse.com> Date: Mon, 23 Nov 2020 16:23:32 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Convert this code to an inline function (backed by an instance in an archive in case the compiler decides against inlining), which results in not having it in x86 final binaries. This saves a little bit of dead code. Signed-off-by: Jan Beulich Acked-by: Wei Liu --- xen/common/Makefile | 1 - xen/common/bsearch.c | 51 -------------------------------------- xen/include/xen/compiler.h | 1 + xen/include/xen/lib.h | 42 ++++++++++++++++++++++++++++++- xen/lib/Makefile | 1 + xen/lib/bsearch.c | 13 ++++++++++ 6 files changed, 56 insertions(+), 53 deletions(-) delete mode 100644 xen/common/bsearch.c create mode 100644 xen/lib/bsearch.c diff --git a/xen/common/Makefile b/xen/common/Makefile index d65c9fe9cb4e..e8ce23acea67 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -1,6 +1,5 @@ obj-$(CONFIG_ARGO) +=3D argo.o obj-y +=3D bitmap.o -obj-y +=3D bsearch.o obj-$(CONFIG_HYPFS_CONFIG) +=3D config_data.o obj-$(CONFIG_CORE_PARKING) +=3D core_parking.o obj-y +=3D cpu.o diff --git a/xen/common/bsearch.c b/xen/common/bsearch.c deleted file mode 100644 index 7090930aab5c..000000000000 --- a/xen/common/bsearch.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * A generic implementation of binary search for the Linux kernel - * - * Copyright (C) 2008-2009 Ksplice, Inc. - * Author: Tim Abbott - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; version 2. - */ - -#include - -/* - * bsearch - binary search an array of elements - * @key: pointer to item being searched for - * @base: pointer to first element to search - * @num: number of elements - * @size: size of each element - * @cmp: pointer to comparison function - * - * This function does a binary search on the given array. The - * contents of the array should already be in ascending sorted order - * under the provided comparison function. - * - * Note that the key need not have the same type as the elements in - * the array, e.g. key could be a string and the comparison function - * could compare the string with the struct's name field. However, if - * the key and elements in the array are of the same type, you can use - * the same comparison function for both sort() and bsearch(). - */ -void *bsearch(const void *key, const void *base, size_t num, size_t size, - int (*cmp)(const void *key, const void *elt)) -{ - size_t start =3D 0, end =3D num; - int result; - - while (start < end) { - size_t mid =3D start + (end - start) / 2; - - result =3D cmp(key, base + mid * size); - if (result < 0) - end =3D mid; - else if (result > 0) - start =3D mid + 1; - else - return (void *)base + mid * size; - } - - return NULL; -} diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h index c0e0ee9f27be..2b7acdf3b188 100644 --- a/xen/include/xen/compiler.h +++ b/xen/include/xen/compiler.h @@ -12,6 +12,7 @@ =20 #define inline __inline__ #define always_inline __inline__ __attribute__ ((__always_inline__)) +#define gnu_inline __inline__ __attribute__ ((__gnu_inline__)) #define noinline __attribute__((__noinline__)) =20 #define noreturn __attribute__((__noreturn__)) diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index a9679c913d5c..48429b69b8df 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -204,8 +204,48 @@ void dump_execstate(struct cpu_user_regs *); =20 void init_constructors(void); =20 +/* + * bsearch - binary search an array of elements + * @key: pointer to item being searched for + * @base: pointer to first element to search + * @num: number of elements + * @size: size of each element + * @cmp: pointer to comparison function + * + * This function does a binary search on the given array. The + * contents of the array should already be in ascending sorted order + * under the provided comparison function. + * + * Note that the key need not have the same type as the elements in + * the array, e.g. key could be a string and the comparison function + * could compare the string with the struct's name field. However, if + * the key and elements in the array are of the same type, you can use + * the same comparison function for both sort() and bsearch(). + */ +#ifndef BSEARCH_IMPLEMENTATION +extern gnu_inline +#endif void *bsearch(const void *key, const void *base, size_t num, size_t size, - int (*cmp)(const void *key, const void *elt)); + int (*cmp)(const void *key, const void *elt)) +{ + size_t start =3D 0, end =3D num; + int result; + + while ( start < end ) + { + size_t mid =3D start + (end - start) / 2; + + result =3D cmp(key, base + mid * size); + if ( result < 0 ) + end =3D mid; + else if ( result > 0 ) + start =3D mid + 1; + else + return (void *)base + mid * size; + } + + return NULL; +} =20 #endif /* __ASSEMBLY__ */ =20 diff --git a/xen/lib/Makefile b/xen/lib/Makefile index b0fe8c72acf5..f12dab7a737a 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -1,5 +1,6 @@ obj-$(CONFIG_X86) +=3D x86/ =20 +lib-y +=3D bsearch.o lib-y +=3D ctors.o lib-y +=3D ctype.o lib-y +=3D list-sort.o diff --git a/xen/lib/bsearch.c b/xen/lib/bsearch.c new file mode 100644 index 000000000000..149f7feafd1f --- /dev/null +++ b/xen/lib/bsearch.c @@ -0,0 +1,13 @@ +/* + * A generic implementation of binary search for the Linux kernel + * + * Copyright (C) 2008-2009 Ksplice, Inc. + * Author: Tim Abbott + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2. + */ + +#define BSEARCH_IMPLEMENTATION +#include From nobody Wed May 1 20:13:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1606145060; cv=none; d=zohomail.com; s=zohoarc; b=A9d1PiA4zkV7tablQWDBdcyM7vKMoGW+6LgkFwrNpCyDrjQHCeJK5exIAMJrKpxtW6XnkFetCQsfsF9jQ3sXRAQWi1a3CT5h707aRMzBV9sNlC9eqy9CzmMzO7gTNLmyXr8iNmB8hckXt9hZ8ZS2YO//1qoUQL/RmkKPczVbsv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606145060; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=w0KlMYiiW0WboZScCSGBoeGaSU9YjcD5lFMncp+ZtPw=; b=ifcT48RxBV+ibFXwHQOtZyXzVJKpHPiro2I2qvvWM6OUb8urT4Eoa+7vGYER/LWMbBcXrG4W0qAzK9gyjmjswctW43GVQWhyyiluET/59hduAUvHktABmL5JCzCEC/KLszRoOl26qyBsu7vGI2WtLRpP8jHN9H+IKY8sX/SyjzY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 160614506057871.7730471193413; Mon, 23 Nov 2020 07:24:20 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.34676.65868 (Exim 4.92) (envelope-from ) id 1khDhD-0007O5-Tv; Mon, 23 Nov 2020 15:24:03 +0000 Received: by outflank-mailman (output) from mailman id 34676.65868; Mon, 23 Nov 2020 15:24:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDhD-0007Nx-Q7; Mon, 23 Nov 2020 15:24:03 +0000 Received: by outflank-mailman (input) for mailman id 34676; Mon, 23 Nov 2020 15:24:03 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDhD-0007Nk-3B for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:24:03 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d7c51524-a4e1-4201-a3c3-4e2a0362897b; Mon, 23 Nov 2020 15:24:02 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9EBE7AC23; Mon, 23 Nov 2020 15:24:01 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1khDhD-0007Nk-3B for xen-devel@lists.xenproject.org; Mon, 23 Nov 2020 15:24:03 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d7c51524-a4e1-4201-a3c3-4e2a0362897b; Mon, 23 Nov 2020 15:24:02 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9EBE7AC23; Mon, 23 Nov 2020 15:24:01 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d7c51524-a4e1-4201-a3c3-4e2a0362897b X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606145041; h=from:from:reply-to: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=w0KlMYiiW0WboZScCSGBoeGaSU9YjcD5lFMncp+ZtPw=; b=Xq4CA1XdpUFDcZy4KorttAc/zYWs+iDVnlavwZOdcJ3QkM96U03rfqf7UTyTH991ZOOPSw TfaL626urcyZPycV82CCKE4UILOAOi/7ZNOXlmknassHLKq95NYRFQZGOBQSCBlZWIyddh Pv7nkKz/qTJNkpvM6YyPxWu1MQclMpA= Subject: [PATCH v3 8/8] lib: move sort code From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini References: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Message-ID: <84bd9aaf-e94d-da6b-f2f9-c2da64df5312@suse.com> Date: Mon, 23 Nov 2020 16:24:01 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <1a6bac6a-7d83-f5b6-c5b9-8b3b39824d40@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Build this code into an archive, partly paralleling bsearch(). Signed-off-by: Jan Beulich Acked-by: Julien Grall Acked-by: Wei Liu Reviewed-by: Bertrand Marquis --- xen/common/Makefile | 1 - xen/lib/Makefile | 1 + xen/{common =3D> lib}/sort.c | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename xen/{common =3D> lib}/sort.c (100%) diff --git a/xen/common/Makefile b/xen/common/Makefile index e8ce23acea67..7a4e652b575e 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -36,7 +36,6 @@ obj-y +=3D rcupdate.o obj-y +=3D rwlock.o obj-y +=3D shutdown.o obj-y +=3D softirq.o -obj-y +=3D sort.o obj-y +=3D smp.o obj-y +=3D spinlock.o obj-y +=3D stop_machine.o diff --git a/xen/lib/Makefile b/xen/lib/Makefile index f12dab7a737a..42cf7a1164ef 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -6,3 +6,4 @@ lib-y +=3D ctype.o lib-y +=3D list-sort.o lib-y +=3D parse-size.o lib-y +=3D rbtree.o +lib-y +=3D sort.o diff --git a/xen/common/sort.c b/xen/lib/sort.c similarity index 100% rename from xen/common/sort.c rename to xen/lib/sort.c