[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH] build: include/compat: figure out which other compat headers are needed


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 12 Jan 2023 09:02:31 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KW1je6TKGecW+nUZ6pRPQuvvrcIDDFkiUqbq4QqiJXg=; b=cFYrt1OtqzTfVigIgCRWWdRT00z3Gby0BWZdljt8jFFzTlXcFbOk64Z9Gc/5i/kQ0DhmfSkDUh5oaF/K2/tYXNKROxFc5E65NqRXyU06BqxDHeRZ0qekwA3RY/RS8PYJhyplJLTLspwlEsjxGTY/3+tO8+diRd8dLlvx/q43eOzcz+4dIQEUWg9Y5CC/KzpPAxNSCEQT0azRCH9ZqIyOTB33IysmhVUUJyGw0M8y/6nYDSYWwjlKxG+Ia+AjPpgjgfqz7mVu6ak9hYKnSmRay+nd5GNIBNIFzmG6/PRGI3OdMEd91iiu+ICbLcLtrv0QTM2Izwi7XaFRcfpgiNNN1g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=njjk/Y+h9vzUI94IBkMpSJU9UTcFA6CnxwLiEjbrq5P8Ex/6qLhk+g1Q25v+gQmnMB2sHsdz29SDzMPZMsXiRzT/d+iH+GqwgWl/6Ndr/8NFKnH9BgyaHCXYRwUGd/P6oh9kaqzNRrSrvY2VrPrBcm+an0HnkkU04eMx13m4QAn0FPK2sswZfU43E7ENuV/27OtXvSe2YU2eR+atTVJ0riGbodvULCWNHdLQ6ByOyyGkR5E8IjG34s6K727ohcjDVgnRLQfshnu4YR0kdFho71DyO8XwcPefNNGI1MoOmqrbe8IMq3qr1pAyLuPKYEJhiLHcT4jRhaleXz88hmtqNQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 12 Jan 2023 08:02:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 11.01.2023 19:17, Anthony PERARD wrote:
> Some compat headers depends on other compat headers that may not have
> been generated due to config option.
> 
> This would be a generic way to deal with deps, instead of
>     headers-$(call or $(CONFIG_TRACEBUFFER),$(CONFIG_HVM)) += compat/trace.h

But it would generate dependency headers even if there's only a fake dependency,
like is specifically the case for hvm_op.h vs trace.h (the compat header only
really needs public/trace.h, which it gets from the inclusion of the original
hvm_op.h). Avoiding the generation of unnecessary compat headers is solely to
speed up the build. If that wasn't an issue, I'd say we simply generate all
headers at al times. In particular ...

> --- a/xen/include/Makefile
> +++ b/xen/include/Makefile
> @@ -34,6 +34,29 @@ headers-$(CONFIG_TRACEBUFFER) += compat/trace.h
>  headers-$(CONFIG_XENOPROF) += compat/xenoprof.h
>  headers-$(CONFIG_XSM_FLASK) += compat/xsm/flask_op.h
>  
> +# Find dependencies of compat headers.
> +# e.g. hvm/hvm_op.h needs trace.h; but if CONFIG_TRACEBUFFER=n, then trace.h 
> would be missing.
> +#
> +# Using sed to remove ".." from path because unsure if something else is 
> available
> +# There's `realpath`, but maynot be available
> +#    realpath --relative-to=. -mL compat/hvm/../trace.h -> compat/trace.h
> +# `make` also have macro for that $(abspath), only recent version.
> +#
> +# The $(CC) line to gen deps is derived from $(cmd_compat_i)
> +include $(obj)/.compat-header-deps.d
> +$(obj)/.compat-header-deps.d: include/public/hvm/hvm_op.h
> +     $(CC) -MM -MF $@.tmp $(filter-out -Wa$(comma)% -include 
> %/include/xen/config.h,$(XEN_CFLAGS)) $<

... this removal of the config.h inclusion is to avoid introducing any
dependencies on CONFIG_* in the public headers (of course we'd expect such
to be caught during review).

I'll try my alternative approach next, and post a patch if successful. I am,
however, aware that this also won't deal with all theoretically possible
cases; I think though that the remaining cases might then better be dealt
with by manually recorded dependencies (kind of along the lines of your

headers-$(call or $(CONFIG_TRACEBUFFER),$(CONFIG_HVM)) += compat/trace.h

in the description).

> +     for f in $$(cat $@.tmp | sed -r '1s/^[^:]*: //; s/ \\$$//'); do \

I'm curious: Why "cat" instead of passing the file as argument to "sed"?

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.