All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Frediano Ziglio <frediano.ziglio@cloud.com>
Cc: xen-devel@lists.xenproject.org, Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [PATCH v6 1/5] x86/boot: create a C bundle for 32 bit boot code and use it
Date: Mon, 21 Oct 2024 10:01:48 +0200	[thread overview]
Message-ID: <ZxYKbMzsjtcKlTdR@macbook.local> (raw)
In-Reply-To: <CACHz=ZiHp40-MkkbfnnNi2yQaB89_PA9VU_cLrTX4LHY6o7j6w@mail.gmail.com>

On Fri, Oct 18, 2024 at 02:45:59PM +0100, Frediano Ziglio wrote:
> On Fri, Oct 18, 2024 at 1:59 PM Roger Pau Monné <roger.pau@citrix.com> wrote:
> >
> > On Fri, Oct 18, 2024 at 01:48:27PM +0100, Frediano Ziglio wrote:
> > > On Fri, Oct 18, 2024 at 12:41 PM Roger Pau Monné <roger.pau@citrix.com> wrote:
> > > >
> > > > On Thu, Oct 17, 2024 at 02:31:19PM +0100, Frediano Ziglio wrote:
> > > > > +#define DECLARE_IMPORT(name) name = . + (__LINE__ * MULT)
> > > > > +
> > > > > +ENTRY(dummy_start)
> > > > >
> > > > >  SECTIONS
> > > > >  {
> > > > >    /* Merge code and data into one section. */
> > > > > -  .text : {
> > > > > +  .text TEXT_START : {
> > > > > +        /* Silence linker warning, we are not going to use it */
> > > > > +        dummy_start = .;
> > > > > +
> > > > > +        /* Declare below any symbol name needed.
> > > > > +         * Each symbol should be on its own line.
> > > > > +         * It looks like a tedious work but we make sure the things we use.
> > > > > +         * Potentially they should be all variables. */
> > > >
> > > > The style is wrong for the opening and closing comment delimiters.
> > > >
> > > > I think it would be best if this was written in a more natural style.
> > > >
> > > > /*
> > > >  * Any symbols used should be declared below, this ensures which
> > > >  * symbols are visible to the 32bit C boot code.
> > > >  */
> > > >
> > >
> > > But why to remove the "Potentially they should be all variables.".
> > > Surely something not written is more clear than something written, but
> > > on the other way it carries no information.
> >
> > I'm not sure I understand why this is helpful: either they are
> > mandated to be only variables, and hence the "potentially" is wrong, or
> > they are not, in which case I don't see why spelling a desire for they
> > to be only variables is helpful if it's not a strict requirement.
> >
> 
> As normal, rules often have exceptions. Most of the functions (so
> code) in Xen is 64 bit, so you don't want to use them. However, saying
> you have a function in head.S written in assembly for 32 bit (or any
> other functions written for 32 bit), you want the possibility to call
> it. For instance you could export from head.S the function to output
> to serial in the future.
> 
> About variables... are all variables fine to be accessed from these
> functions? Probably yes if they have no pointers in them. If they have
> pointers... that's another matter. Does the pointer have relocation?
> Is it going to be used at the final defined program location or only
> during initialization? To make an example, you could override a NULL
> pointer (that is, without relocation) to a current symbol, if this
> pointer is used after Xen is moved into its final position it will
> become invalid. If, on the other hand, the pointer had relocation
> potentially it will be automatically be relocated.

IMO comments are meant to clarify parts of the code.  A comment that
uses a conditional like "Potentially" introduces more ambiguity than
it removes, unless the restriction is stated in the comment itself.

I think you either you expand the comment to mention exactly which
kind of symbols can be declared, or you make the comment a more
restrictive one to avoid the ambiguity: "Symbols declared below should
all be variables."

Thanks, Roger.


  reply	other threads:[~2024-10-21  8:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 13:31 [PATCH v6 0/5] Reuse 32 bit C code more safely Frediano Ziglio
2024-10-17 13:31 ` [PATCH v6 1/5] x86/boot: create a C bundle for 32 bit boot code and use it Frediano Ziglio
2024-10-17 16:00   ` Anthony PERARD
2024-10-18 12:42     ` Frediano Ziglio
2024-10-17 17:13   ` Andrew Cooper
2024-10-18  8:42     ` Frediano Ziglio
2024-10-18 11:49       ` Roger Pau Monné
2024-10-18 13:28         ` Frediano Ziglio
2024-10-21  8:52           ` Roger Pau Monné
2024-10-18 11:41   ` Roger Pau Monné
2024-10-18 12:04     ` Jan Beulich
2024-10-18 12:55       ` Roger Pau Monné
2024-10-18 12:48     ` Frediano Ziglio
2024-10-18 12:59       ` Roger Pau Monné
2024-10-18 13:45         ` Frediano Ziglio
2024-10-21  8:01           ` Roger Pau Monné [this message]
2024-10-17 13:31 ` [PATCH v6 2/5] x86/boot: Reuse code to relocate trampoline Frediano Ziglio
2024-10-17 14:54   ` Marek Marczykowski-Górecki
2024-10-17 13:31 ` [PATCH v6 3/5] x86/boot: Use boot_vid_info variable directly from C code Frediano Ziglio
2024-10-17 13:31 ` [PATCH v6 4/5] x86/boot: Use trampoline_phys " Frediano Ziglio
2024-10-17 13:31 ` [PATCH v6 5/5] x86/boot: Clarify comment Frediano Ziglio

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=ZxYKbMzsjtcKlTdR@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=frediano.ziglio@cloud.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --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.