2017-12-01 21:39:15

by Palmer Dabbelt

[permalink] [raw]
Subject: [GIT PULL] RISC-V Cleanups and ABI Fixes for 4.15-rc2

The following changes since commit 4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323:

Linux 4.15-rc1 (2017-11-26 16:01:47 -0800)

are available in the git repository at:

ssh://[email protected]/pub/scm/linux/kernel/git/palmer/linux.git tags/riscv-for-linus-4.15-rc2_cleanups

for you to fetch changes up to 3b62de26cf5ef17340a0e986d3e53eb4f74f96d5:

RISC-V: Fixes for clean allmodconfig build (2017-12-01 13:31:31 -0800)

----------------------------------------------------------------
RISC-V Cleanups and ABI Fixes for 4.15-rc2

This tag contains a handful of small cleanups that are a result of
feedback that didn't make it into our original patch set, either because
the feedback hadn't been given yet, I missed the original emails, or
we weren't ready to submit the changes yet.

I've been maintaining the various cleanup patch sets I have as their own
branches, which I then merged together and signed. Each merge commit
has a short summary of the changes, and each branch is based on your
latest tag (4.15-rc1, in this case). If this isn't the right way to do
this then feel free to suggest something else, but it seems sane to me.

Here's a short summary of the changes, roughly in order of how
interesting they are.

* libgcc.h has been moved from include/lib, where it's the only member,
to include/linux. This is meant to avoid tab completion conflicts.
* VDSO entries for clock_get/gettimeofday/getcpu have been added. These
are simple syscalls now, but we want to let glibc use them from the
start so we can make them faster later.
* A VDSO entry for instruction cache flushing has been added so
userspace can flush the instruction cache.
* The VDSO symbol versions for __vdso_cmpxchg{32,64} have been removed,
as those VDSO entries don't actually exist.
* __io_writes has been corrected to respect the given type.
* A new READ_ONCE in arch_spin_is_locked().
* __test_and_op_bit_ord() is now actually ordered.
* Various small fixes throughout the tree to enable allmodconfig to
build cleanly.
* Removal of some dead code in our atomic support headers.
* Improvements to various comments in our atomic support headers.

----------------------------------------------------------------
Andrew Waterman (3):
RISC-V: Add VDSO entries for clock_get/gettimeofday/getcpu
RISC-V: Flush I$ when making a dirty page executable
RISC-V: Allow userspace to flush the instruction cache

Christoph Hellwig (1):
move libgcc.h to include/linux

Olof Johansson (8):
RISC-V: use generic serial.h
RISC-V: use RISCV_{INT,SHORT} instead of {INT,SHORT} for asm macros
RISC-V: io.h: type fixes for warnings
RISC-V: move empty_zero_page definition to C and export it
RISC-V: Export some expected symbols for modules
RISC-V: Provide stub of setup_profiling_timer()
RISC-V: Use define for get_cycles like other architectures
RISC-V: Add missing include

Palmer Dabbelt (16):
RISC-V: Remove __vdso_cmpxchg{32,64} symbol versions
RISC-V: Remove unused arguments from ATOMIC_OP
RISC-V: Comment on why {,cmp}xchg is ordered how it is
RISC-V: Remove __smp_bp__{before,after}_atomic
RISC-V: Remove smb_mb__{before,after}_spinlock()
RISC-V: __test_and_op_bit_ord should be strongly ordered
RISC-V: Add READ_ONCE in arch_spin_is_locked()
RISC-V: `sfence.vma` orderes the instruction cache
RISC-V: remove spin_unlock_wait()
RISC-V: Clean up an unused include
RISC-V: __io_writes should respect the length argument
RISC-V Atomic Cleanups
RISC-V: User-Visible Changes
RISC-V: __io_writes should respect the length argument
move libgcc.h to include/linux
RISC-V: Fixes for clean allmodconfig build

arch/riscv/include/asm/Kbuild | 1 +
arch/riscv/include/asm/asm.h | 12 ++--
arch/riscv/include/asm/atomic.h | 103 +++++++++++++++++----------------
arch/riscv/include/asm/barrier.h | 23 --------
arch/riscv/include/asm/bitops.h | 2 +-
arch/riscv/include/asm/bug.h | 6 +-
arch/riscv/include/asm/cacheflush.h | 30 ++++++++--
arch/riscv/include/asm/io.h | 18 +++---
arch/riscv/include/asm/mmu.h | 4 ++
arch/riscv/include/asm/mmu_context.h | 45 ++++++++++++++
arch/riscv/include/asm/pgtable.h | 58 ++++++++++---------
arch/riscv/include/asm/spinlock.h | 11 +---
arch/riscv/include/asm/timex.h | 3 +-
arch/riscv/include/asm/tlbflush.h | 7 ++-
arch/riscv/include/asm/vdso-syscalls.h | 28 +++++++++
arch/riscv/include/asm/vdso.h | 4 ++
arch/riscv/kernel/head.S | 3 -
arch/riscv/kernel/riscv_ksyms.c | 3 +
arch/riscv/kernel/setup.c | 5 ++
arch/riscv/kernel/smp.c | 55 ++++++++++++++++++
arch/riscv/kernel/sys_riscv.c | 33 ++++++++++-
arch/riscv/kernel/syscall_table.c | 2 +
arch/riscv/kernel/vdso/Makefile | 7 ++-
arch/riscv/kernel/vdso/clock_getres.S | 26 +++++++++
arch/riscv/kernel/vdso/clock_gettime.S | 26 +++++++++
arch/riscv/kernel/vdso/flush_icache.S | 31 ++++++++++
arch/riscv/kernel/vdso/getcpu.S | 26 +++++++++
arch/riscv/kernel/vdso/gettimeofday.S | 26 +++++++++
arch/riscv/kernel/vdso/vdso.lds.S | 7 ++-
arch/riscv/lib/delay.c | 1 +
arch/riscv/mm/Makefile | 1 +
arch/riscv/mm/cacheflush.c | 23 ++++++++
arch/riscv/mm/ioremap.c | 2 +-
include/{lib => linux}/libgcc.h | 0
lib/ashldi3.c | 2 +-
lib/ashrdi3.c | 2 +-
lib/cmpdi2.c | 2 +-
lib/lshrdi3.c | 2 +-
lib/muldi3.c | 2 +-
lib/ucmpdi2.c | 2 +-
40 files changed, 498 insertions(+), 146 deletions(-)
create mode 100644 arch/riscv/include/asm/vdso-syscalls.h
create mode 100644 arch/riscv/kernel/vdso/clock_getres.S
create mode 100644 arch/riscv/kernel/vdso/clock_gettime.S
create mode 100644 arch/riscv/kernel/vdso/flush_icache.S
create mode 100644 arch/riscv/kernel/vdso/getcpu.S
create mode 100644 arch/riscv/kernel/vdso/gettimeofday.S
create mode 100644 arch/riscv/mm/cacheflush.c
rename include/{lib => linux}/libgcc.h (100%)


2017-12-02 00:47:18

by Linus Torvalds

[permalink] [raw]
Subject: Re: [GIT PULL] RISC-V Cleanups and ABI Fixes for 4.15-rc2

On Fri, Dec 1, 2017 at 4:39 PM, Palmer Dabbelt <[email protected]> wrote:
>
> I've been maintaining the various cleanup patch sets I have as their own
> branches, which I then merged together and signed. Each merge commit
> has a short summary of the changes, and each branch is based on your
> latest tag (4.15-rc1, in this case). If this isn't the right way to do
> this then feel free to suggest something else, but it seems sane to me.

The individual branches with merges look fine.

What I don't really like is how very recent they are. Many of the
commits were done today, and thus clearly were never through the 0-day
robot etc.

I don't actually think the 0day robot does RISC-V at all, at least not
yet, so in this case it probably doesn't really matter, but in general
I _hate_ seeing pull requests that come in on a Friday afternoon where
a lot of the commits clearly happened that same day. It's simply a
sign of things likely having been rushed, which in turn often leads to
issues down the line.

So the structure of the history looks ok, but I hope that "very
recently made" is a one-time thing rather than a pattern. Ok?

Linus

2017-12-02 01:47:07

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [GIT PULL] RISC-V Cleanups and ABI Fixes for 4.15-rc2

On Fri, 01 Dec 2017 16:47:16 PST (-0800), Linus Torvalds wrote:
> On Fri, Dec 1, 2017 at 4:39 PM, Palmer Dabbelt <[email protected]> wrote:
>>
>> I've been maintaining the various cleanup patch sets I have as their own
>> branches, which I then merged together and signed. Each merge commit
>> has a short summary of the changes, and each branch is based on your
>> latest tag (4.15-rc1, in this case). If this isn't the right way to do
>> this then feel free to suggest something else, but it seems sane to me.
>
> The individual branches with merges look fine.
>
> What I don't really like is how very recent they are. Many of the
> commits were done today, and thus clearly were never through the 0-day
> robot etc.
>
> I don't actually think the 0day robot does RISC-V at all, at least not
> yet, so in this case it probably doesn't really matter, but in general
> I _hate_ seeing pull requests that come in on a Friday afternoon where
> a lot of the commits clearly happened that same day. It's simply a
> sign of things likely having been rushed, which in turn often leads to
> issues down the line.

The 0-day robot doesn't do RISC-V, but we're working on getting better CI
infrastructure setup now that we're upstream. Olof has started running builds
through his builder, which is where many of the fixes came from.

I think we're probably not quite ready for the 0-day robot yet:
* We still have an allmodconfig failure, but there's a patch out to fix that.
* binutils-2.29.1 and gcc-7.2.0 have a handful of bugs that were found when
pushing on Linux, the next releases should have fixes for these. We have
backports, so this might not be a big deal.
* There's no way to boot the kernel in an easy to automated fashion. Our QEMU
port is a WIP, and I currently test our port by swapping SD cards. This
might not be a big deal, since the port as it stands can't do much in the way
of a boot test anyway.

I'll ping kbuild-all with a better subject and figure out the right thing to
do.

> So the structure of the history looks ok, but I hope that "very
> recently made" is a one-time thing rather than a pattern. Ok?

OK, sorry about that. It sounds like this is a good excuse to figure out how
we're going to stage commits in RISC-V land -- I've been a bit unprepared for
the pace of kernel development on RISC-V, I didn't think I'd see so many people
poking around in our port so quickly :).

If you'd like, I can let these bake for a few days? I don't mind if they don't
get in until rc3. I can either ping this pull request or send another one,
whatever's easier for you is OK for me.

2017-12-03 03:20:14

by Andrea Parri

[permalink] [raw]
Subject: Re: [GIT PULL] RISC-V Cleanups and ABI Fixes for 4.15-rc2

Hi Palmer,

On Fri, Dec 01, 2017 at 01:39:12PM -0800, Palmer Dabbelt wrote:
> The following changes since commit 4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323:
>
> Linux 4.15-rc1 (2017-11-26 16:01:47 -0800)
>
> are available in the git repository at:
>
> ssh://[email protected]/pub/scm/linux/kernel/git/palmer/linux.git tags/riscv-for-linus-4.15-rc2_cleanups
>
> for you to fetch changes up to 3b62de26cf5ef17340a0e986d3e53eb4f74f96d5:
>
> RISC-V: Fixes for clean allmodconfig build (2017-12-01 13:31:31 -0800)
>
> ----------------------------------------------------------------
> RISC-V Cleanups and ABI Fixes for 4.15-rc2
>
> This tag contains a handful of small cleanups that are a result of
> feedback that didn't make it into our original patch set, either because
> the feedback hadn't been given yet, I missed the original emails, or
> we weren't ready to submit the changes yet.
>
> I've been maintaining the various cleanup patch sets I have as their own
> branches, which I then merged together and signed. Each merge commit
> has a short summary of the changes, and each branch is based on your
> latest tag (4.15-rc1, in this case). If this isn't the right way to do
> this then feel free to suggest something else, but it seems sane to me.
>
> Here's a short summary of the changes, roughly in order of how
> interesting they are.
>
> * libgcc.h has been moved from include/lib, where it's the only member,
> to include/linux. This is meant to avoid tab completion conflicts.
> * VDSO entries for clock_get/gettimeofday/getcpu have been added. These
> are simple syscalls now, but we want to let glibc use them from the
> start so we can make them faster later.
> * A VDSO entry for instruction cache flushing has been added so
> userspace can flush the instruction cache.
> * The VDSO symbol versions for __vdso_cmpxchg{32,64} have been removed,
> as those VDSO entries don't actually exist.
> * __io_writes has been corrected to respect the given type.
> * A new READ_ONCE in arch_spin_is_locked().
> * __test_and_op_bit_ord() is now actually ordered.
> * Various small fixes throughout the tree to enable allmodconfig to
> build cleanly.
> * Removal of some dead code in our atomic support headers.
> * Improvements to various comments in our atomic support headers.
>
> ----------------------------------------------------------------
> Andrew Waterman (3):
> RISC-V: Add VDSO entries for clock_get/gettimeofday/getcpu
> RISC-V: Flush I$ when making a dirty page executable
> RISC-V: Allow userspace to flush the instruction cache
>
> Christoph Hellwig (1):
> move libgcc.h to include/linux
>
> Olof Johansson (8):
> RISC-V: use generic serial.h
> RISC-V: use RISCV_{INT,SHORT} instead of {INT,SHORT} for asm macros
> RISC-V: io.h: type fixes for warnings
> RISC-V: move empty_zero_page definition to C and export it
> RISC-V: Export some expected symbols for modules
> RISC-V: Provide stub of setup_profiling_timer()
> RISC-V: Use define for get_cycles like other architectures
> RISC-V: Add missing include
>
> Palmer Dabbelt (16):
> RISC-V: Remove __vdso_cmpxchg{32,64} symbol versions
> RISC-V: Remove unused arguments from ATOMIC_OP
> RISC-V: Comment on why {,cmp}xchg is ordered how it is
> RISC-V: Remove __smp_bp__{before,after}_atomic
> RISC-V: Remove smb_mb__{before,after}_spinlock()

I wonder whether you really meant to remove smp_mb__after_spinlock():
on the one hand, this primitive doesn't seem "obsolete" (as suggested
by the commit message); on the other hand, the Draft Specification at

https://marc.info/?l=linux-kernel&m=151218405830993&w=2

suggests that you need "to strengthen" the generic implementation for
this primitive (considered the current spinlock.h in riscv). What am
I missing?

Andrea


> RISC-V: __test_and_op_bit_ord should be strongly ordered
> RISC-V: Add READ_ONCE in arch_spin_is_locked()
> RISC-V: `sfence.vma` orderes the instruction cache
> RISC-V: remove spin_unlock_wait()
> RISC-V: Clean up an unused include
> RISC-V: __io_writes should respect the length argument
> RISC-V Atomic Cleanups
> RISC-V: User-Visible Changes
> RISC-V: __io_writes should respect the length argument
> move libgcc.h to include/linux
> RISC-V: Fixes for clean allmodconfig build
>
> arch/riscv/include/asm/Kbuild | 1 +
> arch/riscv/include/asm/asm.h | 12 ++--
> arch/riscv/include/asm/atomic.h | 103 +++++++++++++++++----------------
> arch/riscv/include/asm/barrier.h | 23 --------
> arch/riscv/include/asm/bitops.h | 2 +-
> arch/riscv/include/asm/bug.h | 6 +-
> arch/riscv/include/asm/cacheflush.h | 30 ++++++++--
> arch/riscv/include/asm/io.h | 18 +++---
> arch/riscv/include/asm/mmu.h | 4 ++
> arch/riscv/include/asm/mmu_context.h | 45 ++++++++++++++
> arch/riscv/include/asm/pgtable.h | 58 ++++++++++---------
> arch/riscv/include/asm/spinlock.h | 11 +---
> arch/riscv/include/asm/timex.h | 3 +-
> arch/riscv/include/asm/tlbflush.h | 7 ++-
> arch/riscv/include/asm/vdso-syscalls.h | 28 +++++++++
> arch/riscv/include/asm/vdso.h | 4 ++
> arch/riscv/kernel/head.S | 3 -
> arch/riscv/kernel/riscv_ksyms.c | 3 +
> arch/riscv/kernel/setup.c | 5 ++
> arch/riscv/kernel/smp.c | 55 ++++++++++++++++++
> arch/riscv/kernel/sys_riscv.c | 33 ++++++++++-
> arch/riscv/kernel/syscall_table.c | 2 +
> arch/riscv/kernel/vdso/Makefile | 7 ++-
> arch/riscv/kernel/vdso/clock_getres.S | 26 +++++++++
> arch/riscv/kernel/vdso/clock_gettime.S | 26 +++++++++
> arch/riscv/kernel/vdso/flush_icache.S | 31 ++++++++++
> arch/riscv/kernel/vdso/getcpu.S | 26 +++++++++
> arch/riscv/kernel/vdso/gettimeofday.S | 26 +++++++++
> arch/riscv/kernel/vdso/vdso.lds.S | 7 ++-
> arch/riscv/lib/delay.c | 1 +
> arch/riscv/mm/Makefile | 1 +
> arch/riscv/mm/cacheflush.c | 23 ++++++++
> arch/riscv/mm/ioremap.c | 2 +-
> include/{lib => linux}/libgcc.h | 0
> lib/ashldi3.c | 2 +-
> lib/ashrdi3.c | 2 +-
> lib/cmpdi2.c | 2 +-
> lib/lshrdi3.c | 2 +-
> lib/muldi3.c | 2 +-
> lib/ucmpdi2.c | 2 +-
> 40 files changed, 498 insertions(+), 146 deletions(-)
> create mode 100644 arch/riscv/include/asm/vdso-syscalls.h
> create mode 100644 arch/riscv/kernel/vdso/clock_getres.S
> create mode 100644 arch/riscv/kernel/vdso/clock_gettime.S
> create mode 100644 arch/riscv/kernel/vdso/flush_icache.S
> create mode 100644 arch/riscv/kernel/vdso/getcpu.S
> create mode 100644 arch/riscv/kernel/vdso/gettimeofday.S
> create mode 100644 arch/riscv/mm/cacheflush.c
> rename include/{lib => linux}/libgcc.h (100%)

2017-12-07 20:59:38

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [patches] Re: [GIT PULL] RISC-V Cleanups and ABI Fixes for 4.15-rc2

On Sat, 02 Dec 2017 19:20:02 PST (-0800), [email protected] wrote:
> On Fri, Dec 01, 2017 at 01:39:12PM -0800, Palmer Dabbelt wrote:
>> RISC-V: Remove smb_mb__{before,after}_spinlock()
>
> I wonder whether you really meant to remove smp_mb__after_spinlock():
> on the one hand, this primitive doesn't seem "obsolete" (as suggested
> by the commit message); on the other hand, the Draft Specification at
>
> https://marc.info/?l=linux-kernel&m=151218405830993&w=2
>
> suggests that you need "to strengthen" the generic implementation for
> this primitive (considered the current spinlock.h in riscv). What am
> I missing?

The comment was incorrect, which caused me to incorrectly remove the fence from
our port. I just sent out a patch (well, actually, I did last night -- I just
found this email sitting in a buffer...).

https://lkml.org/lkml/2017/12/6/1136

Thanks for catching this!

2017-12-08 10:06:11

by Andrea Parri

[permalink] [raw]
Subject: Re: [patches] Re: [GIT PULL] RISC-V Cleanups and ABI Fixes for 4.15-rc2

On Thu, Dec 07, 2017 at 12:59:35PM -0800, Palmer Dabbelt wrote:
> On Sat, 02 Dec 2017 19:20:02 PST (-0800), [email protected] wrote:
> >On Fri, Dec 01, 2017 at 01:39:12PM -0800, Palmer Dabbelt wrote:
> >> RISC-V: Remove smb_mb__{before,after}_spinlock()
> >
> >I wonder whether you really meant to remove smp_mb__after_spinlock():
> >on the one hand, this primitive doesn't seem "obsolete" (as suggested
> >by the commit message); on the other hand, the Draft Specification at
> >
> > https://marc.info/?l=linux-kernel&m=151218405830993&w=2
> >
> >suggests that you need "to strengthen" the generic implementation for
> >this primitive (considered the current spinlock.h in riscv). What am
> >I missing?
>
> The comment was incorrect, which caused me to incorrectly remove the fence
> from our port. I just sent out a patch (well, actually, I did last night --
> I just found this email sitting in a buffer...).
>
> https://lkml.org/lkml/2017/12/6/1136

Thank you for the clarification (and for the patch),

Andrea


>
> Thanks for catching this!