* [PATCH v3 2/2] selftests/powerpc: Fix typos
From: Breno Leitao @ 2018-06-26 13:20 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Breno Leitao, Gustavo Romero
In-Reply-To: <1530019213-2347-1-git-send-email-leitao@debian.org>
Fix two typos in the file header. Replacing the word 'priviledged'
by 'privileged' and 'exuecuted' by 'executed'.
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Gustavo Romero <gromero@linux.vnet.ibm.com>
---
tools/testing/selftests/powerpc/dscr/dscr_inherit_exec_test.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/powerpc/dscr/dscr_inherit_exec_test.c b/tools/testing/selftests/powerpc/dscr/dscr_inherit_exec_test.c
index 55c55f39b6a6..c8c240accc0c 100644
--- a/tools/testing/selftests/powerpc/dscr/dscr_inherit_exec_test.c
+++ b/tools/testing/selftests/powerpc/dscr/dscr_inherit_exec_test.c
@@ -5,8 +5,8 @@
* verifies that the child is using the changed DSCR using mfspr.
*
* When using the privilege state SPR, the instructions such as
- * mfspr or mtspr are priviledged and the kernel emulates them
- * for us. Instructions using problem state SPR can be exuecuted
+ * mfspr or mtspr are privileged and the kernel emulates them
+ * for us. Instructions using problem state SPR can be executed
* directly without any emulation if the HW supports them. Else
* they also get emulated by the kernel.
*
--
2.16.3
^ permalink raw reply related
* Re: [v4, 00/10] Support DPAA PTP clock and timestamping
From: David Miller @ 2018-06-26 13:18 UTC (permalink / raw)
To: yangbo.lu
Cc: netdev, madalin.bucur, richardcochran, robh+dt, shawnguo,
devicetree, linuxppc-dev, linux-arm-kernel, linux-kernel
In-Reply-To: <20180625123716.28993-1-yangbo.lu@nxp.com>
From: Yangbo Lu <yangbo.lu@nxp.com>
Date: Mon, 25 Jun 2018 20:37:06 +0800
> This patchset is to support DPAA FMAN PTP clock and HW timestamping.
> It had been verified on both ARM platform and PPC platform.
> - The patch #1 to patch #5 are to support DPAA FMAN 1588 timer in
> ptp_qoriq driver.
> - The patch #6 to patch #10 are to add HW timestamping support in
> DPAA ethernet driver.
Series applied to net-next.
^ permalink raw reply
* Re: [next-20180601][nvme][ppc] Kernel Oops is triggered when creating lvm snapshots on nvme disks
From: Michael Ellerman @ 2018-06-26 13:36 UTC (permalink / raw)
To: Abdul Haleem, linuxppc-dev
Cc: linux-fsdevel, linux-next, linux-kernel, linux-scsi,
Stephen Rothwell, sachinp, sim, manvanth, Brian King
In-Reply-To: <1530003645.24245.7.camel@abdul.in.ibm.com>
Abdul Haleem <abdhalee@linux.vnet.ibm.com> writes:
> Greeting's
>
> Kernel Oops is seen on 4.17.0-rc7-next-20180601 kernel on a bare-metal
> machine when running lvm snapshot tests on nvme disks.
>
> Machine Type: Power 8 bare-metal
> kernel : 4.17.0-rc7-next-20180601
> test:
> $ pvcreate -y /dev/nvme0n1
> $ vgcreate avocado_vg /dev/nvme0n1
> $ lvcreate --size 1.4T --name avocado_lv avocado_vg -y
> $ mkfs.ext2 /dev/avocado_vg/avocado_lv
> $ lvcreate --size 1G --snapshot --name avocado_sn /dev/avocado_vg/avocado_lv -y
> $ lvconvert --merge /dev/avocado_vg/avocado_sn
> the last command results in Oops:
>
> Unable to handle kernel paging request for data at address 0x000000d0
> Faulting instruction address: 0xc0000000002dced4
> Oops: Kernel access of bad area, sig: 11 [#1]
> LE SMP NR_CPUS=2048 NUMA PowerNV
> Dumping ftrace buffer:
> (ftrace buffer empty)
> Modules linked in: dm_snapshot dm_bufio nvme bnx2x iptable_mangle
> ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4
> nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4
> xt_tcpudp tun bridge stp llc iptable_filter dm_mirror dm_region_hash
> dm_log dm_service_time vmx_crypto powernv_rng rng_core dm_multipath
> kvm_hv binfmt_misc kvm nfsd ip_tables x_tables autofs4 xfs lpfc
> crc_t10dif crct10dif_generic mdio nvme_fc libcrc32c nvme_fabrics
> nvme_core crct10dif_common [last unloaded: nvme]
> CPU: 70 PID: 157763 Comm: lvconvert Not tainted 4.17.0-rc7-next-20180601-autotest-autotest #1
> NIP: c0000000002dced4 LR: c000000000244d14 CTR: c000000000244cf0
> REGS: c000001f81d6b5a0 TRAP: 0300 Not tainted (4.17.0-rc7-next-20180601-autotest-autotest)
> MSR: 900000010280b033 <SF,HV,VEC,VSX,EE,FP,ME,IR,DR,RI,LE,TM[E]> CR: 22442444 XER: 20000000
> CFAR: c000000000008934 DAR: 00000000000000d0 DSISR: 40000000 SOFTE: 0
> GPR00: c000000000244d14 c000001f81d6b820 c00000000109c400 c000003c9d080180
> GPR04: 0000000000000001 c000001fad510000 c000001fad510000 0000000000000001
> GPR08: 0000000000000000 f000000000000000 f000000000000008 0000000000000000
> GPR12: c000000000244cf0 c000001ffffc4f80 00007fffa0e31090 00007fffd9d9b470
> GPR16: 0000000000000000 000000000000005c 00007fffa0e3a5b0 00007fffa0e62040
> GPR20: 0000010014ad7d50 0000010014ad7d20 00007fffa0e64210 0000000000000001
> GPR24: 0000000000000000 c00000000081bae0 c000001ed2461b00 d00000000f859d08
> GPR28: c000003c9d080180 c000000000244d14 0000000000000001 0000000000000000
> NIP [c0000000002dced4] kmem_cache_free+0x1a4/0x2b0
> LR [c000000000244d14] mempool_free_slab+0x24/0x40
Are you running with slub debugging enabled?
Try booting with slub_debug=FZP
cheers
^ permalink raw reply
* Re: [PATCH] QE GPIO: Add qe_gpio_set_multiple
From: Michael Ellerman @ 2018-06-26 13:41 UTC (permalink / raw)
To: Joakim Tjernlund, linuxppc-dev@lists.ozlabs.org,
qiang.zhao@nxp.com, york.sun@nxp.com
In-Reply-To: <fef3d759a1f6677ec713b120b4b1f4ab1eb4946b.camel@infinera.com>
Joakim Tjernlund <Joakim.Tjernlund@infinera.com> writes:
> On Thu, 2018-06-21 at 02:38 +0000, Qiang Zhao wrote:
>> On 06/19/2018 09:22 AM, Joakim Tjernlund wrote:
>> -----Original Message-----
>> From: Linuxppc-dev [mailto:linuxppc-dev-bounces+qiang.zhao=3Dnxp.com@lis=
ts.ozlabs.org] On Behalf Of Joakim Tjernlund
>> Sent: 2018=E5=B9=B46=E6=9C=8820=E6=97=A5 0:22
>> To: York Sun <york.sun@nxp.com>; linuxppc-dev <linuxppc-dev@lists.ozlabs=
.org>
>> Subject: [PATCH] QE GPIO: Add qe_gpio_set_multiple
>>=20
>> This cousin to gpio-mpc8xxx was lacking a multiple pins method, add one.
>>=20
>> Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
>> ---
>> drivers/soc/fsl/qe/gpio.c | 28 ++++++++++++++++++++++++++++
>> 1 file changed, 28 insertions(+)
...
>> static int qe_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio) {
>> struct of_mm_gpio_chip *mm_gc =3D to_of_mm_gpio_chip(gc); @@ -29=
8,6 +325,7 @@ static int __init qe_add_gpiochips(void)
>> gc->direction_output =3D qe_gpio_dir_out;
>> gc->get =3D qe_gpio_get;
>> gc->set =3D qe_gpio_set;
>> + gc->set_multiple =3D qe_gpio_set_multiple;
>>=20
>> ret =3D of_mm_gpiochip_add_data(np, mm_gc, qe_gc);
>> if (ret)
>>=20
>> Reviewed-by: Qiang Zhao <qiang.zhao@nxp.com>
>>=20
>
> Who picks up this patch ? Is it queued somewhere already?
Not me.
cheers
^ permalink raw reply
* Re: [powerpc/powervm]kernel BUG at mm/memory_hotplug.c:1864!
From: Nathan Fontenot @ 2018-06-26 14:54 UTC (permalink / raw)
To: Balbir Singh, vrbagal1, Oscar Salvador
Cc: sachinp, Linuxppc-dev, linux-mm, linux-next, linuxppc-dev
In-Reply-To: <605b4df2-4cf1-2dda-3661-68b78845f8ec@gmail.com>
On 06/12/2018 05:28 AM, Balbir Singh wrote:
>
>
> On 11/06/18 17:41, vrbagal1 wrote:
>> On 2018-06-08 17:45, Oscar Salvador wrote:
>>> On Fri, Jun 08, 2018 at 05:11:24PM +0530, vrbagal1 wrote:
>>>> On 2018-06-08 16:58, Oscar Salvador wrote:
>>>>> On Fri, Jun 08, 2018 at 04:44:24PM +0530, vrbagal1 wrote:
>>>>>> Greetings!!!
>>>>>>
>>>>>> I am seeing kernel bug followed by oops message and system reboots,
>>>>>> while
>>>>>> running dlpar memory hotplug test.
>>>>>>
>>>>>> Machine Details: Power6 PowerVM Platform
>>>>>> GCC version: (gcc version 4.8.3 20140911 (Red Hat 4.8.3-7) (GCC))
>>>>>> Test case: dlpar memory hotplug test (https://github.com/avocado-framework-tests/avocado-misc-tests/blob/master/memory/memhotplug.py)
>>>>>> Kernel Version: Linux version 4.17.0-autotest
>>>>>>
>>>>>> I am seeing this bug on rc7 as well.
>>
>> Observing similar traces on linux next kernel: 4.17.0-next-20180608-autotest
>>
>> Block size [0x4000000] unaligned hotplug range: start 0x220000000, size 0x1000000
>
> size < block_size in this case, why? how? Could you confirm that the block size is 64MB and your trying to remove 16MB
>
I was not able to re-create this failure exactly ( I don't have a Power6 system)
but was able to get a similar re-create on a Power 9 with a few modifications.
I think the issue you're seeing is due to a change in the validation of memory
done in remove_memory to ensure the amount of memory being removed spans
entire memory block. The pseries memory remove code, see pseries_remove_memblock,
tries to remove each section of a memory block instead of the entire memory block.
Could you try the patch below that updates the pseries code to remove the entire
memory block instead of doing it one section at a time.
-Nathan
---
arch/powerpc/platforms/pseries/hotplug-memory.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index c1578f54c626..6072efc793e1 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -316,11 +316,11 @@ static int dlpar_offline_lmb(struct drmem_lmb *lmb)
return dlpar_change_lmb_state(lmb, false);
}
-static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size)
+static int pseries_remove_memblock(unsigned long base,
+ unsigned int memblock_sz)
{
- unsigned long block_sz, start_pfn;
- int sections_per_block;
- int i, nid;
+ unsigned long start_pfn;
+ int nid;
start_pfn = base >> PAGE_SHIFT;
@@ -329,18 +329,12 @@ static int pseries_remove_memblock(unsigned long base, unsigned int memblock_siz
if (!pfn_valid(start_pfn))
goto out;
- block_sz = pseries_memory_block_size();
- sections_per_block = block_sz / MIN_MEMORY_BLOCK_SIZE;
nid = memory_add_physaddr_to_nid(base);
-
- for (i = 0; i < sections_per_block; i++) {
- remove_memory(nid, base, MIN_MEMORY_BLOCK_SIZE);
- base += MIN_MEMORY_BLOCK_SIZE;
- }
+ remove_memory(nid, base, memblock_sz);
out:
/* Update memory regions for memory remove */
- memblock_remove(base, memblock_size);
+ memblock_remove(base, memblock_sz);
unlock_device_hotplug();
return 0;
}
^ permalink raw reply related
* [PATCH v9 0/6] add support for relative references in special sections
From: Ard Biesheuvel @ 2018-06-26 18:27 UTC (permalink / raw)
To: linux-kernel
Cc: Ard Biesheuvel, Arnd Bergmann, Kees Cook, Will Deacon,
Michael Ellerman, Thomas Garnier, Thomas Gleixner,
Serge E. Hallyn, Bjorn Helgaas, Benjamin Herrenschmidt,
Russell King, Paul Mackerras, Catalin Marinas, Petr Mladek,
Ingo Molnar, James Morris, Andrew Morton, Nicolas Pitre,
Josh Poimboeuf, Steven Rostedt, Sergey Senozhatsky,
Linus Torvalds, Jessica Yu, linux-arm-kernel, linuxppc-dev, x86
This adds support for emitting special sections such as initcall arrays,
PCI fixups and tracepoints as relative references rather than absolute
references. This reduces the size by 50% on 64-bit architectures, but
more importantly, it removes the need for carrying relocation metadata
for these sections in relocatable kernels (e.g., for KASLR) that needs
to be fixed up at boot time. On arm64, this reduces the vmlinux footprint
of such a reference by 8x (8 byte absolute reference + 24 byte RELA entry
vs 4 byte relative reference)
Patch #3 was sent out before as a single patch. This series supersedes
the previous submission. This version makes relative ksymtab entries
dependent on the new Kconfig symbol HAVE_ARCH_PREL32_RELOCATIONS rather
than trying to infer from kbuild test robot replies for which architectures
it should be blacklisted.
Patch #1 introduces the new Kconfig symbol HAVE_ARCH_PREL32_RELOCATIONS,
and sets it for the main architectures that are expected to benefit the
most from this feature, i.e., 64-bit architectures or ones that use
runtime relocations.
Patch #2 add support for #define'ing __DISABLE_EXPORTS to get rid of
ksymtab/kcrctab sections in decompressor and EFI stub objects when
rebuilding existing C files to run in a different context.
Patches #4 - #6 implement relative references for initcalls, PCI fixups
and tracepoints, respectively, all of which produce sections with order
~1000 entries on an arm64 defconfig kernel with tracing enabled. This
means we save about 28 KB of vmlinux space for each of these patches.
[From the v7 series blurb, which included the jump_label patches as well]:
For the arm64 kernel, all patches combined reduce the memory footprint of
vmlinux by about 1.3 MB (using a config copied from Ubuntu that has KASLR
enabled), of which ~1 MB is the size reduction of the RELA section in .init,
and the remaining 300 KB is reduction of .text/.data.
Branch:
git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git relative-special-sections-v9
Changes since v8:
- add Nico's ack (#2)
- drop 'const' qualifier from __ADDRESSABLE(sym) to prevent mismatching
attributes for the .discard section (#3)
- drop all uses of VMLINUX_SYMBOL_STR(), which is on its way out (#3 - #6)
Changes since v7:
- dropped the jump_label patches, these will be revisited in a separate series
- reorder __DISABLE_EXPORTS with __KSYM_DEPS__ check in #2
- use offset_to_ptr() helper function to abstract the relative pointer
conversion [int *off -> (ulong)off + *off] (#3 - #6)
- rebase onto v4.16-rc3
Changes since v6:
- drop S390 from patch #1 introducing HAVE_ARCH_PREL32_RELOCATIONS: kbuild
robot threw me some s390 curveballs, and given that s390 does not define
CONFIG_RELOCATABLE in the first place, it does not benefit as much from
relative references as arm64, x86 and power do
- add patch to allow symbol exports to be disabled at compilation unit
granularity (#2)
- get rid of arm64 vmlinux.lds.S hunk to ensure code generated by __ADDRESSABLE
gets discarded from the EFI stub - it is no longer needed after adding #2 (#1)
- change _ADDRESSABLE() to emit a data reference, not a code reference - this
is another simplification made possible by patch #2 (#3)
- add Steven's ack to #6
- split x86 jump_label patch into two (#9, #10)
Changes since v5:
- add missing jump_label prototypes to s390 jump_label.h (#6)
- fix inverted condition in call to jump_entry_is_module_init() (#6)
Changes since v4:
- add patches to convert x86 and arm64 to use relative references for jump
tables (#6 - #8)
- rename PCI patch and add Bjorn's ack (#4)
- rebase onto v4.15-rc5
Changes since v3:
- fix module unload issue in patch #5 reported by Jessica, by reusing the
updated routine for_each_tracepoint_range() for the quiescent check at
module unload time; this requires this routine to be moved before
tracepoint_module_going() in kernel/tracepoint.c
- add Jessica's ack to #2
- rebase onto v4.14-rc1
Changes since v2:
- Revert my slightly misguided attempt to appease checkpatch, which resulted
in needless churn and worse code. This v3 is based on v1 with a few tweaks
that were actually reasonable checkpatch warnings: unnecessary braces (as
pointed out by Ingo) and other minor whitespace misdemeanors.
Changes since v1:
- Remove checkpatch errors to the extent feasible: in some cases, this
involves moving extern declarations into C files, and switching to
struct definitions rather than typedefs. Some errors are impossible
to fix: please find the remaining ones after the diffstat.
- Used 'int' instead if 'signed int' for the various offset fields: there
is no ambiguity between architectures regarding its signedness (unlike
'char')
- Refactor the different patches to be more uniform in the way they define
the section entry type and accessors in the .h file, and avoid the need to
add #ifdefs to the C code.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Thomas Garnier <thgarnie@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Morris <jmorris@namei.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Nicolas Pitre <nico@linaro.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jessica Yu <jeyu@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: x86@kernel.org
Ard Biesheuvel (6):
arch: enable relative relocations for arm64, power and x86
module: allow symbol exports to be disabled
module: use relative references for __ksymtab entries
init: allow initcall tables to be emitted using relative references
PCI: Add support for relative addressing in quirk tables
kernel: tracepoints: add support for relative references
arch/Kconfig | 10 ++++
arch/arm64/Kconfig | 1 +
arch/powerpc/Kconfig | 1 +
arch/x86/Kconfig | 1 +
arch/x86/boot/compressed/kaslr.c | 5 +-
arch/x86/include/asm/Kbuild | 1 +
arch/x86/include/asm/export.h | 5 --
drivers/firmware/efi/libstub/Makefile | 3 +-
drivers/pci/quirks.c | 12 +++--
include/asm-generic/export.h | 12 ++++-
include/linux/compiler.h | 19 +++++++
include/linux/export.h | 57 +++++++++++++++-----
include/linux/init.h | 44 +++++++++++----
include/linux/pci.h | 20 +++++++
include/linux/tracepoint.h | 19 +++++--
init/main.c | 32 +++++------
kernel/module.c | 32 ++++++++---
kernel/printk/printk.c | 16 +++---
kernel/tracepoint.c | 49 +++++++++--------
security/security.c | 17 +++---
20 files changed, 255 insertions(+), 101 deletions(-)
delete mode 100644 arch/x86/include/asm/export.h
--
2.11.0
^ permalink raw reply
* [PATCH v9 1/6] arch: enable relative relocations for arm64, power and x86
From: Ard Biesheuvel @ 2018-06-26 18:27 UTC (permalink / raw)
To: linux-kernel
Cc: Ard Biesheuvel, Arnd Bergmann, Kees Cook, Will Deacon,
Michael Ellerman, Thomas Garnier, Thomas Gleixner,
Serge E. Hallyn, Bjorn Helgaas, Benjamin Herrenschmidt,
Russell King, Paul Mackerras, Catalin Marinas, Petr Mladek,
Ingo Molnar, James Morris, Andrew Morton, Nicolas Pitre,
Josh Poimboeuf, Steven Rostedt, Sergey Senozhatsky,
Linus Torvalds, Jessica Yu, linux-arm-kernel, linuxppc-dev, x86
In-Reply-To: <20180626182802.19932-1-ard.biesheuvel@linaro.org>
Before updating certain subsystems to use place relative 32-bit
relocations in special sections, to save space and reduce the
number of absolute relocations that need to be processed at runtime
by relocatable kernels, introduce the Kconfig symbol and define it
for some architectures that should be able to support and benefit
from it.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: x86@kernel.org
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/Kconfig | 10 ++++++++++
arch/arm64/Kconfig | 1 +
arch/powerpc/Kconfig | 1 +
arch/x86/Kconfig | 1 +
4 files changed, 13 insertions(+)
diff --git a/arch/Kconfig b/arch/Kconfig
index 1aa59063f1fd..2b8b70820002 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -971,4 +971,14 @@ config REFCOUNT_FULL
against various use-after-free conditions that can be used in
security flaw exploits.
+config HAVE_ARCH_PREL32_RELOCATIONS
+ bool
+ help
+ May be selected by an architecture if it supports place-relative
+ 32-bit relocations, both in the toolchain and in the module loader,
+ in which case relative references can be used in special sections
+ for PCI fixup, initcalls etc which are only half the size on 64 bit
+ architectures, and don't require runtime relocation on relocatable
+ kernels.
+
source "kernel/gcov/Kconfig"
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 42c090cf0292..1940c6405d04 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -95,6 +95,7 @@ config ARM64
select HAVE_ARCH_KGDB
select HAVE_ARCH_MMAP_RND_BITS
select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
+ select HAVE_ARCH_PREL32_RELOCATIONS
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_THREAD_STRUCT_WHITELIST
select HAVE_ARCH_TRACEHOOK
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 9f2b75fe2c2d..e4fe19789b8b 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -177,6 +177,7 @@ config PPC
select HAVE_ARCH_KGDB
select HAVE_ARCH_MMAP_RND_BITS
select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
+ select HAVE_ARCH_PREL32_RELOCATIONS
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_TRACEHOOK
select HAVE_CBPF_JIT if !PPC64
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f1dbb4ee19d7..e10a3542db7e 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -123,6 +123,7 @@ config X86
select HAVE_ARCH_MMAP_RND_BITS if MMU
select HAVE_ARCH_MMAP_RND_COMPAT_BITS if MMU && COMPAT
select HAVE_ARCH_COMPAT_MMAP_BASES if MMU && COMPAT
+ select HAVE_ARCH_PREL32_RELOCATIONS
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_THREAD_STRUCT_WHITELIST
select HAVE_ARCH_TRACEHOOK
--
2.11.0
^ permalink raw reply related
* [PATCH v9 2/6] module: allow symbol exports to be disabled
From: Ard Biesheuvel @ 2018-06-26 18:27 UTC (permalink / raw)
To: linux-kernel
Cc: Ard Biesheuvel, Arnd Bergmann, Kees Cook, Will Deacon,
Michael Ellerman, Thomas Garnier, Thomas Gleixner,
Serge E. Hallyn, Bjorn Helgaas, Benjamin Herrenschmidt,
Russell King, Paul Mackerras, Catalin Marinas, Petr Mladek,
Ingo Molnar, James Morris, Andrew Morton, Nicolas Pitre,
Josh Poimboeuf, Steven Rostedt, Sergey Senozhatsky,
Linus Torvalds, Jessica Yu, linux-arm-kernel, linuxppc-dev, x86
In-Reply-To: <20180626182802.19932-1-ard.biesheuvel@linaro.org>
To allow existing C code to be incorporated into the decompressor or
the UEFI stub, introduce a CPP macro that turns all EXPORT_SYMBOL_xxx
declarations into nops, and #define it in places where such exports
are undesirable. Note that this gets rid of a rather dodgy redefine
of linux/export.h's header guard.
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/x86/boot/compressed/kaslr.c | 5 +----
drivers/firmware/efi/libstub/Makefile | 3 ++-
include/linux/export.h | 11 ++++++++++-
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index b87a7582853d..ed7a123bba42 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -23,11 +23,8 @@
* _ctype[] in lib/ctype.c is needed by isspace() of linux/ctype.h.
* While both lib/ctype.c and lib/cmdline.c will bring EXPORT_SYMBOL
* which is meaningless and will cause compiling error in some cases.
- * So do not include linux/export.h and define EXPORT_SYMBOL(sym)
- * as empty.
*/
-#define _LINUX_EXPORT_H
-#define EXPORT_SYMBOL(sym)
+#define __DISABLE_EXPORTS
#include "misc.h"
#include "error.h"
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index a34e9290a699..0d0d3483241c 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -20,7 +20,8 @@ cflags-$(CONFIG_EFI_ARMSTUB) += -I$(srctree)/scripts/dtc/libfdt
KBUILD_CFLAGS := $(cflags-y) -DDISABLE_BRANCH_PROFILING \
-D__NO_FORTIFY \
$(call cc-option,-ffreestanding) \
- $(call cc-option,-fno-stack-protector)
+ $(call cc-option,-fno-stack-protector) \
+ -D__DISABLE_EXPORTS
GCOV_PROFILE := n
KASAN_SANITIZE := n
diff --git a/include/linux/export.h b/include/linux/export.h
index b768d6dd3c90..ea7df303d68d 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -66,7 +66,16 @@ extern struct module __this_module;
__attribute__((section("___ksymtab" sec "+" #sym), used)) \
= { (unsigned long)&sym, __kstrtab_##sym }
-#if defined(__KSYM_DEPS__)
+#if defined(__DISABLE_EXPORTS)
+
+/*
+ * Allow symbol exports to be disabled completely so that C code may
+ * be reused in other execution contexts such as the UEFI stub or the
+ * decompressor.
+ */
+#define __EXPORT_SYMBOL(sym, sec)
+
+#elif defined(__KSYM_DEPS__)
/*
* For fine grained build dependencies, we want to tell the build system
--
2.11.0
^ permalink raw reply related
* [PATCH v9 3/6] module: use relative references for __ksymtab entries
From: Ard Biesheuvel @ 2018-06-26 18:27 UTC (permalink / raw)
To: linux-kernel
Cc: Ard Biesheuvel, Arnd Bergmann, Kees Cook, Will Deacon,
Michael Ellerman, Thomas Garnier, Thomas Gleixner,
Serge E. Hallyn, Bjorn Helgaas, Benjamin Herrenschmidt,
Russell King, Paul Mackerras, Catalin Marinas, Petr Mladek,
Ingo Molnar, James Morris, Andrew Morton, Nicolas Pitre,
Josh Poimboeuf, Steven Rostedt, Sergey Senozhatsky,
Linus Torvalds, Jessica Yu, linux-arm-kernel, linuxppc-dev, x86,
Ingo Molnar
In-Reply-To: <20180626182802.19932-1-ard.biesheuvel@linaro.org>
An ordinary arm64 defconfig build has ~64 KB worth of __ksymtab
entries, each consisting of two 64-bit fields containing absolute
references, to the symbol itself and to a char array containing
its name, respectively.
When we build the same configuration with KASLR enabled, we end
up with an additional ~192 KB of relocations in the .init section,
i.e., one 24 byte entry for each absolute reference, which all need
to be processed at boot time.
Given how the struct kernel_symbol that describes each entry is
completely local to module.c (except for the references emitted
by EXPORT_SYMBOL() itself), we can easily modify it to contain
two 32-bit relative references instead. This reduces the size of
the __ksymtab section by 50% for all 64-bit architectures, and
gets rid of the runtime relocations entirely for architectures
implementing KASLR, either via standard PIE linking (arm64) or
using custom host tools (x86).
Note that the binary search involving __ksymtab contents relies
on each section being sorted by symbol name. This is implemented
based on the input section names, not the names in the ksymtab
entries, so this patch does not interfere with that.
Given that the use of place-relative relocations requires support
both in the toolchain and in the module loader, we cannot enable
this feature for all architectures. So make it dependent on whether
CONFIG_HAVE_ARCH_PREL32_RELOCATIONS is defined.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Thomas Garnier <thgarnie@google.com>
Cc: Nicolas Pitre <nico@linaro.org>
Acked-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/x86/include/asm/Kbuild | 1 +
arch/x86/include/asm/export.h | 5 ---
include/asm-generic/export.h | 12 ++++-
include/linux/compiler.h | 19 ++++++++
include/linux/export.h | 46 +++++++++++++++-----
kernel/module.c | 32 +++++++++++---
6 files changed, 91 insertions(+), 24 deletions(-)
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index de690c2d2e33..a0ab9ab61c75 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -8,5 +8,6 @@ generated-y += xen-hypercalls.h
generic-y += dma-contiguous.h
generic-y += early_ioremap.h
+generic-y += export.h
generic-y += mcs_spinlock.h
generic-y += mm-arch-hooks.h
diff --git a/arch/x86/include/asm/export.h b/arch/x86/include/asm/export.h
deleted file mode 100644
index 2a51d66689c5..000000000000
--- a/arch/x86/include/asm/export.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifdef CONFIG_64BIT
-#define KSYM_ALIGN 16
-#endif
-#include <asm-generic/export.h>
diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h
index 68efb950a918..4d73e6e3c66c 100644
--- a/include/asm-generic/export.h
+++ b/include/asm-generic/export.h
@@ -5,12 +5,10 @@
#define KSYM_FUNC(x) x
#endif
#ifdef CONFIG_64BIT
-#define __put .quad
#ifndef KSYM_ALIGN
#define KSYM_ALIGN 8
#endif
#else
-#define __put .long
#ifndef KSYM_ALIGN
#define KSYM_ALIGN 4
#endif
@@ -19,6 +17,16 @@
#define KCRC_ALIGN 4
#endif
+.macro __put, val, name
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+ .long \val - ., \name - .
+#elif defined(CONFIG_64BIT)
+ .quad \val, \name
+#else
+ .long \val, \name
+#endif
+.endm
+
/*
* note on .section use: @progbits vs %progbits nastiness doesn't matter,
* since we immediately emit into those sections anyway.
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 42506e4d1f53..2d9c63f41031 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -280,6 +280,25 @@ unsigned long read_word_at_a_time(const void *addr)
#endif /* __KERNEL__ */
+/*
+ * Force the compiler to emit 'sym' as a symbol, so that we can reference
+ * it from inline assembler. Necessary in case 'sym' could be inlined
+ * otherwise, or eliminated entirely due to lack of references that are
+ * visible to the compiler.
+ */
+#define __ADDRESSABLE(sym) \
+ static void * __attribute__((section(".discard"), used)) \
+ __PASTE(__addressable_##sym, __LINE__) = (void *)&sym;
+
+/**
+ * offset_to_ptr - convert a relative memory offset to an absolute pointer
+ * @off: the address of the 32-bit offset value
+ */
+static inline void *offset_to_ptr(const int *off)
+{
+ return (void *)((unsigned long)off + *off);
+}
+
#endif /* __ASSEMBLY__ */
#ifndef __optimize
diff --git a/include/linux/export.h b/include/linux/export.h
index ea7df303d68d..ae072bc5aacf 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -18,12 +18,6 @@
#define VMLINUX_SYMBOL_STR(x) __VMLINUX_SYMBOL_STR(x)
#ifndef __ASSEMBLY__
-struct kernel_symbol
-{
- unsigned long value;
- const char *name;
-};
-
#ifdef MODULE
extern struct module __this_module;
#define THIS_MODULE (&__this_module)
@@ -54,17 +48,47 @@ extern struct module __this_module;
#define __CRC_SYMBOL(sym, sec)
#endif
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+#include <linux/compiler.h>
+/*
+ * Emit the ksymtab entry as a pair of relative references: this reduces
+ * the size by half on 64-bit architectures, and eliminates the need for
+ * absolute relocations that require runtime processing on relocatable
+ * kernels.
+ */
+#define __KSYMTAB_ENTRY(sym, sec) \
+ __ADDRESSABLE(sym) \
+ asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \
+ " .balign 8 \n" \
+ "__ksymtab_" #sym ": \n" \
+ " .long " #sym "- . \n" \
+ " .long __kstrtab_" #sym "- . \n" \
+ " .previous \n")
+
+struct kernel_symbol {
+ int value_offset;
+ int name_offset;
+};
+#else
+#define __KSYMTAB_ENTRY(sym, sec) \
+ static const struct kernel_symbol __ksymtab_##sym \
+ __attribute__((section("___ksymtab" sec "+" #sym), used)) \
+ = { (unsigned long)&sym, __kstrtab_##sym }
+
+struct kernel_symbol {
+ unsigned long value;
+ const char *name;
+};
+#endif
+
/* For every exported symbol, place a struct in the __ksymtab section */
#define ___EXPORT_SYMBOL(sym, sec) \
extern typeof(sym) sym; \
__CRC_SYMBOL(sym, sec) \
static const char __kstrtab_##sym[] \
- __attribute__((section("__ksymtab_strings"), aligned(1))) \
+ __attribute__((section("__ksymtab_strings"), used, aligned(1))) \
= #sym; \
- static const struct kernel_symbol __ksymtab_##sym \
- __used \
- __attribute__((section("___ksymtab" sec "+" #sym), used)) \
- = { (unsigned long)&sym, __kstrtab_##sym }
+ __KSYMTAB_ENTRY(sym, sec)
#if defined(__DISABLE_EXPORTS)
diff --git a/kernel/module.c b/kernel/module.c
index f475f30eed8c..7cb82e0fcac0 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -547,12 +547,30 @@ static bool check_symbol(const struct symsearch *syms,
return true;
}
+static unsigned long kernel_symbol_value(const struct kernel_symbol *sym)
+{
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+ return (unsigned long)offset_to_ptr(&sym->value_offset);
+#else
+ return sym->value;
+#endif
+}
+
+static const char *kernel_symbol_name(const struct kernel_symbol *sym)
+{
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+ return offset_to_ptr(&sym->name_offset);
+#else
+ return sym->name;
+#endif
+}
+
static int cmp_name(const void *va, const void *vb)
{
const char *a;
const struct kernel_symbol *b;
a = va; b = vb;
- return strcmp(a, b->name);
+ return strcmp(a, kernel_symbol_name(b));
}
static bool find_symbol_in_section(const struct symsearch *syms,
@@ -2192,7 +2210,7 @@ void *__symbol_get(const char *symbol)
sym = NULL;
preempt_enable();
- return sym ? (void *)sym->value : NULL;
+ return sym ? (void *)kernel_symbol_value(sym) : NULL;
}
EXPORT_SYMBOL_GPL(__symbol_get);
@@ -2222,10 +2240,12 @@ static int verify_export_symbols(struct module *mod)
for (i = 0; i < ARRAY_SIZE(arr); i++) {
for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) {
- if (find_symbol(s->name, &owner, NULL, true, false)) {
+ if (find_symbol(kernel_symbol_name(s), &owner, NULL,
+ true, false)) {
pr_err("%s: exports duplicate symbol %s"
" (owned by %s)\n",
- mod->name, s->name, module_name(owner));
+ mod->name, kernel_symbol_name(s),
+ module_name(owner));
return -ENOEXEC;
}
}
@@ -2274,7 +2294,7 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
ksym = resolve_symbol_wait(mod, info, name);
/* Ok if resolved. */
if (ksym && !IS_ERR(ksym)) {
- sym[i].st_value = ksym->value;
+ sym[i].st_value = kernel_symbol_value(ksym);
break;
}
@@ -2534,7 +2554,7 @@ static int is_exported(const char *name, unsigned long value,
ks = lookup_symbol(name, __start___ksymtab, __stop___ksymtab);
else
ks = lookup_symbol(name, mod->syms, mod->syms + mod->num_syms);
- return ks != NULL && ks->value == value;
+ return ks != NULL && kernel_symbol_value(ks) == value;
}
/* As per nm */
--
2.11.0
^ permalink raw reply related
* [PATCH v9 4/6] init: allow initcall tables to be emitted using relative references
From: Ard Biesheuvel @ 2018-06-26 18:27 UTC (permalink / raw)
To: linux-kernel
Cc: Ard Biesheuvel, Arnd Bergmann, Kees Cook, Will Deacon,
Michael Ellerman, Thomas Garnier, Thomas Gleixner,
Serge E. Hallyn, Bjorn Helgaas, Benjamin Herrenschmidt,
Russell King, Paul Mackerras, Catalin Marinas, Petr Mladek,
Ingo Molnar, James Morris, Andrew Morton, Nicolas Pitre,
Josh Poimboeuf, Steven Rostedt, Sergey Senozhatsky,
Linus Torvalds, Jessica Yu, linux-arm-kernel, linuxppc-dev, x86
In-Reply-To: <20180626182802.19932-1-ard.biesheuvel@linaro.org>
Allow the initcall tables to be emitted using relative references that
are only half the size on 64-bit architectures and don't require fixups
at runtime on relocatable kernels.
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: James Morris <jmorris@namei.org>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
include/linux/init.h | 44 +++++++++++++++-----
init/main.c | 32 +++++++-------
kernel/printk/printk.c | 16 +++----
security/security.c | 17 ++++----
4 files changed, 68 insertions(+), 41 deletions(-)
diff --git a/include/linux/init.h b/include/linux/init.h
index bc27cf03c41e..2538d176dd1f 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -116,8 +116,24 @@
typedef int (*initcall_t)(void);
typedef void (*exitcall_t)(void);
-extern initcall_t __con_initcall_start[], __con_initcall_end[];
-extern initcall_t __security_initcall_start[], __security_initcall_end[];
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+typedef int initcall_entry_t;
+
+static inline initcall_t initcall_from_entry(initcall_entry_t *entry)
+{
+ return offset_to_ptr(entry);
+}
+#else
+typedef initcall_t initcall_entry_t;
+
+static inline initcall_t initcall_from_entry(initcall_entry_t *entry)
+{
+ return *entry;
+}
+#endif
+
+extern initcall_entry_t __con_initcall_start[], __con_initcall_end[];
+extern initcall_entry_t __security_initcall_start[], __security_initcall_end[];
/* Used for contructor calls. */
typedef void (*ctor_fn_t)(void);
@@ -167,9 +183,20 @@ extern bool initcall_debug;
* as KEEP() in the linker script.
*/
-#define __define_initcall(fn, id) \
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+#define ___define_initcall(fn, id, __sec) \
+ __ADDRESSABLE(fn) \
+ asm(".section \"" #__sec ".init\", \"a\" \n" \
+ "__initcall_" #fn #id ": \n" \
+ ".long " #fn " - . \n" \
+ ".previous \n");
+#else
+#define ___define_initcall(fn, id, __sec) \
static initcall_t __initcall_##fn##id __used \
- __attribute__((__section__(".initcall" #id ".init"))) = fn;
+ __attribute__((__section__(#__sec ".init"))) = fn;
+#endif
+
+#define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
/*
* Early initcalls run before initializing SMP.
@@ -208,13 +235,8 @@ extern bool initcall_debug;
#define __exitcall(fn) \
static exitcall_t __exitcall_##fn __exit_call = fn
-#define console_initcall(fn) \
- static initcall_t __initcall_##fn \
- __used __section(.con_initcall.init) = fn
-
-#define security_initcall(fn) \
- static initcall_t __initcall_##fn \
- __used __section(.security_initcall.init) = fn
+#define console_initcall(fn) ___define_initcall(fn,, .con_initcall)
+#define security_initcall(fn) ___define_initcall(fn,, .security_initcall)
struct obs_kernel_param {
const char *str;
diff --git a/init/main.c b/init/main.c
index 3b4ada11ed52..e59a01f163d6 100644
--- a/init/main.c
+++ b/init/main.c
@@ -901,18 +901,18 @@ int __init_or_module do_one_initcall(initcall_t fn)
}
-extern initcall_t __initcall_start[];
-extern initcall_t __initcall0_start[];
-extern initcall_t __initcall1_start[];
-extern initcall_t __initcall2_start[];
-extern initcall_t __initcall3_start[];
-extern initcall_t __initcall4_start[];
-extern initcall_t __initcall5_start[];
-extern initcall_t __initcall6_start[];
-extern initcall_t __initcall7_start[];
-extern initcall_t __initcall_end[];
-
-static initcall_t *initcall_levels[] __initdata = {
+extern initcall_entry_t __initcall_start[];
+extern initcall_entry_t __initcall0_start[];
+extern initcall_entry_t __initcall1_start[];
+extern initcall_entry_t __initcall2_start[];
+extern initcall_entry_t __initcall3_start[];
+extern initcall_entry_t __initcall4_start[];
+extern initcall_entry_t __initcall5_start[];
+extern initcall_entry_t __initcall6_start[];
+extern initcall_entry_t __initcall7_start[];
+extern initcall_entry_t __initcall_end[];
+
+static initcall_entry_t *initcall_levels[] __initdata = {
__initcall0_start,
__initcall1_start,
__initcall2_start,
@@ -938,7 +938,7 @@ static char *initcall_level_names[] __initdata = {
static void __init do_initcall_level(int level)
{
- initcall_t *fn;
+ initcall_entry_t *fn;
strcpy(initcall_command_line, saved_command_line);
parse_args(initcall_level_names[level],
@@ -949,7 +949,7 @@ static void __init do_initcall_level(int level)
trace_initcall_level(initcall_level_names[level]);
for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++)
- do_one_initcall(*fn);
+ do_one_initcall(initcall_from_entry(fn));
}
static void __init do_initcalls(void)
@@ -980,11 +980,11 @@ static void __init do_basic_setup(void)
static void __init do_pre_smp_initcalls(void)
{
- initcall_t *fn;
+ initcall_entry_t *fn;
trace_initcall_level("early");
for (fn = __initcall_start; fn < __initcall0_start; fn++)
- do_one_initcall(*fn);
+ do_one_initcall(initcall_from_entry(fn));
}
/*
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 247808333ba4..688a27b0888c 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2772,7 +2772,8 @@ EXPORT_SYMBOL(unregister_console);
void __init console_init(void)
{
int ret;
- initcall_t *call;
+ initcall_t call;
+ initcall_entry_t *ce;
/* Setup the default TTY line discipline. */
n_tty_init();
@@ -2781,13 +2782,14 @@ void __init console_init(void)
* set up the console device so that later boot sequences can
* inform about problems etc..
*/
- call = __con_initcall_start;
+ ce = __con_initcall_start;
trace_initcall_level("console");
- while (call < __con_initcall_end) {
- trace_initcall_start((*call));
- ret = (*call)();
- trace_initcall_finish((*call), ret);
- call++;
+ while (ce < __con_initcall_end) {
+ call = initcall_from_entry(ce);
+ trace_initcall_start(call);
+ ret = call();
+ trace_initcall_finish(call, ret);
+ ce++;
}
}
diff --git a/security/security.c b/security/security.c
index 68f46d849abe..1e7b1486d82a 100644
--- a/security/security.c
+++ b/security/security.c
@@ -48,14 +48,17 @@ static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1] =
static void __init do_security_initcalls(void)
{
int ret;
- initcall_t *call;
- call = __security_initcall_start;
+ initcall_t call;
+ initcall_entry_t *ce;
+
+ ce = __security_initcall_start;
trace_initcall_level("security");
- while (call < __security_initcall_end) {
- trace_initcall_start((*call));
- ret = (*call) ();
- trace_initcall_finish((*call), ret);
- call++;
+ while (ce < __security_initcall_end) {
+ call = initcall_from_entry(ce);
+ trace_initcall_start(call);
+ ret = call();
+ trace_initcall_finish(call, ret);
+ ce++;
}
}
--
2.11.0
^ permalink raw reply related
* [PATCH v9 5/6] PCI: Add support for relative addressing in quirk tables
From: Ard Biesheuvel @ 2018-06-26 18:28 UTC (permalink / raw)
To: linux-kernel
Cc: Ard Biesheuvel, Arnd Bergmann, Kees Cook, Will Deacon,
Michael Ellerman, Thomas Garnier, Thomas Gleixner,
Serge E. Hallyn, Bjorn Helgaas, Benjamin Herrenschmidt,
Russell King, Paul Mackerras, Catalin Marinas, Petr Mladek,
Ingo Molnar, James Morris, Andrew Morton, Nicolas Pitre,
Josh Poimboeuf, Steven Rostedt, Sergey Senozhatsky,
Linus Torvalds, Jessica Yu, linux-arm-kernel, linuxppc-dev, x86
In-Reply-To: <20180626182802.19932-1-ard.biesheuvel@linaro.org>
Allow the PCI quirk tables to be emitted in a way that avoids absolute
references to the hook functions. This reduces the size of the entries,
and, more importantly, makes them invariant under runtime relocation
(e.g., for KASLR)
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
drivers/pci/quirks.c | 12 +++++++++---
include/linux/pci.h | 20 ++++++++++++++++++++
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index f439de848658..0ba4e446e5db 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -64,9 +64,15 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
f->vendor == (u16) PCI_ANY_ID) &&
(f->device == dev->device ||
f->device == (u16) PCI_ANY_ID)) {
- calltime = fixup_debug_start(dev, f->hook);
- f->hook(dev);
- fixup_debug_report(dev, calltime, f->hook);
+ void (*hook)(struct pci_dev *dev);
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+ hook = offset_to_ptr(&f->hook_offset);
+#else
+ hook = f->hook;
+#endif
+ calltime = fixup_debug_start(dev, hook);
+ hook(dev);
+ fixup_debug_report(dev, calltime, hook);
}
}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 340029b2fb38..51baa3ab5195 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1795,7 +1795,11 @@ struct pci_fixup {
u16 device; /* Or PCI_ANY_ID */
u32 class; /* Or PCI_ANY_ID */
unsigned int class_shift; /* should be 0, 8, 16 */
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+ int hook_offset;
+#else
void (*hook)(struct pci_dev *dev);
+#endif
};
enum pci_fixup_pass {
@@ -1809,12 +1813,28 @@ enum pci_fixup_pass {
pci_fixup_suspend_late, /* pci_device_suspend_late() */
};
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+#define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
+ class_shift, hook) \
+ __ADDRESSABLE(hook) \
+ asm(".section " #sec ", \"a\" \n" \
+ ".balign 16 \n" \
+ ".short " #vendor ", " #device " \n" \
+ ".long " #class ", " #class_shift " \n" \
+ ".long " #hook " - . \n" \
+ ".previous \n");
+#define DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
+ class_shift, hook) \
+ __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
+ class_shift, hook)
+#else
/* Anonymous variables would be nice... */
#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \
class_shift, hook) \
static const struct pci_fixup __PASTE(__pci_fixup_##name,__LINE__) __used \
__attribute__((__section__(#section), aligned((sizeof(void *))))) \
= { vendor, device, class, class_shift, hook };
+#endif
#define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \
class_shift, hook) \
--
2.11.0
^ permalink raw reply related
* [PATCH v9 6/6] kernel: tracepoints: add support for relative references
From: Ard Biesheuvel @ 2018-06-26 18:28 UTC (permalink / raw)
To: linux-kernel
Cc: Ard Biesheuvel, Arnd Bergmann, Kees Cook, Will Deacon,
Michael Ellerman, Thomas Garnier, Thomas Gleixner,
Serge E. Hallyn, Bjorn Helgaas, Benjamin Herrenschmidt,
Russell King, Paul Mackerras, Catalin Marinas, Petr Mladek,
Ingo Molnar, James Morris, Andrew Morton, Nicolas Pitre,
Josh Poimboeuf, Steven Rostedt, Sergey Senozhatsky,
Linus Torvalds, Jessica Yu, linux-arm-kernel, linuxppc-dev, x86
In-Reply-To: <20180626182802.19932-1-ard.biesheuvel@linaro.org>
To avoid the need for relocating absolute references to tracepoint
structures at boot time when running relocatable kernels (which may
take a disproportionate amount of space), add the option to emit
these tables as relative references instead.
Cc: Ingo Molnar <mingo@redhat.com>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
include/linux/tracepoint.h | 19 ++++++--
kernel/tracepoint.c | 49 +++++++++++---------
2 files changed, 41 insertions(+), 27 deletions(-)
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 19a690b559ca..b130e40d82cb 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -225,6 +225,19 @@ extern void syscall_unregfunc(void);
return static_key_false(&__tracepoint_##name.key); \
}
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+#define __TRACEPOINT_ENTRY(name) \
+ asm(" .section \"__tracepoints_ptrs\", \"a\" \n" \
+ " .balign 4 \n" \
+ " .long __tracepoint_" #name " - . \n" \
+ " .previous \n")
+#else
+#define __TRACEPOINT_ENTRY(name) \
+ static struct tracepoint * const __tracepoint_ptr_##name __used \
+ __attribute__((section("__tracepoints_ptrs"))) = \
+ &__tracepoint_##name
+#endif
+
/*
* We have no guarantee that gcc and the linker won't up-align the tracepoint
* structures, so we create an array of pointers that will be used for iteration
@@ -234,11 +247,9 @@ extern void syscall_unregfunc(void);
static const char __tpstrtab_##name[] \
__attribute__((section("__tracepoints_strings"))) = #name; \
struct tracepoint __tracepoint_##name \
- __attribute__((section("__tracepoints"))) = \
+ __attribute__((section("__tracepoints"), used)) = \
{ __tpstrtab_##name, STATIC_KEY_INIT_FALSE, reg, unreg, NULL };\
- static struct tracepoint * const __tracepoint_ptr_##name __used \
- __attribute__((section("__tracepoints_ptrs"))) = \
- &__tracepoint_##name;
+ __TRACEPOINT_ENTRY(name);
#define DEFINE_TRACE(name) \
DEFINE_TRACE_FN(name, NULL, NULL);
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 6dc6356c3327..451c8f5e8345 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -325,6 +325,27 @@ int tracepoint_probe_unregister(struct tracepoint *tp, void *probe, void *data)
}
EXPORT_SYMBOL_GPL(tracepoint_probe_unregister);
+static void for_each_tracepoint_range(struct tracepoint * const *begin,
+ struct tracepoint * const *end,
+ void (*fct)(struct tracepoint *tp, void *priv),
+ void *priv)
+{
+ if (!begin)
+ return;
+
+ if (IS_ENABLED(CONFIG_HAVE_ARCH_PREL32_RELOCATIONS)) {
+ const int *iter;
+
+ for (iter = (const int *)begin; iter < (const int *)end; iter++)
+ fct(offset_to_ptr(iter), priv);
+ } else {
+ struct tracepoint * const *iter;
+
+ for (iter = begin; iter < end; iter++)
+ fct(*iter, priv);
+ }
+}
+
#ifdef CONFIG_MODULES
bool trace_module_has_bad_taint(struct module *mod)
{
@@ -389,15 +410,9 @@ EXPORT_SYMBOL_GPL(unregister_tracepoint_module_notifier);
* Ensure the tracer unregistered the module's probes before the module
* teardown is performed. Prevents leaks of probe and data pointers.
*/
-static void tp_module_going_check_quiescent(struct tracepoint * const *begin,
- struct tracepoint * const *end)
+static void tp_module_going_check_quiescent(struct tracepoint *tp, void *priv)
{
- struct tracepoint * const *iter;
-
- if (!begin)
- return;
- for (iter = begin; iter < end; iter++)
- WARN_ON_ONCE((*iter)->funcs);
+ WARN_ON_ONCE(tp->funcs);
}
static int tracepoint_module_coming(struct module *mod)
@@ -448,8 +463,9 @@ static void tracepoint_module_going(struct module *mod)
* Called the going notifier before checking for
* quiescence.
*/
- tp_module_going_check_quiescent(mod->tracepoints_ptrs,
- mod->tracepoints_ptrs + mod->num_tracepoints);
+ for_each_tracepoint_range(mod->tracepoints_ptrs,
+ mod->tracepoints_ptrs + mod->num_tracepoints,
+ tp_module_going_check_quiescent, NULL);
break;
}
}
@@ -501,19 +517,6 @@ static __init int init_tracepoints(void)
__initcall(init_tracepoints);
#endif /* CONFIG_MODULES */
-static void for_each_tracepoint_range(struct tracepoint * const *begin,
- struct tracepoint * const *end,
- void (*fct)(struct tracepoint *tp, void *priv),
- void *priv)
-{
- struct tracepoint * const *iter;
-
- if (!begin)
- return;
- for (iter = begin; iter < end; iter++)
- fct(*iter, priv);
-}
-
/**
* for_each_kernel_tracepoint - iteration on all kernel tracepoints
* @fct: callback
--
2.11.0
^ permalink raw reply related
* Re: [PATCH v9 4/6] init: allow initcall tables to be emitted using relative references
From: James Morris @ 2018-06-26 19:13 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: linux-kernel, Arnd Bergmann, Kees Cook, Will Deacon,
Michael Ellerman, Thomas Garnier, Thomas Gleixner,
Serge E. Hallyn, Bjorn Helgaas, Benjamin Herrenschmidt,
Russell King, Paul Mackerras, Catalin Marinas, Petr Mladek,
Ingo Molnar, Andrew Morton, Nicolas Pitre, Josh Poimboeuf,
Steven Rostedt, Sergey Senozhatsky, Linus Torvalds, Jessica Yu,
linux-arm-kernel, linuxppc-dev, x86
In-Reply-To: <20180626182802.19932-5-ard.biesheuvel@linaro.org>
On Tue, 26 Jun 2018, Ard Biesheuvel wrote:
> Allow the initcall tables to be emitted using relative references that
> are only half the size on 64-bit architectures and don't require fixups
> at runtime on relocatable kernels.
>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: James Morris <jmorris@namei.org>
> Cc: "Serge E. Hallyn" <serge@hallyn.com>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> include/linux/init.h | 44 +++++++++++++++-----
> init/main.c | 32 +++++++-------
> kernel/printk/printk.c | 16 +++----
> security/security.c | 17 ++++----
> 4 files changed, 68 insertions(+), 41 deletions(-)
Acked-by: James Morris <james.morris@microsoft.com>
--
James Morris
<jmorris@namei.org>
^ permalink raw reply
* Re: [PATCH 2/3] drivers/base: reorder consumer and its children behind suppliers
From: Pingfan Liu @ 2018-06-27 2:34 UTC (permalink / raw)
To: dan.carpenter
Cc: kbuild, kbuild-all, linux-kernel, Greg Kroah-Hartman,
Grygorii Strashko, Christoph Hellwig, Bjorn Helgaas, Dave Young,
linux-pci, linuxppc-dev
In-Reply-To: <20180626074426.hzunfbvwbubt3t3p@mwanda>
Hi Dan,
Thanks for your hints, see the comment in lines.
On Tue, Jun 26, 2018 at 3:44 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> [ There is a bug with kbuild where it's not showing the Smatch warnings
> but I can probably guess... - dan ]
>
> Hi Pingfan,
>
> Thank you for the patch! Perhaps something to improve:
>
> url: https://github.com/0day-ci/linux/commits/Pingfan-Liu/drivers-base-bugfix-for-supplier-consumer-ordering-in-device_kset/20180625-132702
>
>
> # https://github.com/0day-ci/linux/commit/1b2a1e63898baf80e8e830991284e1534bc54766
> git remote add linux-review https://github.com/0day-ci/linux
> git remote update linux-review
> git checkout 1b2a1e63898baf80e8e830991284e1534bc54766
> vim +/ret +245 drivers/base/core.c
>
> 1b2a1e63 Pingfan Liu 2018-06-25 216
> 1b2a1e63 Pingfan Liu 2018-06-25 217 /* When reodering, take care of the range of (old_pos(dev), new_pos(dev)),
> 1b2a1e63 Pingfan Liu 2018-06-25 218 * there may be requirement to recursively move item.
> 1b2a1e63 Pingfan Liu 2018-06-25 219 */
> 1b2a1e63 Pingfan Liu 2018-06-25 220 int device_reorder_consumer(struct device *dev)
> 1b2a1e63 Pingfan Liu 2018-06-25 221 {
> 1b2a1e63 Pingfan Liu 2018-06-25 222 struct list_head *iter, *left, *right;
> 1b2a1e63 Pingfan Liu 2018-06-25 223 struct device *cur_dev;
> 1b2a1e63 Pingfan Liu 2018-06-25 224 struct pos_info info;
> 1b2a1e63 Pingfan Liu 2018-06-25 225 int ret, idx;
> 1b2a1e63 Pingfan Liu 2018-06-25 226
> 1b2a1e63 Pingfan Liu 2018-06-25 227 idx = device_links_read_lock();
> 1b2a1e63 Pingfan Liu 2018-06-25 228 if (list_empty(&dev->links.suppliers)) {
> 1b2a1e63 Pingfan Liu 2018-06-25 229 device_links_read_unlock(idx);
> 1b2a1e63 Pingfan Liu 2018-06-25 230 return 0;
> 1b2a1e63 Pingfan Liu 2018-06-25 231 }
> 1b2a1e63 Pingfan Liu 2018-06-25 232 spin_lock(&devices_kset->list_lock);
> 1b2a1e63 Pingfan Liu 2018-06-25 233 list_for_each_prev(iter, &devices_kset->list) {
> 1b2a1e63 Pingfan Liu 2018-06-25 234 cur_dev = list_entry(iter, struct device, kobj.entry);
> 1b2a1e63 Pingfan Liu 2018-06-25 235 ret = find_last_supplier(dev, cur_dev);
> 1b2a1e63 Pingfan Liu 2018-06-25 236 switch (ret) {
> 1b2a1e63 Pingfan Liu 2018-06-25 237 case -1:
> 1b2a1e63 Pingfan Liu 2018-06-25 238 goto unlock;
> 1b2a1e63 Pingfan Liu 2018-06-25 239 case 1:
> 1b2a1e63 Pingfan Liu 2018-06-25 240 break;
> 1b2a1e63 Pingfan Liu 2018-06-25 241 case 0:
> 1b2a1e63 Pingfan Liu 2018-06-25 242 continue;
>
> The break breaks from the switch and the continue continues the loop so
> they're equivalent. Perhaps you intended to break from the loop?
>
Yes, you are right.
> 1b2a1e63 Pingfan Liu 2018-06-25 243 }
> 1b2a1e63 Pingfan Liu 2018-06-25 244 }
> 1b2a1e63 Pingfan Liu 2018-06-25 @245 BUG_ON(!ret);
>
> If the list is empty then "ret" can be unitialized. We test a different
> list "dev->links.suppliers" to see if that's empty. I wrote a bunch of
> code to make Smatch try to understand about empty lists, but I don't
> think it works...
>
Yes, if list_empty, then the code can not touch ret. But ret is
useless in this scene. Does it matter?
Thanks and regards,
Pingfan
> 1b2a1e63 Pingfan Liu 2018-06-25 246
> 1b2a1e63 Pingfan Liu 2018-06-25 247 /* record the affected open section */
> 1b2a1e63 Pingfan Liu 2018-06-25 248 left = dev->kobj.entry.prev;
> 1b2a1e63 Pingfan Liu 2018-06-25 249 right = iter;
> 1b2a1e63 Pingfan Liu 2018-06-25 250 info.pos = list_entry(iter, struct device, kobj.entry);
> 1b2a1e63 Pingfan Liu 2018-06-25 251 info.tail = NULL;
> 1b2a1e63 Pingfan Liu 2018-06-25 252 /* dry out the consumers in (left,right) */
> 1b2a1e63 Pingfan Liu 2018-06-25 253 __device_reorder_consumer(dev, left, right, &info);
> 1b2a1e63 Pingfan Liu 2018-06-25 254
> 1b2a1e63 Pingfan Liu 2018-06-25 255 unlock:
> 1b2a1e63 Pingfan Liu 2018-06-25 256 spin_unlock(&devices_kset->list_lock);
> 1b2a1e63 Pingfan Liu 2018-06-25 257 device_links_read_unlock(idx);
> 1b2a1e63 Pingfan Liu 2018-06-25 258 return 0;
> 1b2a1e63 Pingfan Liu 2018-06-25 259 }
> 1b2a1e63 Pingfan Liu 2018-06-25 260
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply
* Re: [PATCH v3 00/12] macintosh: Resolve various PMU driver problems
From: Michael Ellerman @ 2018-06-27 3:08 UTC (permalink / raw)
To: Finn Thain, geert
Cc: Benjamin Herrenschmidt, Michael Schmitz, linux-m68k, linuxppc-dev,
linux-kernel
In-Reply-To: <alpine.LNX.2.21.1806242119180.34@nippy.intranet>
Hi Finn, Geert,
Finn Thain <fthain@telegraphics.com.au> writes:
> On Wed, 13 Jun 2018, I wrote:
>
>> Finn Thain (12):
>> macintosh/via-pmu: Fix section mismatch warning
>> macintosh/via-pmu: Add missing mmio accessors
>> macintosh/via-pmu: Don't clear shift register interrupt flag twice
>> macintosh/via-pmu: Enhance state machine with new 'uninitialized'
>> state
>> macintosh/via-pmu: Replace via pointer with via1 and via2 pointers
>> macintosh/via-pmu: Add support for m68k PowerBooks
>> macintosh/via-pmu: Make CONFIG_PPC_PMAC Kconfig deps explicit
>> macintosh/via-pmu68k: Don't load driver on unsupported hardware
>> macintosh/via-pmu: Replace via-pmu68k driver with via-pmu driver
>> macintosh: Use common code to access RTC
>> macintosh/via-pmu: Clean up interrupt statistics
>> macintosh/via-pmu: Disambiguate interrupt statistics
>>
>
> Patch 10/12 ("macintosh: Use common code to access RTC") conflicts with
> Arnd's RTC work, but the rest of this series can still be reviewed and
> merged as-is.
OK so you're saying we should drop 10/12 for now.
> I will rewrite patch 10/12 after Arnd's fixes and this series have all
> made their way through both powerpc and m68k trees, and submit it
> separately.
drivers/macintosh is supposedly maintained by Ben, but I'm not sure this
series is high on his todo list.
Should it just go in via the m68k tree?
Or I can create a topic branch to share it between ppc and m68k?
cheers
^ permalink raw reply
* Re: [PATCH v3 00/12] macintosh: Resolve various PMU driver problems
From: Benjamin Herrenschmidt @ 2018-06-27 3:27 UTC (permalink / raw)
To: Michael Ellerman, Finn Thain, geert
Cc: Michael Schmitz, linux-m68k, linuxppc-dev, linux-kernel
In-Reply-To: <874lhp6i4d.fsf@concordia.ellerman.id.au>
On Wed, 2018-06-27 at 13:08 +1000, Michael Ellerman wrote:
> > I will rewrite patch 10/12 after Arnd's fixes and this series have all
> > made their way through both powerpc and m68k trees, and submit it
> > separately.
>
> drivers/macintosh is supposedly maintained by Ben, but I'm not sure this
> series is high on his todo list.
We need at least to pull out a couple of powerbooks we have sitting in
drawers and try it out.
>
> Should it just go in via the m68k tree?
>
> Or I can create a topic branch to share it between ppc and m68k?
^ permalink raw reply
* Re: [PATCH v3] powerpc/32: Remove left over function prototypes
From: Michael Ellerman @ 2018-06-27 3:28 UTC (permalink / raw)
To: Mathieu Malaterre
Cc: Benjamin Herrenschmidt, Paul Mackerras, Nicholas Piggin,
linuxppc-dev, LKML
In-Reply-To: <CA+7wUswdBvm+XCi6r6ewGFuSTAaV9FWmhUyV9vNKatCnurvL-A@mail.gmail.com>
Mathieu Malaterre <malat@debian.org> writes:
> On Thu, Jun 21, 2018 at 1:27 PM Michael Ellerman <mpe@ellerman.id.au> wrote:
>> Mathieu Malaterre <malat@debian.org> writes:
>>
>> > In commit 4aea909eeba3 ("powerpc: Add missing prototypes in setup_32.c")
>>
>> I don't have that commit ^ ?
>>
>> That might be because I squashed some of your fixes together or something?
>
> I am doing an awful lots of mistakes these days. Indeed you've changed
> one of my patch:
>
> https://patchwork.kernel.org/patch/10240997/
>
> This one appeared after a git rebase on my side.
>
>> > diff --git a/arch/powerpc/kernel/setup.h b/arch/powerpc/kernel/setup.h
>> > index 35ca309848d7..829ed66f0a40 100644
>> > --- a/arch/powerpc/kernel/setup.h
>> > +++ b/arch/powerpc/kernel/setup.h
>> > @@ -19,9 +19,6 @@ void irqstack_early_init(void);
>> > void setup_power_save(void);
>> > unsigned long __init early_init(unsigned long dt_ptr);
>> > void __init machine_init(u64 dt_ptr);
>> > -int __init ppc_setup_l2cr(char *str);
>> > -int __init ppc_setup_l3cr(char *str);
>> > -int __init ppc_init(void);
>> > #else
>> > static inline void setup_power_save(void) { };
>> > #endif
>>
>> I have:
>>
>> #ifdef CONFIG_PPC32
>> void setup_power_save(void);
>> #else
>> static inline void setup_power_save(void) { };
>> #endif
>
> Correct.
>
> Sorry for the noise.
OK, no worries. Thanks for persisting.
cheers
^ permalink raw reply
* Re: [PATCH 1/3] [v2] powerpc: mac: fix rtc read/write functions
From: Michael Ellerman @ 2018-06-27 4:32 UTC (permalink / raw)
To: Arnd Bergmann, Paul Mackerras, Geert Uytterhoeven,
Joshua Thompson
Cc: Mathieu Malaterre, Benjamin Herrenschmidt, Greg Ungerer,
linux-m68k, linuxppc-dev, linux-kernel, y2038, Meelis Roos,
Andreas Schwab, Arnd Bergmann
In-Reply-To: <20180619140229.3615110-1-arnd@arndb.de>
Arnd Bergmann <arnd@arndb.de> writes:
> As Mathieu pointed out, my conversion to time64_t was incorrect and resulted
> in negative times to be read from the RTC. The problem is that during the
> conversion from a byte array to a time64_t, the 'unsigned char' variable
> holding the top byte gets turned into a negative signed 32-bit integer
> before being assigned to the 64-bit variable for any times after 1972.
>
> This changes the logic to cast to an unsigned 32-bit number first for
> the Macintosh time and then convert that to the Unix time, which then gives
> us a time in the documented 1904..2040 year range. I decided not to use
> the longer 1970..2106 range that other drivers use, for consistency with
> the literal interpretation of the register, but that could be easily
> changed if we decide we want to support any Mac after 2040.
>
> Just to be on the safe side, I'm also adding a WARN_ON that will trigger
> if either the year 2040 has come and is observed by this driver, or we
> run into an RTC that got set back to a pre-1970 date for some reason
> (the two are indistinguishable).
>
> For the RTC write functions, Andreas found another problem: both
> pmu_request() and cuda_request() are varargs functions, so changing
> the type of the arguments passed into them from 32 bit to 64 bit
> breaks the API for the set_rtc_time functions. This changes it
> back to 32 bits.
>
> The same code exists in arch/m68k/ and is patched in an identical way now
> in a separate patch.
>
> Fixes: 5bfd643583b2 ("powerpc: use time64_t in read_persistent_clock")
> Reported-by: Mathieu Malaterre <malat@debian.org>
> Reported-by: Andreas Schwab <schwab@linux-m68k.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/powerpc/platforms/powermac/time.c | 29 ++++++++++++++++++++---------
> 1 file changed, 20 insertions(+), 9 deletions(-)
So I think I can take this patch in isolation via the powerpc tree as a
fix for 4.18.
I'll leave the other two alone.
cheers
^ permalink raw reply
* Re: [PATCH v9 0/6] add support for relative references in special sections
From: Michael Ellerman @ 2018-06-27 5:33 UTC (permalink / raw)
To: Ard Biesheuvel, linux-kernel
Cc: Ard Biesheuvel, Arnd Bergmann, Kees Cook, Will Deacon,
Thomas Garnier, Thomas Gleixner, Serge E. Hallyn, Bjorn Helgaas,
Benjamin Herrenschmidt, Russell King, Paul Mackerras,
Catalin Marinas, Petr Mladek, Ingo Molnar, James Morris,
Andrew Morton, Nicolas Pitre, Josh Poimboeuf, Steven Rostedt,
Sergey Senozhatsky, Linus Torvalds, Jessica Yu, linux-arm-kernel,
linuxppc-dev, x86
In-Reply-To: <20180626182802.19932-1-ard.biesheuvel@linaro.org>
Ard Biesheuvel <ard.biesheuvel@linaro.org> writes:
> This adds support for emitting special sections such as initcall arrays,
> PCI fixups and tracepoints as relative references rather than absolute
> references. This reduces the size by 50% on 64-bit architectures, but
> more importantly, it removes the need for carrying relocation metadata
> for these sections in relocatable kernels (e.g., for KASLR) that needs
> to be fixed up at boot time. On arm64, this reduces the vmlinux footprint
> of such a reference by 8x (8 byte absolute reference + 24 byte RELA entry
> vs 4 byte relative reference)
...
>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
This seems to be working on powerpc.
It boots on a couple of machines with no obvious badness.
And there's some size reduction with a random config I had lying around:
Total: Before=14820494, After=14673313, chg -0.99%
It can get some more testing once it's in linux-next as far as I'm
concerned.
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
cheers
^ permalink raw reply
* Re: [PATCH v3 00/12] macintosh: Resolve various PMU driver problems
From: Michael Schmitz @ 2018-06-27 5:39 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Michael Ellerman, Finn Thain, geert
Cc: linux-m68k, linuxppc-dev, linux-kernel
In-Reply-To: <cacaecac00c1ac941a78da772bbcfb05142df87d.camel@kernel.crashing.org>
Ben,
Am 27.06.2018 um 15:27 schrieb Benjamin Herrenschmidt:
> On Wed, 2018-06-27 at 13:08 +1000, Michael Ellerman wrote:
>>> I will rewrite patch 10/12 after Arnd's fixes and this series have all
>>> made their way through both powerpc and m68k trees, and submit it
>>> separately.
>>
>> drivers/macintosh is supposedly maintained by Ben, but I'm not sure this
>> series is high on his todo list.
>
> We need at least to pull out a couple of powerbooks we have sitting in
> drawers and try it out.
No need to root around in drawers - I'm sitting in front of one (G3
Titanium) writing this. Let me know if that would help (I've forgotten
most of what I knew about powerpc kernels).
Cheers,
Michael
>
>>
>> Should it just go in via the m68k tree?
>>
>> Or I can create a topic branch to share it between ppc and m68k?
^ permalink raw reply
* Re: [PATCH 2/3] drivers/base: reorder consumer and its children behind suppliers
From: Dan Carpenter @ 2018-06-27 8:34 UTC (permalink / raw)
To: Pingfan Liu
Cc: kbuild, kbuild-all, linux-kernel, Greg Kroah-Hartman,
Grygorii Strashko, Christoph Hellwig, Bjorn Helgaas, Dave Young,
linux-pci, linuxppc-dev
In-Reply-To: <CAFgQCTsCFP_6znUaFKnczuUJjMMA1Hq_Qrk6CUVs+EFEBZgTMQ@mail.gmail.com>
On Wed, Jun 27, 2018 at 10:34:54AM +0800, Pingfan Liu wrote:
> > 1b2a1e63 Pingfan Liu 2018-06-25 243 }
> > 1b2a1e63 Pingfan Liu 2018-06-25 244 }
> > 1b2a1e63 Pingfan Liu 2018-06-25 @245 BUG_ON(!ret);
> >
> > If the list is empty then "ret" can be unitialized. We test a different
> > list "dev->links.suppliers" to see if that's empty. I wrote a bunch of
> > code to make Smatch try to understand about empty lists, but I don't
> > think it works...
> >
> Yes, if list_empty, then the code can not touch ret. But ret is
> useless in this scene. Does it matter?
>
I'm not sure I understand what you're asking? Of course, it matters?
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH v3 00/12] macintosh: Resolve various PMU driver problems
From: Gabriel Paubert @ 2018-06-27 9:00 UTC (permalink / raw)
To: Michael Schmitz
Cc: Benjamin Herrenschmidt, Michael Ellerman, Finn Thain, geert,
linux-m68k, linuxppc-dev, linux-kernel
In-Reply-To: <5d4d7ca4-1d2f-268f-e5d2-eddb213e894d@gmail.com>
On Wed, Jun 27, 2018 at 05:39:15PM +1200, Michael Schmitz wrote:
> Ben,
>
> Am 27.06.2018 um 15:27 schrieb Benjamin Herrenschmidt:
> > On Wed, 2018-06-27 at 13:08 +1000, Michael Ellerman wrote:
> > > > I will rewrite patch 10/12 after Arnd's fixes and this series have all
> > > > made their way through both powerpc and m68k trees, and submit it
> > > > separately.
> > >
> > > drivers/macintosh is supposedly maintained by Ben, but I'm not sure this
> > > series is high on his todo list.
> >
> > We need at least to pull out a couple of powerbooks we have sitting in
> > drawers and try it out.
>
> No need to root around in drawers - I'm sitting in front of one (G3
> Titanium) writing this. Let me know if that would help (I've forgotten most
> of what I knew about powerpc kernels).
A very rare model, all G3 I've seen were plastic, all Titanium were G4 :-)
Cheers,
Gabriel
(still using my Pismo from time to time, but much less since
sleep was broken)
^ permalink raw reply
* Re: [PATCH v3 00/12] macintosh: Resolve various PMU driver problems
From: Michael Schmitz @ 2018-06-27 9:14 UTC (permalink / raw)
To: Gabriel Paubert
Cc: Benjamin Herrenschmidt, Michael Ellerman, Finn Thain, geert,
linux-m68k, linuxppc-dev, linux-kernel
In-Reply-To: <20180627090022.rij2owx5durbc4e6@lt-gp.iram.es>
Gabriel,
Am 27.06.2018 um 21:00 schrieb Gabriel Paubert:
> On Wed, Jun 27, 2018 at 05:39:15PM +1200, Michael Schmitz wrote:
>> Ben,
>>
>> Am 27.06.2018 um 15:27 schrieb Benjamin Herrenschmidt:
>>> On Wed, 2018-06-27 at 13:08 +1000, Michael Ellerman wrote:
>>>>> I will rewrite patch 10/12 after Arnd's fixes and this series have all
>>>>> made their way through both powerpc and m68k trees, and submit it
>>>>> separately.
>>>>
>>>> drivers/macintosh is supposedly maintained by Ben, but I'm not sure this
>>>> series is high on his todo list.
>>>
>>> We need at least to pull out a couple of powerbooks we have sitting in
>>> drawers and try it out.
>>
>> No need to root around in drawers - I'm sitting in front of one (G3
>> Titanium) writing this. Let me know if that would help (I've forgotten most
>> of what I knew about powerpc kernels).
>
> A very rare model, all G3 I've seen were plastic, all Titanium were G4 :-)
Right you are - the G3 was the earlier one I used (which was stolen from
my office). G4 it is, then.
Cheers,
Michael
>
> Cheers,
> Gabriel
> (still using my Pismo from time to time, but much less since
> sleep was broken)
>
^ permalink raw reply
* Re: [PATCH 1/3] [v2] powerpc: mac: fix rtc read/write functions
From: Arnd Bergmann @ 2018-06-27 10:36 UTC (permalink / raw)
To: Michael Ellerman
Cc: Paul Mackerras, Geert Uytterhoeven, Joshua Thompson,
Mathieu Malaterre, Benjamin Herrenschmidt, Greg Ungerer,
linux-m68k, linuxppc-dev, Linux Kernel Mailing List,
y2038 Mailman List, Meelis Roos, Andreas Schwab
In-Reply-To: <87y3f06e9a.fsf@concordia.ellerman.id.au>
On Wed, Jun 27, 2018 at 6:32 AM, Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> So I think I can take this patch in isolation via the powerpc tree as a
> fix for 4.18.
>
> I'll leave the other two alone.
>
Yes, that is what I had intended with this series but should have made
clearer. The two m68k patches are 4.19 material.
Arnd
^ permalink raw reply
* Re: [PATCH 1/3] [v2] powerpc: mac: fix rtc read/write functions
From: Michael Ellerman @ 2018-06-27 12:41 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Paul Mackerras, Geert Uytterhoeven, Joshua Thompson,
Mathieu Malaterre, Benjamin Herrenschmidt, Greg Ungerer,
linux-m68k, linuxppc-dev, Linux Kernel Mailing List,
y2038 Mailman List, Meelis Roos, Andreas Schwab
In-Reply-To: <CAK8P3a2HwOe2D4LXgFsfhFXpeUBpHZiB5PCk0nkAwqX3NKCmFA@mail.gmail.com>
Arnd Bergmann <arnd@arndb.de> writes:
> On Wed, Jun 27, 2018 at 6:32 AM, Michael Ellerman <mpe@ellerman.id.au> wrote:
>>
>> So I think I can take this patch in isolation via the powerpc tree as a
>> fix for 4.18.
>>
>> I'll leave the other two alone.
>
> Yes, that is what I had intended with this series but should have made
> clearer. The two m68k patches are 4.19 material.
OK thanks.
cheers
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox