03 Mar, 2020

6 commits

  • When doing a cold build, autoksyms.h starts empty, and is updated late
    in the build process to have visibility over the symbols used by in-tree
    drivers. But since the symbol whitelist is known upfront, it can be used
    to pre-populate autoksyms.h and maximize the amount of code that can be
    compiled to its final state in a single pass, hence reducing build time.

    Do this by using gen_autoksyms.sh to initialize autoksyms.h instead of
    creating an empty file.

    Acked-by: Nicolas Pitre
    Tested-by: Matthias Maennich
    Reviewed-by: Matthias Maennich
    Signed-off-by: Quentin Perret
    Signed-off-by: Masahiro Yamada

    Quentin Perret
     
  • In order to prepare the ground for a build-time optimization, split
    adjust_autoksyms.sh into two scripts: one that generates autoksyms.h
    based on all currently available information (whitelist, and .mod
    files), and the other to inspect the diff between two versions of
    autoksyms.h and trigger appropriate rebuilds.

    Acked-by: Nicolas Pitre
    Tested-by: Matthias Maennich
    Reviewed-by: Matthias Maennich
    Signed-off-by: Quentin Perret
    Signed-off-by: Masahiro Yamada

    Quentin Perret
     
  • CONFIG_TRIM_UNUSED_KSYMS currently removes all unused exported symbols
    from ksymtab. This works really well when using in-tree drivers, but
    cannot be used in its current form if some of them are out-of-tree.

    Indeed, even if the list of symbols required by out-of-tree drivers is
    known at compile time, the only solution today to guarantee these don't
    get trimmed is to set CONFIG_TRIM_UNUSED_KSYMS=n. This not only wastes
    space, but also makes it difficult to control the ABI usable by vendor
    modules in distribution kernels such as Android. Being able to control
    the kernel ABI surface is particularly useful to ship a unique Generic
    Kernel Image (GKI) for all vendors, which is a first step in the
    direction of getting all vendors to contribute their code upstream.

    As such, attempt to improve the situation by enabling users to specify a
    symbol 'whitelist' at compile time. Any symbol specified in this
    whitelist will be kept exported when CONFIG_TRIM_UNUSED_KSYMS is set,
    even if it has no in-tree user. The whitelist is defined as a simple
    text file, listing symbols, one per line.

    Acked-by: Jessica Yu
    Acked-by: Nicolas Pitre
    Tested-by: Matthias Maennich
    Reviewed-by: Matthias Maennich
    Signed-off-by: Quentin Perret
    Signed-off-by: Masahiro Yamada

    Quentin Perret
     
  • Most of the Kconfig commands (except defconfig and all*config) read
    the .config file as a base set of CONFIG options.

    When it does not exist, the files in DEFCONFIG_LIST are searched in
    this order and loaded if found.

    I do not see much sense in the last two lines in DEFCONFIG_LIST.

    [1] ARCH_DEFCONFIG

    The entry for DEFCONFIG_LIST is guarded by 'depends on !UML'. So, the
    ARCH_DEFCONFIG definition in arch/x86/um/Kconfig is meaningless.

    arch/{sh,sparc,x86}/Kconfig define ARCH_DEFCONFIG depending on 32 or
    64 bit variant symbols. This is a little bit strange; ARCH_DEFCONFIG
    should be a fixed string because the base config file is loaded before
    the symbol evaluation stage.

    Using KBUILD_DEFCONFIG makes more sense because it is fixed before
    Kconfig is invoked. Fortunately, arch/{sh,sparc,x86}/Makefile define it
    in the same way, and it works as expected. Hence, replace ARCH_DEFCONFIG
    with "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)".

    [2] arch/$(ARCH)/defconfig

    This file path is no longer valid. The defconfig files are always located
    in the arch configs/ directories.

    $ find arch -name defconfig | sort
    arch/alpha/configs/defconfig
    arch/arm64/configs/defconfig
    arch/csky/configs/defconfig
    arch/nds32/configs/defconfig
    arch/riscv/configs/defconfig
    arch/s390/configs/defconfig
    arch/unicore32/configs/defconfig

    The path arch/*/configs/defconfig is already covered by
    "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)". So, this file path is
    not necessary.

    I moved the default KBUILD_DEFCONFIG to the top Makefile. Otherwise,
    the 7 architectures listed above would end up with endless loop of
    syncconfig.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Added to kbuild documentation. Provides more official info on building
    kernels with Clang and LLVM than our wiki.

    Suggested-by: Kees Cook
    Reviewed-by: Kees Cook
    Reviewed-by: Nathan Chancellor
    Reviewed-by: Sedat Dilek
    Signed-off-by: Nick Desaulniers
    Signed-off-by: Masahiro Yamada

    Nick Desaulniers
     
  • obj-* needs a trailing slash for a directory, but subdir-* does not
    because it already implies a directory.

    Also, change subdir-y to subdir- to ensure this is effective only
    for cleaning targets.

    This makes the cleaning log consistent. (no trailing slash)

    Before:

    $ make clean
    CLEAN Documentation/devicetree/bindings/

    After:

    $ make clean
    CLEAN Documentation/devicetree/bindings

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

02 Mar, 2020

8 commits

  • If *q is '\0', the condition (isalnum(*q) || *q == '_') is false anyway.

    It is redundant to ensure non-zero *q.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • This is probably stale code. In old days (~ Linux 2.5.59), Kbuild made
    genksyms generate include/linux/modules/*.ver files.

    The currenct Kbuild does not generate *.ver files at all.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • This CONFIG option was added by commit 35bb5b1e0e84 ("Add option to
    enable -Wframe-larger-than= on gcc 4.4"). At that time, the cc-option
    check was needed.

    According to Documentation/process/changes.rst, the current minimal
    supported version of GCC is 4.6, so you can assume GCC supports it.
    Clang supports it as well.

    Remove the cc-option switch and redundant comments.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Nathan Chancellor
    Reviewed-by: Nick Desaulniers

    Masahiro Yamada
     
  • This reverts a very old commit, which dates back to the pre-git era:

    |commit 5d1cfb5b12f72145d30ba0f53c9f238144b122b8
    |Author: Kai Germaschewski
    |Date: Sat Jul 27 02:53:19 2002 -0500
    |
    | kbuild: Fix compiling/installing as different users
    |
    | "make bzImage && sudo make install" had the problem that during
    | the "sudo make install" the build system would notice that the information
    | in include/linux/compile.h is not accurate (it says "compiled by ",
    | but we are root), thus causing compile.h to be updated and leading to
    | some recompiles.
    |
    | We now only update "compile.h" if the current user is the owner of
    | include/linux/autoconf.h, i.e. the user who did the "make *config". So the
    | above sequence will correctly state "compiled by ".
    |
    |diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
    |index 6313db96172..cd956380978 100755
    |--- a/scripts/mkcompile_h
    |+++ b/scripts/mkcompile_h
    |@@ -3,6 +3,17 @@ ARCH=$2
    | SMP=$3
    | CC=$4
    |
    |+# If compile.h exists already and we don't own autoconf.h
    |+# (i.e. we're not the same user who did make *config), don't
    |+# modify compile.h
    |+# So "sudo make install" won't change the "compiled by "
    |+# do "compiled by root"
    |+
    |+if [ -r $TARGET -a ! -O ../include/linux/autoconf.h ]; then
    |+ echo ' (not modified)'
    |+ exit 0
    |+fi
    |+
    | if [ -r ../.version ]; then
    | VERSION=`cat ../.version`
    | else

    The 'make bzImage && sudo make install' problem no longer happens
    because commit 1648e4f80506 ("x86, kbuild: make "make install" not
    depend on vmlinux") fixed the root cause.

    Commit 19514fc665ff ("arm, kbuild: make "make install" not depend on
    vmlinux") fixed the similar issue on ARM, with detailed explanation.

    So, the rule is that the installation targets should never trigger
    the builds of any build artifact. By following it, this check is
    unneeded.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Linus Torvalds
     
  • Pull ext4 fixes from Ted Ts'o:
    "Two more bug fixes (including a regression) for 5.6"

    * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
    ext4: potential crash on allocation error in ext4_alloc_flex_bg_array()
    jbd2: fix data races at struct journal_head

    Linus Torvalds
     
  • Pull KVM fixes from Paolo Bonzini:
    "More bugfixes, including a few remaining "make W=1" issues such as too
    large frame sizes on some configurations.

    On the ARM side, the compiler was messing up shadow stacks between EL1
    and EL2 code, which is easily fixed with __always_inline"

    * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
    KVM: VMX: check descriptor table exits on instruction emulation
    kvm: x86: Limit the number of "kvm: disabled by bios" messages
    KVM: x86: avoid useless copy of cpufreq policy
    KVM: allow disabling -Werror
    KVM: x86: allow compiling as non-module with W=1
    KVM: Pre-allocate 1 cpumask variable per cpu for both pv tlb and pv ipis
    KVM: Introduce pv check helpers
    KVM: let declaration of kvm_get_running_vcpus match implementation
    KVM: SVM: allocate AVIC data structures based on kvm_amd module parameter
    arm64: Ask the compiler to __always_inline functions used by KVM at HYP
    KVM: arm64: Define our own swab32() to avoid a uapi static inline
    KVM: arm64: Ask the compiler to __always_inline functions used at HYP
    kvm: arm/arm64: Fold VHE entry/exit work into kvm_vcpu_run_vhe()
    KVM: arm/arm64: Fix up includes for trace.h

    Linus Torvalds
     
  • KVM emulates UMIP on hardware that doesn't support it by setting the
    'descriptor table exiting' VM-execution control and performing
    instruction emulation. When running nested, this emulation is broken as
    KVM refuses to emulate L2 instructions by default.

    Correct this regression by allowing the emulation of descriptor table
    instructions if L1 hasn't requested 'descriptor table exiting'.

    Fixes: 07721feee46b ("KVM: nVMX: Don't emulate instructions in guest mode")
    Reported-by: Jan Kiszka
    Cc: stable@vger.kernel.org
    Cc: Paolo Bonzini
    Cc: Jim Mattson
    Signed-off-by: Oliver Upton
    Signed-off-by: Paolo Bonzini

    Oliver Upton
     

01 Mar, 2020

4 commits

  • Pull i2c fixes from Wolfram Sang:
    "I2C has three driver bugfixes for you. We agreed on the Mac regression
    to go in via I2C"

    * 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
    macintosh: therm_windtunnel: fix regression when instantiating devices
    i2c: altera: Fix potential integer overflow
    i2c: jz4780: silence log flood on txabrt

    Linus Torvalds
     
  • If sbi->s_flex_groups_allocated is zero and the first allocation fails
    then this code will crash. The problem is that "i--" will set "i" to
    -1 but when we compare "i >= sbi->s_flex_groups_allocated" then the -1
    is type promoted to unsigned and becomes UINT_MAX. Since UINT_MAX
    is more than zero, the condition is true so we call kvfree(new_groups[-1]).
    The loop will carry on freeing invalid memory until it crashes.

    Fixes: 7c990728b99e ("ext4: fix potential race between s_flex_groups online resizing and access")
    Reviewed-by: Suraj Jitindar Singh
    Signed-off-by: Dan Carpenter
    Cc: stable@kernel.org
    Link: https://lore.kernel.org/r/20200228092142.7irbc44yaz3by7nb@kili.mountain
    Signed-off-by: Theodore Ts'o

    Dan Carpenter
     
  • Removing attach_adapter from this driver caused a regression for at
    least some machines. Those machines had the sensors described in their
    DT, too, so they didn't need manual creation of the sensor devices. The
    old code worked, though, because manual creation came first. Creation of
    DT devices then failed later and caused error logs, but the sensors
    worked nonetheless because of the manually created devices.

    When removing attach_adaper, manual creation now comes later and loses
    the race. The sensor devices were already registered via DT, yet with
    another binding, so the driver could not be bound to it.

    This fix refactors the code to remove the race and only manually creates
    devices if there are no DT nodes present. Also, the DT binding is updated
    to match both, the DT and manually created devices. Because we don't
    know which device creation will be used at runtime, the code to start
    the kthread is moved to do_probe() which will be called by both methods.

    Fixes: 3e7bed52719d ("macintosh: therm_windtunnel: drop using attach_adapter")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=201723
    Reported-by: Erhard Furtner
    Tested-by: Erhard Furtner
    Acked-by: Michael Ellerman (powerpc)
    Signed-off-by: Wolfram Sang
    Cc: stable@kernel.org # v4.19+

    Wolfram Sang
     
  • journal_head::b_transaction and journal_head::b_next_transaction could
    be accessed concurrently as noticed by KCSAN,

    LTP: starting fsync04
    /dev/zero: Can't open blockdev
    EXT4-fs (loop0): mounting ext3 file system using the ext4 subsystem
    EXT4-fs (loop0): mounted filesystem with ordered data mode. Opts: (null)
    ==================================================================
    BUG: KCSAN: data-race in __jbd2_journal_refile_buffer [jbd2] / jbd2_write_access_granted [jbd2]

    write to 0xffff99f9b1bd0e30 of 8 bytes by task 25721 on cpu 70:
    __jbd2_journal_refile_buffer+0xdd/0x210 [jbd2]
    __jbd2_journal_refile_buffer at fs/jbd2/transaction.c:2569
    jbd2_journal_commit_transaction+0x2d15/0x3f20 [jbd2]
    (inlined by) jbd2_journal_commit_transaction at fs/jbd2/commit.c:1034
    kjournald2+0x13b/0x450 [jbd2]
    kthread+0x1cd/0x1f0
    ret_from_fork+0x27/0x50

    read to 0xffff99f9b1bd0e30 of 8 bytes by task 25724 on cpu 68:
    jbd2_write_access_granted+0x1b2/0x250 [jbd2]
    jbd2_write_access_granted at fs/jbd2/transaction.c:1155
    jbd2_journal_get_write_access+0x2c/0x60 [jbd2]
    __ext4_journal_get_write_access+0x50/0x90 [ext4]
    ext4_mb_mark_diskspace_used+0x158/0x620 [ext4]
    ext4_mb_new_blocks+0x54f/0xca0 [ext4]
    ext4_ind_map_blocks+0xc79/0x1b40 [ext4]
    ext4_map_blocks+0x3b4/0x950 [ext4]
    _ext4_get_block+0xfc/0x270 [ext4]
    ext4_get_block+0x3b/0x50 [ext4]
    __block_write_begin_int+0x22e/0xae0
    __block_write_begin+0x39/0x50
    ext4_write_begin+0x388/0xb50 [ext4]
    generic_perform_write+0x15d/0x290
    ext4_buffered_write_iter+0x11f/0x210 [ext4]
    ext4_file_write_iter+0xce/0x9e0 [ext4]
    new_sync_write+0x29c/0x3b0
    __vfs_write+0x92/0xa0
    vfs_write+0x103/0x260
    ksys_write+0x9d/0x130
    __x64_sys_write+0x4c/0x60
    do_syscall_64+0x91/0xb05
    entry_SYSCALL_64_after_hwframe+0x49/0xbe

    5 locks held by fsync04/25724:
    #0: ffff99f9911093f8 (sb_writers#13){.+.+}, at: vfs_write+0x21c/0x260
    #1: ffff99f9db4c0348 (&sb->s_type->i_mutex_key#15){+.+.}, at: ext4_buffered_write_iter+0x65/0x210 [ext4]
    #2: ffff99f5e7dfcf58 (jbd2_handle){++++}, at: start_this_handle+0x1c1/0x9d0 [jbd2]
    #3: ffff99f9db4c0168 (&ei->i_data_sem){++++}, at: ext4_map_blocks+0x176/0x950 [ext4]
    #4: ffffffff99086b40 (rcu_read_lock){....}, at: jbd2_write_access_granted+0x4e/0x250 [jbd2]
    irq event stamp: 1407125
    hardirqs last enabled at (1407125): [] __find_get_block+0x107/0x790
    hardirqs last disabled at (1407124): [] __find_get_block+0x49/0x790
    softirqs last enabled at (1405528): [] __do_softirq+0x34c/0x57c
    softirqs last disabled at (1405521): [] irq_exit+0xa2/0xc0

    Reported by Kernel Concurrency Sanitizer on:
    CPU: 68 PID: 25724 Comm: fsync04 Tainted: G L 5.6.0-rc2-next-20200221+ #7
    Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40 07/10/2019

    The plain reads are outside of jh->b_state_lock critical section which result
    in data races. Fix them by adding pairs of READ|WRITE_ONCE().

    Reviewed-by: Jan Kara
    Signed-off-by: Qian Cai
    Link: https://lore.kernel.org/r/20200222043111.2227-1-cai@lca.pw
    Signed-off-by: Theodore Ts'o

    Qian Cai
     

29 Feb, 2020

8 commits

  • Pull SCSI fixes from James Bottomley:
    "Four small fixes.

    Three are in drivers for fairly obvious bugs. The fourth is a set of
    regressions introduced by the compat_ioctl changes because some of the
    compat updates wrongly replaced .ioctl instead of .compat_ioctl"

    * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    scsi: compat_ioctl: cdrom: Replace .ioctl with .compat_ioctl in four appropriate places
    scsi: zfcp: fix wrong data and display format of SFP+ temperature
    scsi: sd_sbc: Fix sd_zbc_report_zones()
    scsi: libfc: free response frame from GPN_ID

    Linus Torvalds
     
  • Pull PCI fixes from Bjorn Helgaas:

    - Fix build issue on 32-bit ARM with old compilers (Marek Szyprowski)

    - Update MAINTAINERS for recent Cadence driver file move (Lukas
    Bulwahn)

    * tag 'pci-v5.6-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
    MAINTAINERS: Correct Cadence PCI driver path
    PCI: brcmstb: Fix build on 32bit ARM platforms with older compilers

    Linus Torvalds
     
  • Pull block fixes from Jens Axboe:

    - Passthrough insertion fix (Ming)

    - Kill off some unused arguments (John)

    - blktrace RCU fix (Jan)

    - Dead fields removal for null_blk (Dongli)

    - NVMe polled IO fix (Bijan)

    * tag 'block-5.6-2020-02-28' of git://git.kernel.dk/linux-block:
    nvme-pci: Hold cq_poll_lock while completing CQEs
    blk-mq: Remove some unused function arguments
    null_blk: remove unused fields in 'nullb_cmd'
    blktrace: Protect q->blk_trace with RCU
    blk-mq: insert passthrough request into hctx->dispatch directly

    Linus Torvalds
     
  • Pull io_uring fixes from Jens Axboe:

    - Fix for a race with IOPOLL used with SQPOLL (Xiaoguang)

    - Only show ->fdinfo if procfs is enabled (Tobias)

    - Fix for a chain with multiple personalities in the SQEs

    - Fix for a missing free of personality idr on exit

    - Removal of the spin-for-work optimization

    - Fix for next work lookup on request completion

    - Fix for non-vec read/write result progation in case of links

    - Fix for a fileset references on switch

    - Fix for a recvmsg/sendmsg 32-bit compatability mode

    * tag 'io_uring-5.6-2020-02-28' of git://git.kernel.dk/linux-block:
    io_uring: fix 32-bit compatability with sendmsg/recvmsg
    io_uring: define and set show_fdinfo only if procfs is enabled
    io_uring: drop file set ref put/get on switch
    io_uring: import_single_range() returns 0/-ERROR
    io_uring: pick up link work on submit reference drop
    io-wq: ensure work->task_pid is cleared on init
    io-wq: remove spin-for-work optimization
    io_uring: fix poll_list race for SETUP_IOPOLL|SETUP_SQPOLL
    io_uring: fix personality idr leak
    io_uring: handle multiple personalities in link chains

    Linus Torvalds
     
  • Pull NVMe fix from Keith.

    * 'nvme-5.6-rc4' of git://git.infradead.org/nvme:
    nvme-pci: Hold cq_poll_lock while completing CQEs

    Jens Axboe
     
  • Pull ACPI fixes from Rafael Wysocki:
    "Fix a couple of configuration issues in the ACPI watchdog (WDAT)
    driver (Mika Westerberg) and make it possible to disable that driver
    at boot time in case it still does not work as expected (Jean
    Delvare)"

    * tag 'acpi-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    ACPI: watchdog: Set default timeout in probe
    ACPI: watchdog: Fix gas->access_width usage
    ACPICA: Introduce ACPI_ACCESS_BYTE_WIDTH() macro
    ACPI: watchdog: Allow disabling WDAT at boot

    Linus Torvalds
     
  • Pull power management fixes from Rafael Wysocki:
    "Fix a recent cpufreq initialization regression (Rafael Wysocki),
    revert a devfreq commit that made incompatible changes and broke user
    land on some systems (Orson Zhai), drop a stale reference to a
    document that has gone away recently (Jonathan Neuschäfer), and fix a
    typo in a hibernation code comment (Alexandre Belloni)"

    * tag 'pm-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    cpufreq: Fix policy initialization for internal governor drivers
    Revert "PM / devfreq: Modify the device name as devfreq(X) for sysfs"
    PM / hibernate: fix typo "reserverd_size" -> "reserved_size"
    Documentation: power: Drop reference to interface.rst

    Linus Torvalds
     
  • Pull zonefs fixes from Damien Le Moal:
    "Two fixes in here:

    - Revert the initial decision to silently ignore IOCB_NOWAIT for
    asynchronous direct IOs to sequential zone files. Instead, return
    an error to the user to signal that the feature is not supported
    (from Christoph)

    - A fix to zonefs Kconfig to select FS_IOMAP to avoid build failures
    if no other file system already selected this option (from
    Johannes)"

    * tag 'zonefs-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs:
    zonefs: select FS_IOMAP
    zonefs: fix IOCB_NOWAIT handling

    Linus Torvalds
     

28 Feb, 2020

14 commits

  • …kvmarm/kvmarm into HEAD

    KVM/arm fixes for 5.6, take #1

    - Fix compilation on 32bit
    - Move VHE guest entry/exit into the VHE-specific entry code
    - Make sure all functions called by the non-VHE HYP code is tagged as __always_inline

    Paolo Bonzini
     
  • In older version of systemd(219), at boot time, udevadm is called with :
    /usr/bin/udevadm trigger --type=devices --action=add"

    This program generates an echo "add" in /sys/devices/system/cpu/cpu/uevent,
    leading to the "kvm: disabled by bios" message in case of your Bios disabled
    the virtualization extensions.

    On a modern system running up to 256 CPU threads, this pollutes the Kernel logs.

    This patch offers to ratelimit this message to avoid any userspace program triggering
    this uevent printing this message too often.

    This patch is only a workaround but greatly reduce the pollution without
    breaking the current behavior of printing a message if some try to instantiate
    KVM on a system that doesn't support it.

    Note that recent versions of systemd (>239) do not have trigger this behavior.

    This patch will be useful at least for some using older systemd with recent Kernels.

    Signed-off-by: Erwan Velu
    Signed-off-by: Paolo Bonzini

    Erwan Velu
     
  • * pm-sleep:
    PM / hibernate: fix typo "reserverd_size" -> "reserved_size"
    Documentation: power: Drop reference to interface.rst

    * pm-devfreq:
    Revert "PM / devfreq: Modify the device name as devfreq(X) for sysfs"

    Rafael J. Wysocki
     
  • struct cpufreq_policy is quite big and it is not a good idea
    to allocate one on the stack. Just use cpufreq_cpu_get and
    cpufreq_cpu_put which is even simpler.

    Reported-by: Christoph Hellwig
    Signed-off-by: Paolo Bonzini

    Paolo Bonzini
     
  • Restrict -Werror to well-tested configurations and allow disabling it
    via Kconfig.

    Reported-by: Christoph Hellwig
    Signed-off-by: Paolo Bonzini

    Paolo Bonzini
     
  • Compile error with CONFIG_KVM_INTEL=y and W=1:

    CC arch/x86/kvm/vmx/vmx.o
    arch/x86/kvm/vmx/vmx.c:68:32: error: 'vmx_cpu_id' defined but not used [-Werror=unused-const-variable=]
    68 | static const struct x86_cpu_id vmx_cpu_id[] = {
    | ^~~~~~~~~~
    cc1: all warnings being treated as errors

    When building with =y, the MODULE_DEVICE_TABLE macro doesn't generate a
    reference to the structure (or any code at all). This makes W=1 compiles
    unhappy.

    Wrap both in a #ifdef to avoid the issue.

    Signed-off-by: Valdis Kletnieks
    [Do the same for CONFIG_KVM_AMD. - Paolo]
    Signed-off-by: Paolo Bonzini

    Valdis Klētnieks
     
  • Nick Desaulniers Reported:

    When building with:
    $ make CC=clang arch/x86/ CFLAGS=-Wframe-larger-than=1000
    The following warning is observed:
    arch/x86/kernel/kvm.c:494:13: warning: stack frame size of 1064 bytes in
    function 'kvm_send_ipi_mask_allbutself' [-Wframe-larger-than=]
    static void kvm_send_ipi_mask_allbutself(const struct cpumask *mask, int
    vector)
    ^
    Debugging with:
    https://github.com/ClangBuiltLinux/frame-larger-than
    via:
    $ python3 frame_larger_than.py arch/x86/kernel/kvm.o \
    kvm_send_ipi_mask_allbutself
    points to the stack allocated `struct cpumask newmask` in
    `kvm_send_ipi_mask_allbutself`. The size of a `struct cpumask` is
    potentially large, as it's CONFIG_NR_CPUS divided by BITS_PER_LONG for
    the target architecture. CONFIG_NR_CPUS for X86_64 can be as high as
    8192, making a single instance of a `struct cpumask` 1024 B.

    This patch fixes it by pre-allocate 1 cpumask variable per cpu and use it for
    both pv tlb and pv ipis..

    Reported-by: Nick Desaulniers
    Acked-by: Nick Desaulniers
    Reviewed-by: Vitaly Kuznetsov
    Cc: Peter Zijlstra
    Cc: Nick Desaulniers
    Signed-off-by: Wanpeng Li
    Signed-off-by: Paolo Bonzini

    Wanpeng Li
     
  • Introduce some pv check helpers for consistency.

    Suggested-by: Vitaly Kuznetsov
    Reviewed-by: Konrad Rzeszutek Wilk
    Signed-off-by: Wanpeng Li
    Signed-off-by: Paolo Bonzini

    Wanpeng Li
     
  • Sparse notices that declaration and implementation do not match:
    arch/s390/kvm/../../../virt/kvm/kvm_main.c:4435:17: warning: incorrect type in return expression (different address spaces)
    arch/s390/kvm/../../../virt/kvm/kvm_main.c:4435:17: expected struct kvm_vcpu [noderef] **
    arch/s390/kvm/../../../virt/kvm/kvm_main.c:4435:17: got struct kvm_vcpu *[noderef] *

    Signed-off-by: Christian Borntraeger
    Signed-off-by: Paolo Bonzini

    Christian Borntraeger
     
  • Even if APICv is disabled at startup, the backing page and ir_list need
    to be initialized in case they are needed later. The only case in
    which this can be skipped is for userspace irqchip, and that must be
    done because avic_init_backing_page dereferences vcpu->arch.apic
    (which is NULL for userspace irqchip).

    Tested-by: rmuncrief@humanavance.com
    Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=206579
    Reviewed-by: Miaohe Lin
    Signed-off-by: Paolo Bonzini

    Paolo Bonzini
     
  • Pull drm fixes from Dave Airlie:
    "Just some fixes for this week: amdgpu, radeon and i915.

    The main i915 one is a regression Gen7 (Ivybridge/Haswell), this moves
    them back from trying to use the full-ppgtt support to the aliasing
    version it used to use due to gpu hangs. Otherwise it's pretty quiet.

    amdgpu:
    - Drop DRIVER_USE_AGP
    - Fix memory leak in GPU reset
    - Resume fix for raven

    radeon:
    - Drop DRIVER_USE_AGP

    i915:
    - downgrade gen7 back to aliasing-ppgtt to avoid GPU hangs
    - shrinker fix
    - pmu leak and double free fixes
    - gvt user after free and virtual display reset fixes
    - randconfig build fix"

    * tag 'drm-fixes-2020-02-28' of git://anongit.freedesktop.org/drm/drm:
    drm/radeon: Inline drm_get_pci_dev
    drm/amdgpu: Drop DRIVER_USE_AGP
    drm/i915: Avoid recursing onto active vma from the shrinker
    drm/i915/pmu: Avoid using globals for PMU events
    drm/i915/pmu: Avoid using globals for CPU hotplug state
    drm/i915/gtt: Downgrade gen7 (ivb, byt, hsw) back to aliasing-ppgtt
    drm/i915: fix header test with GCOV
    amdgpu/gmc_v9: save/restore sdpif regs during S3
    drm/amdgpu: fix memory leak during TDR test(v2)
    drm/i915/gvt: Fix orphan vgpu dmabuf_objs' lifetime
    drm/i915/gvt: Separate display reset from ALL_ENGINES reset

    Linus Torvalds
     
  • drm/i915 fixes for v5.6-rc4:
    - downgrade gen7 back to aliasing-ppgtt to avoid GPU hangs
    - shrinker fix
    - pmu leak and double free fixes
    - gvt user after free and virtual display reset fixes
    - randconfig build fix

    Signed-off-by: Dave Airlie

    From: Jani Nikula
    Link: https://patchwork.freedesktop.org/patch/msgid/874kvcsh00.fsf@intel.com

    Dave Airlie
     
  • amd-drm-fixes-5.6-2020-02-26:

    amdgpu:
    - Drop DRIVER_USE_AGP
    - Fix memory leak in GPU reset
    - Resume fix for raven

    radeon:
    - Drop DRIVER_USE_AGP

    Signed-off-by: Dave Airlie
    From: Alex Deucher
    Link: https://patchwork.freedesktop.org/patch/msgid/20200227034106.3912-1-alexander.deucher@amd.com

    Dave Airlie
     
  • Pull networking fixes from David Miller:

    1) Fix leak in nl80211 AP start where we leak the ACL memory, from
    Johannes Berg.

    2) Fix double mutex unlock in mac80211, from Andrei Otcheretianski.

    3) Fix RCU stall in ipset, from Jozsef Kadlecsik.

    4) Fix devlink locking in devlink_dpipe_table_register, from Madhuparna
    Bhowmik.

    5) Fix race causing TX hang in ll_temac, from Esben Haabendal.

    6) Stale eth hdr pointer in br_dev_xmit(), from Nikolay Aleksandrov.

    7) Fix TX hash calculation bounds checking wrt. tc rules, from Amritha
    Nambiar.

    8) Size netlink responses properly in schedule action code to take into
    consideration TCA_ACT_FLAGS. From Jiri Pirko.

    9) Fix firmware paths for mscc PHY driver, from Antoine Tenart.

    10) Don't register stmmac notifier multiple times, from Aaro Koskinen.

    11) Various rmnet bug fixes, from Taehee Yoo.

    12) Fix vsock deadlock in vsock transport release, from Stefano
    Garzarella.

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (61 commits)
    net: dsa: mv88e6xxx: Fix masking of egress port
    mlxsw: pci: Wait longer before accessing the device after reset
    sfc: fix timestamp reconstruction at 16-bit rollover points
    vsock: fix potential deadlock in transport->release()
    unix: It's CONFIG_PROC_FS not CONFIG_PROCFS
    net: rmnet: fix packet forwarding in rmnet bridge mode
    net: rmnet: fix bridge mode bugs
    net: rmnet: use upper/lower device infrastructure
    net: rmnet: do not allow to change mux id if mux id is duplicated
    net: rmnet: remove rcu_read_lock in rmnet_force_unassociate_device()
    net: rmnet: fix suspicious RCU usage
    net: rmnet: fix NULL pointer dereference in rmnet_changelink()
    net: rmnet: fix NULL pointer dereference in rmnet_newlink()
    net: phy: marvell: don't interpret PHY status unless resolved
    mlx5: register lag notifier for init network namespace only
    unix: define and set show_fdinfo only if procfs is enabled
    hinic: fix a bug of rss configuration
    hinic: fix a bug of setting hw_ioctxt
    hinic: fix a irq affinity bug
    net/smc: check for valid ib_client_data
    ...

    Linus Torvalds