All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang3@mail.ustc.edu.cn>
To: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] riscv: improve __ex_table section handling
Date: Thu, 26 Aug 2021 22:06:00 +0800	[thread overview]
Message-ID: <20210826220600.4759900b@xhacker> (raw)
In-Reply-To: <mhng-1d66757a-1be0-4e46-8bbc-0568ceddfeb3@palmerdabbelt-glaptop>

On Wed, 25 Aug 2021 23:47:02 -0700 (PDT)
Palmer Dabbelt <palmer@dabbelt.com> wrote:

> On Sun, 08 Aug 2021 10:25:09 PDT (-0700), jszhang3@mail.ustc.edu.cn wrote:
> > From: Jisheng Zhang <jszhang@kernel.org>
> >
> > Enable BUILDTIME_TABLE_SORT to sort the exception table at build time
> > then move exception table to RO_DATA segment.
> >
> > Jisheng Zhang (2):
> >   riscv: Enable BUILDTIME_TABLE_SORT
> >   riscv: Move EXCEPTION_TABLE to RO_DATA segment
> >
> >  arch/riscv/Kconfig                  | 1 +
> >  arch/riscv/kernel/vmlinux-xip.lds.S | 1 -
> >  arch/riscv/kernel/vmlinux.lds.S     | 4 ++--
> >  scripts/sorttable.c                 | 1 +
> >  4 files changed, 4 insertions(+), 3 deletions(-)  
> 
> This seems reasonable, but it's failing for some configurations (at 
> least tinyconfig) saying there is no __ex_table.  I'm not entirely sure 

Nice catch! tinyconfig in riscv means NOMMU which indicates no __ex_table at all.
It seems we have to only enable BUILDTIME_TABLE_SORT for MMU case.

will send out V2 soon.

Thanks

> how that comes about, as we've got them for futexes and uaccess.
> 
> Maybe the right thing to do here is to fix scripts/sorttable.c so it can 
> handle files with nothing to sort?  I think it's just as simple as a 
> successful early out like this
> 
> diff --git a/scripts/sorttable.h b/scripts/sorttable.h
> index a2baa2fefb13..207ddeddb506 100644
> --- a/scripts/sorttable.h
> +++ b/scripts/sorttable.h
> @@ -294,8 +294,9 @@ static int do_sort(Elf_Ehdr *ehdr,
>                 goto out;
>         }
>  #endif
> +       /* If there is no __ex_table section there is no work do to. */
>         if (!extab_sec) {
> -               fprintf(stderr, "no __ex_table in file: %s\n", fname);
> +               rc = 0;
>                 goto out;
>         }
> 
> I'm not entirely sure though -- my logic is essentially just "there's no 
> __ex_table, so there's nothing to sort, so just don't try".
> 
> All the configurations I can actually boot have an __ex_table, so I'm 
> not sure how to test that.
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

WARNING: multiple messages have this Message-ID (diff)
From: Jisheng Zhang <jszhang3@mail.ustc.edu.cn>
To: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] riscv: improve __ex_table section handling
Date: Thu, 26 Aug 2021 22:06:00 +0800	[thread overview]
Message-ID: <20210826220600.4759900b@xhacker> (raw)
In-Reply-To: <mhng-1d66757a-1be0-4e46-8bbc-0568ceddfeb3@palmerdabbelt-glaptop>

On Wed, 25 Aug 2021 23:47:02 -0700 (PDT)
Palmer Dabbelt <palmer@dabbelt.com> wrote:

> On Sun, 08 Aug 2021 10:25:09 PDT (-0700), jszhang3@mail.ustc.edu.cn wrote:
> > From: Jisheng Zhang <jszhang@kernel.org>
> >
> > Enable BUILDTIME_TABLE_SORT to sort the exception table at build time
> > then move exception table to RO_DATA segment.
> >
> > Jisheng Zhang (2):
> >   riscv: Enable BUILDTIME_TABLE_SORT
> >   riscv: Move EXCEPTION_TABLE to RO_DATA segment
> >
> >  arch/riscv/Kconfig                  | 1 +
> >  arch/riscv/kernel/vmlinux-xip.lds.S | 1 -
> >  arch/riscv/kernel/vmlinux.lds.S     | 4 ++--
> >  scripts/sorttable.c                 | 1 +
> >  4 files changed, 4 insertions(+), 3 deletions(-)  
> 
> This seems reasonable, but it's failing for some configurations (at 
> least tinyconfig) saying there is no __ex_table.  I'm not entirely sure 

Nice catch! tinyconfig in riscv means NOMMU which indicates no __ex_table at all.
It seems we have to only enable BUILDTIME_TABLE_SORT for MMU case.

will send out V2 soon.

Thanks

> how that comes about, as we've got them for futexes and uaccess.
> 
> Maybe the right thing to do here is to fix scripts/sorttable.c so it can 
> handle files with nothing to sort?  I think it's just as simple as a 
> successful early out like this
> 
> diff --git a/scripts/sorttable.h b/scripts/sorttable.h
> index a2baa2fefb13..207ddeddb506 100644
> --- a/scripts/sorttable.h
> +++ b/scripts/sorttable.h
> @@ -294,8 +294,9 @@ static int do_sort(Elf_Ehdr *ehdr,
>                 goto out;
>         }
>  #endif
> +       /* If there is no __ex_table section there is no work do to. */
>         if (!extab_sec) {
> -               fprintf(stderr, "no __ex_table in file: %s\n", fname);
> +               rc = 0;
>                 goto out;
>         }
> 
> I'm not entirely sure though -- my logic is essentially just "there's no 
> __ex_table, so there's nothing to sort, so just don't try".
> 
> All the configurations I can actually boot have an __ex_table, so I'm 
> not sure how to test that.
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv



  reply	other threads:[~2021-08-26 14:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-08 17:25 [PATCH 0/2] riscv: improve __ex_table section handling Jisheng Zhang
2021-08-08 17:25 ` Jisheng Zhang
2021-08-08 17:25 ` [PATCH 1/2] riscv: Enable BUILDTIME_TABLE_SORT Jisheng Zhang
2021-08-08 17:25   ` Jisheng Zhang
2021-08-08 17:26 ` [PATCH 2/2] riscv: Move EXCEPTION_TABLE to RO_DATA segment Jisheng Zhang
2021-08-08 17:26   ` Jisheng Zhang
2021-08-26  6:47 ` [PATCH 0/2] riscv: improve __ex_table section handling Palmer Dabbelt
2021-08-26  6:47   ` Palmer Dabbelt
2021-08-26 14:06   ` Jisheng Zhang [this message]
2021-08-26 14:06     ` Jisheng Zhang

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=20210826220600.4759900b@xhacker \
    --to=jszhang3@mail.ustc.edu.cn \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /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.