All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <stefanos@xilinx.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v4 2/2] xen: use SYMBOL when required
Date: Tue, 13 Nov 2018 05:56:20 -0700	[thread overview]
Message-ID: <5BEAC9F402000078001FB74F@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <1542063977-24906-2-git-send-email-sstabellini@kernel.org>

>>> On 13.11.18 at 00:06, <sstabellini@kernel.org> wrote:
> --- a/xen/arch/x86/alternative.c
> +++ b/xen/arch/x86/alternative.c
> @@ -194,7 +194,7 @@ void init_or_livepatch apply_alternatives(struct alt_instr *start,
>       * So be careful if you want to change the scan order to any other
>       * order.
>       */
> -    for ( a = base = start; a < end; a++ )
> +    for ( a = base = start; SYMBOL(a) < SYMBOL(end); a++ )

At this point all is fine: end is allowed to point to the end of start[].
If anything you want to change the invocations (where the
questionable symbols are used). I'm also not convinced you need
to touch both sides of the comparison or subtraction expressions.

In order for people to not start wondering what the purpose of
SYMBOL() is at any of its use sites, you really want to use it on
the problematic symbols themselves, not somewhere on a derived
variable or parameter.

I also think review would be helped if you at least split this patch
into an Arm, and x86, and a common code patch.

> @@ -33,8 +33,8 @@ static int init_percpu_area(unsigned int cpu)
>      if ( (p = alloc_xenheap_pages(PERCPU_ORDER, 0)) == NULL )
>          return -ENOMEM;
>  
> -    memset(p, 0, __per_cpu_data_end - __per_cpu_start);
> -    __per_cpu_offset[cpu] = p - __per_cpu_start;
> +    memset(p, 0, SYMBOL(__per_cpu_data_end) - SYMBOL(__per_cpu_start));
> +    __per_cpu_offset[cpu] = (unsigned long)p - SYMBOL(__per_cpu_start);

Can't you make SYMBOL() retain the original type, such that casts
like this one aren't needed? As soon as the compiler doesn't know
anymore that particular globals (or statics) are used, it can't infer
anymore that two pointers can't possibly point into the same array.

> @@ -1037,7 +1037,8 @@ void __init noreturn __start_xen(unsigned long mbi_p)
>           * Is the region size greater than zero and does it begin
>           * at or above the end of current Xen image placement?
>           */
> -        if ( (end > s) && (end - reloc_size + XEN_IMG_OFFSET >= __pa(_end)) )
> +        if ( (end > s) && (end - reloc_size + XEN_IMG_OFFSET >=
> +             __pa(_end)) )

Only re-flowing? If no change is meant to be done to this use of _end,
please omit the change.

> --- a/xen/include/asm-arm/mm.h
> +++ b/xen/include/asm-arm/mm.h
> @@ -151,7 +151,7 @@ extern vaddr_t xenheap_virt_start;
>  #endif
>  
>  #define is_xen_fixed_mfn(mfn)                                   \
> -    ((pfn_to_paddr(mfn) >= virt_to_maddr(&_start)) &&       \
> +    ((pfn_to_paddr(mfn) >= virt_to_maddr(&_start)) && \
>       (pfn_to_paddr(mfn) <= virt_to_maddr(&_end)))

Unnecessary or incomplete change again?

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-11-13 12:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12 23:06 [PATCH v4 0/2] misc safety certification fixes Stefano Stabellini
2018-11-12 23:06 ` [PATCH v4 1/2] xen: introduce SYMBOL Stefano Stabellini
2018-11-12 23:06 ` [PATCH v4 2/2] xen: use SYMBOL when required Stefano Stabellini
2018-11-13 12:56   ` Jan Beulich [this message]
2018-11-13 13:17     ` Julien Grall
2018-11-13 13:27       ` Jan Beulich
2018-11-13 22:02         ` Stefano Stabellini
2018-11-14  7:44           ` Jan Beulich
2019-01-02 18:20             ` Stefano Stabellini
2019-01-04  8:48               ` Jan Beulich
2019-01-04 17:05                 ` Stefano Stabellini
2019-01-07  7:39                   ` Jan Beulich
2019-01-07 18:29                     ` Stefano Stabellini
2019-01-08  8:03                       ` Jan Beulich
2019-01-08 17:36                         ` Stefano Stabellini
2019-01-08 18:08                           ` Stefano Stabellini
2019-01-08 18:43                             ` Julien Grall
2019-01-09  9:39                             ` Jan Beulich
2019-01-09 23:50                               ` Stefano Stabellini
2019-01-02 18:20     ` Stefano Stabellini
2019-01-02 21:04       ` Stefano Stabellini
2019-01-03 19:22         ` Stefano Stabellini
2018-12-20 17:26 ` [PATCH v4 0/2] misc safety certification fixes Julien Grall
2018-12-21  9:27   ` Jan Beulich
2018-12-21 10:34     ` Julien Grall
2018-12-21 17:15       ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5BEAC9F402000078001FB74F@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=stefanos@xilinx.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.