sfrench/cifs-2.6.git
7 months agoMerge tag 'vfs-6.7.super' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs
Linus Torvalds [Mon, 30 Oct 2023 18:59:05 +0000 (08:59 -1000)]
Merge tag 'vfs-6.7.super' of gitolite.pub/scm/linux/kernel/git/vfs/vfs

Pull vfs superblock updates from Christian Brauner:
 "This contains the work to make block device opening functions return a
  struct bdev_handle instead of just a struct block_device. The same
  struct bdev_handle is then also passed to block device closing
  functions.

  This allows us to propagate context from opening to closing a block
  device without having to modify all users everytime.

  Sidenote, in the future we might even want to try and have block
  device opening functions return a struct file directly but that's a
  series on top of this.

  These are further preparatory changes to be able to count writable
  opens and blocking writes to mounted block devices. That's a separate
  piece of work for next cycle and for that we absolutely need the
  changes to btrfs that have been quietly dropped somehow.

  Originally the series contained a patch that removed the old
  blkdev_*() helpers. But since this would've caused needles churn in
  -next for bcachefs we ended up delaying it.

  The second piece of work addresses one of the major annoyances about
  the work last cycle, namely that we required dropping s_umount
  whenever we used the superblock and fs_holder_ops for a block device.

  The reason for that requirement had been that in some codepaths
  s_umount could've been taken under disk->open_mutex (that's always
  been the case, at least theoretically). For example, on surprise block
  device removal or media change. And opening and closing block devices
  required grabbing disk->open_mutex as well.

  So we did the work and went through the block layer and fixed all
  those places so that s_umount is never taken under disk->open_mutex.
  This means no more brittle games where we yield and reacquire s_umount
  during block device opening and closing and no more requirements where
  block devices need to be closed. Filesystems don't need to care about
  this.

  There's a bunch of other follow-up work such as moving block device
  freezing and thawing to holder operations which makes it work for all
  block devices and not just the main block device just as we did for
  surprise removal. But that is for next cycle.

  Tested with fstests for all major fses, blktests, LTP"

* tag 'vfs-6.7.super' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs: (37 commits)
  porting: update locking requirements
  fs: assert that open_mutex isn't held over holder ops
  block: assert that we're not holding open_mutex over blk_report_disk_dead
  block: move bdev_mark_dead out of disk_check_media_change
  block: WARN_ON_ONCE() when we remove active partitions
  block: simplify bdev_del_partition()
  fs: Avoid grabbing sb->s_umount under bdev->bd_holder_lock
  jfs: fix log->bdev_handle null ptr deref in lbmStartIO
  bcache: Fixup error handling in register_cache()
  xfs: Convert to bdev_open_by_path()
  reiserfs: Convert to bdev_open_by_dev/path()
  ocfs2: Convert to use bdev_open_by_dev()
  nfs/blocklayout: Convert to use bdev_open_by_dev/path()
  jfs: Convert to bdev_open_by_dev()
  f2fs: Convert to bdev_open_by_dev/path()
  ext4: Convert to bdev_open_by_dev()
  erofs: Convert to use bdev_open_by_path()
  btrfs: Convert to bdev_open_by_path()
  fs: Convert to bdev_open_by_dev()
  mm/swap: Convert to use bdev_open_by_dev()
  ...

7 months agofbdev: stifb: Make the STI next font pointer a 32-bit signed offset
Helge Deller [Fri, 27 Oct 2023 11:36:48 +0000 (13:36 +0200)]
fbdev: stifb: Make the STI next font pointer a 32-bit signed offset

The pointer to the next STI font is actually a signed 32-bit
offset. With this change the 64-bit kernel will correctly subract
the (signed 32-bit) offset instead of adding a (unsigned 32-bit)
offset. It has no effect on 32-bit kernels.

This fixes the stifb driver with a 64-bit kernel on qemu.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org
7 months agoparisc: Show default CPU PSW.W setting as reported by PDC
Helge Deller [Mon, 23 Oct 2023 18:38:08 +0000 (20:38 +0200)]
parisc: Show default CPU PSW.W setting as reported by PDC

The last word shows the default PSW.W setting.

Signed-off-by: Helge Deller <deller@gmx.de>
7 months agoparisc/pdc: Add width field to struct pdc_model
Helge Deller [Sun, 22 Oct 2023 09:48:11 +0000 (11:48 +0200)]
parisc/pdc: Add width field to struct pdc_model

PDC2.0 specifies the additional PSW-bit field.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org
7 months agoparisc: Add nop instructions after TLB inserts
John David Anglin [Fri, 20 Oct 2023 20:49:07 +0000 (20:49 +0000)]
parisc: Add nop instructions after TLB inserts

An excerpt from the PA8800 ERS states:

* The PA8800 violates the seven instruction pipeline rule when performing
  TLB inserts or PxTLBE instructions with the PSW C bit on. The instruction
  will take effect by the 12th instruction after the insert or purge.

I believe we have a problem with handling TLB misses. We don't fill
the pipeline following TLB inserts. As a result, we likely fault again
after returning from the interruption.

The above statement indicates that we need at least seven instructions
after the insert on pre PA8800 processors and we need 12 instructions
on PA8800/PA8900 processors.

Here we add macros and code to provide the required number instructions
after a TLB insert.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Suggested-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
7 months agoparisc: simplify smp_prepare_boot_cpu()
Russell King (Oracle) [Fri, 20 Oct 2023 14:45:30 +0000 (15:45 +0100)]
parisc: simplify smp_prepare_boot_cpu()

smp_prepare_boot_cpu() reads the cpuid of the first CPU, printing a
message to state which processor booted, and setting it online and
present.

This cpuid is retrieved from per_cpu(cpu_data, 0).cpuid, which is
initialised in arch/parisc/kernel/processor.c:processor_probe() thusly:

p = &per_cpu(cpu_data, cpuid);
...
p->cpuid = cpuid; /* save CPU id */

Consequently, the cpuid retrieved seems to be guaranteed to also be
zero, meaning that the message printed in this boils down to:

pr_info("SMP: bootstrap CPU ID is 0\n");

Moreover, since kernel/cpu.c::boot_cpu_init() already sets CPU 0 to
be present and online, there is no need to do this again in
smp_prepare_boot_cpu().

Remove this code, and simplify the printk().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Helge Deller <deller@gmx.de>
7 months agoparisc/agp: Use 64-bit LE values in SBA IOMMU PDIR table
Helge Deller [Wed, 18 Oct 2023 17:24:14 +0000 (19:24 +0200)]
parisc/agp: Use 64-bit LE values in SBA IOMMU PDIR table

The PDIR table of the System Bus Adapter (SBA) I/O MMU uses 64-bit
little-endian pointers.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org # v6.4+
7 months agoparisc/firmware: Use PDC constants for narrow/wide firmware
Helge Deller [Wed, 18 Oct 2023 17:52:39 +0000 (19:52 +0200)]
parisc/firmware: Use PDC constants for narrow/wide firmware

PDC uses the PDC_MODEL_OS64 and PDC_MODEL_OS32 constants, so use
those constants for the internal WIDE_FIRMWARE/NARROW_FIRMWARE too.

Signed-off-by: Helge Deller <deller@gmx.de>
7 months agoparisc: Move parisc_narrow_firmware variable to header file
Helge Deller [Wed, 18 Oct 2023 17:47:29 +0000 (19:47 +0200)]
parisc: Move parisc_narrow_firmware variable to header file

Signed-off-by: Helge Deller <deller@gmx.de>
7 months agoparisc/power: Trivial whitespace cleanups and license update
Helge Deller [Tue, 17 Oct 2023 20:33:30 +0000 (22:33 +0200)]
parisc/power: Trivial whitespace cleanups and license update

Signed-off-by: Helge Deller <deller@gmx.de>
7 months agoparisc/power: Add power soft-off when running on qemu
Helge Deller [Tue, 17 Oct 2023 20:19:53 +0000 (22:19 +0200)]
parisc/power: Add power soft-off when running on qemu

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org # v6.0+
7 months agoparisc: Allow building uncompressed Linux kernel
Helge Deller [Tue, 17 Oct 2023 19:00:11 +0000 (21:00 +0200)]
parisc: Allow building uncompressed Linux kernel

Add HAVE_KERNEL_UNCOMPRESSED flag and fix build in boot
directory.

Signed-off-by: Helge Deller <deller@gmx.de>
7 months agoparisc: Add some missing PDC functions and constants
Helge Deller [Tue, 17 Oct 2023 18:45:58 +0000 (20:45 +0200)]
parisc: Add some missing PDC functions and constants

Signed-off-by: Helge Deller <deller@gmx.de>
7 months agoparisc: sba-iommu: Fix comment when calculating IOC number
Helge Deller [Tue, 17 Oct 2023 18:40:45 +0000 (20:40 +0200)]
parisc: sba-iommu: Fix comment when calculating IOC number

Signed-off-by: Helge Deller <deller@gmx.de>
7 months agospi: Merge up fix
Mark Brown [Mon, 30 Oct 2023 13:20:58 +0000 (13:20 +0000)]
spi: Merge up fix

One small fix that didn't seem worth sending before the merge window.

7 months agoregulator: Merge up pending fix
Mark Brown [Mon, 30 Oct 2023 13:14:27 +0000 (13:14 +0000)]
regulator: Merge up pending fix

One small fix didn't get sent before the merge window.

7 months agoregmap: Merge up fix for window/paging issue
Mark Brown [Mon, 30 Oct 2023 13:05:15 +0000 (13:05 +0000)]
regmap: Merge up fix for window/paging issue

This was too late and could potentially impact too many drivers for me
to be comfortable sending it before the merge window.

7 months agohwmon: (aquacomputer_d5next) Check if temp sensors of legacy devices are connected
Aleksa Savic [Mon, 16 Oct 2023 08:35:57 +0000 (10:35 +0200)]
hwmon: (aquacomputer_d5next) Check if temp sensors of legacy devices are connected

Return -ENODATA if a temp sensor of a legacy device
does not contain a reading.

Originally-from: Leonard Anderweit <leonard.anderweit@gmail.com>
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Link: https://lore.kernel.org/r/20231016083559.139341-2-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow USB and MPS Flow
Aleksa Savic [Mon, 16 Oct 2023 08:35:58 +0000 (10:35 +0200)]
hwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow USB and MPS Flow

Extend aquacomputer_d5next driver to expose various hardware sensors of the
Aquacomputer High Flow USB flow sensor, which communicates through a
proprietary USB HID protocol. This commit also adds support for the sensors
of the MPS Flow devices, as they have the same USB product ID and sensor
layouts. Implemented by Leonard Anderweit [1].

Internal and external temp sensor readings are available, along with
the flow sensor.

Additionally, serial number and firmware version are exposed through
debugfs.

[1] https://github.com/aleksamagicka/aquacomputer_d5next-hwmon/pull/90

Originally-from: Leonard Anderweit <leonard.anderweit@gmail.com>
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Link: https://lore.kernel.org/r/20231016083559.139341-3-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agodt-bindings: hwmon: npcm: Add npcm845 compatible string
Tomer Maimon [Wed, 18 Oct 2023 18:19:24 +0000 (21:19 +0300)]
dt-bindings: hwmon: npcm: Add npcm845 compatible string

Add a compatible string for Nuvoton BMC NPCM845 Pulse Width Modulation
(PWM) and Fan tach controller.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231018181925.1826042-2-tmaimon77@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: Add driver for ltc2991
Antoniu Miclaus [Thu, 26 Oct 2023 10:33:13 +0000 (13:33 +0300)]
hwmon: Add driver for ltc2991

Add support for LTC2991 Octal I2C Voltage, Current, and Temperature
Monitor.

The LTC2991 is used to monitor system temperatures, voltages and
currents. Through the I2C serial interface, the eight monitors can
individually measure supply voltages and can be paired for
differential measurements of current sense resistors or temperature
sensing transistors. Additional measurements include internal
temperature and internal VCC.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20231026103413.27800-2-antoniu.miclaus@analog.com
[groeck: Fixed up documentation warning]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agoLinux 6.6 v6.6
Linus Torvalds [Mon, 30 Oct 2023 02:31:08 +0000 (16:31 -1000)]
Linux 6.6

7 months agoMerge tag 'x86-urgent-2023-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 28 Oct 2023 18:15:07 +0000 (08:15 -1000)]
Merge tag 'x86-urgent-2023-10-28' of git://git./linux/kernel/git/tip/tip

Pull misc x86 fixes from Ingo Molnar:

 - Fix a possible CPU hotplug deadlock bug caused by the new TSC
   synchronization code

 - Fix a legacy PIC discovery bug that results in device troubles on
   affected systems, such as non-working keybards, etc

 - Add a new Intel CPU model number to <asm/intel-family.h>

* tag 'x86-urgent-2023-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/tsc: Defer marking TSC unstable to a worker
  x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility
  x86/cpu: Add model number for Intel Arrow Lake mobile processor

7 months agoMerge tag 'irq-urgent-2023-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 28 Oct 2023 18:12:34 +0000 (08:12 -1000)]
Merge tag 'irq-urgent-2023-10-28' of git://git./linux/kernel/git/tip/tip

Pull irq fix from Ingo Molnar:
 "Restore unintentionally lost quirk settings in the GIC irqchip driver,
  which broke certain devices"

* tag 'irq-urgent-2023-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip/gic-v3-its: Don't override quirk settings with default values

7 months agoMerge tag 'perf-urgent-2023-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 28 Oct 2023 18:10:47 +0000 (08:10 -1000)]
Merge tag 'perf-urgent-2023-10-28' of git://git./linux/kernel/git/tip/tip

Pull perf event fix from Ingo Molnar:
 "Fix a potential NULL dereference bug"

* tag 'perf-urgent-2023-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/core: Fix potential NULL deref

7 months agoMerge tag 'probes-fixes-v6.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 28 Oct 2023 18:04:56 +0000 (08:04 -1000)]
Merge tag 'probes-fixes-v6.6-rc7' of git://git./linux/kernel/git/trace/linux-trace

Pull probes fixes from Masami Hiramatsu:

 - tracing/kprobes: Fix kernel-doc warnings for the variable length
   arguments

 - tracing/kprobes: Fix to count the symbols in modules even if the
   module name is not specified so that user can probe the symbols in
   the modules without module name

* tag 'probes-fixes-v6.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  tracing/kprobes: Fix symbol counting logic by looking at modules as well
  tracing/kprobes: Fix the description of variable length arguments

7 months agoMerge tag 'dma-mapping-6.6-2023-10-28' of git://git.infradead.org/users/hch/dma-mapping
Linus Torvalds [Sat, 28 Oct 2023 18:01:31 +0000 (08:01 -1000)]
Merge tag 'dma-mapping-6.6-2023-10-28' of git://git.infradead.org/users/hch/dma-mapping

Pull dma-mapping fix from Christoph Hellwig:

 - reduce the initialy dynamic swiotlb size to remove an annoying but
   harmless warning from the page allocator (Petr Tesarik)

* tag 'dma-mapping-6.6-2023-10-28' of git://git.infradead.org/users/hch/dma-mapping:
  swiotlb: do not try to allocate a TLB bigger than MAX_ORDER pages

7 months agoMerge tag 'char-misc-6.6-final' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 28 Oct 2023 17:51:27 +0000 (07:51 -1000)]
Merge tag 'char-misc-6.6-final' of git://git./linux/kernel/git/gregkh/char-misc

Pull char/misc driver fixes from Greg KH:
 "Here are some very small driver fixes for 6.6-final that have shown up
  in the past two weeks. Included in here are:

   - tiny fastrpc bugfixes for reported errors

   - nvmem register fixes

   - iio driver fixes for some reported problems

   - fpga test fix

   - MAINTAINERS file update for fpga

  All of these have been in linux-next this week with no reported
  problems"

* tag 'char-misc-6.6-final' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  fpga: Fix memory leak for fpga_region_test_class_find()
  fpga: m10bmc-sec: Change contact for secure update driver
  fpga: disable KUnit test suites when module support is enabled
  iio: afe: rescale: Accept only offset channels
  nvmem: imx: correct nregs for i.MX6ULL
  nvmem: imx: correct nregs for i.MX6UL
  nvmem: imx: correct nregs for i.MX6SLL
  misc: fastrpc: Unmap only if buffer is unmapped from DSP
  misc: fastrpc: Clean buffers on remote invocation failures
  misc: fastrpc: Free DMA handles for RPC calls with no arguments
  misc: fastrpc: Reset metadata buffer to avoid incorrect free
  iio: exynos-adc: request second interupt only when touchscreen mode is used
  iio: adc: xilinx-xadc: Correct temperature offset/scale for UltraScale
  iio: adc: xilinx-xadc: Don't clobber preset voltage/temperature thresholds
  dt-bindings: iio: add missing reset-gpios constrain

7 months agoMerge tag 'i2c-for-6.6-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Sat, 28 Oct 2023 17:48:37 +0000 (07:48 -1000)]
Merge tag 'i2c-for-6.6-rc8' of git://git./linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "Bugfixes for Axxia when it is a target and for PEC handling of
  stm32f7.

  Plus, fix an OF node leak pattern in the mux subsystem"

* tag 'i2c-for-6.6-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: stm32f7: Fix PEC handling in case of SMBUS transfers
  i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node()
  i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node()
  i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node()
  i2c: aspeed: Fix i2c bus hang in slave read

7 months agodt-bindings: hwmon: ltc2991: add bindings
Antoniu Miclaus [Thu, 26 Oct 2023 10:33:12 +0000 (13:33 +0300)]
dt-bindings: hwmon: ltc2991: add bindings

Add dt-bindings for ltc2991 octal i2c voltage, current and temperature
monitor.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20231026103413.27800-1-antoniu.miclaus@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (pmbus/max31785) Add delay between bus accesses
Lakshmi Yadlapati [Fri, 27 Oct 2023 04:43:46 +0000 (23:43 -0500)]
hwmon: (pmbus/max31785) Add delay between bus accesses

The MAX31785 has shown erratic behaviour across multiple system
designs, unexpectedly clock stretching and NAKing transactions.

Experimentation shows that this seems to be triggered by a register access
directly back to back with a previous register write. Experimentation also
shows that inserting a small delay after register writes makes the issue go
away.

Use a similar solution to what the max15301 driver does to solve the same
problem. Create a custom set of bus read and write functions that make sure
that the delay is added.

Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
Link: https://lore.kernel.org/r/20231027044346.2167548-1-lakshmiy@us.ibm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (ina238) add ina237 support
Richard Leitner [Thu, 26 Oct 2023 07:08:49 +0000 (09:08 +0200)]
hwmon: (ina238) add ina237 support

The INA237 "85-V, 16-Bit, Precision Power Monitor With I2C Interface" is
basically the same as INA328. Therefore add a corresponding compatible
to the driver.

According to the datasheet the main difference is the current and power
monitoring accuracy:

+------------------------+---------------+---------------+
|                        | INA238        | INA237        |
+------------------------+---------------+---------------+
| Offset voltage         | +/- 5µV       | +/- 50µV      |
| Offset drift           | +/- 0.02µV/°C | +/- 0.02µV/°C |
| Gain error             | +/- 0.1%      | +/- 0.3%      |
| Gain error drift       | +/- 25ppm/°C  | +/- 50ppm/°C  |
| Common mode rejection  | 140dB         | 120dB         |
| Power accuracy         | 0.7%          | 1.6%          |
+------------------------+---------------+---------------+

As well as the missing DEVICE_ID register at 0x3F, which is currently
not in use by the driver.

Signed-off-by: Richard Leitner <richard.leitner@linux.dev>
Link: https://lore.kernel.org/r/20231026-ina237-v2-1-dec44811a3c9@linux.dev
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agodt-bindings: hwmon: ti,ina2xx: add ti,ina237
Richard Leitner [Thu, 26 Oct 2023 07:08:50 +0000 (09:08 +0200)]
dt-bindings: hwmon: ti,ina2xx: add ti,ina237

Add ti,ina237 binding to ti,ina2xx as they are very similar and may
share the same properties.

Signed-off-by: Richard Leitner <richard.leitner@linux.dev>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20231026-ina237-v2-2-dec44811a3c9@linux.dev
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (asus-ec-sensors) add ROG Crosshair X670E Gene.
Ellie Hermaszewska [Thu, 26 Oct 2023 10:43:22 +0000 (18:43 +0800)]
hwmon: (asus-ec-sensors) add ROG Crosshair X670E Gene.

Only the temp sensors that I can verify are present.

T_Sensor is the temperature reading of a 10kΩ Î²=3435K NTC thermistor
optionally connected to the T_SENSOR header.

The other sensors are as found on the X670E Hero.

Signed-off-by: Ellie Hermaszewska <kernel@monoid.al>
Link: https://lore.kernel.org/r/20231026104332.906357-1-kernel@monoid.al
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (max31827) handle vref regulator
Antoniu Miclaus [Mon, 25 Sep 2023 12:29:28 +0000 (15:29 +0300)]
hwmon: (max31827) handle vref regulator

Add missing implementation for the max31827 supply regulator.
This is a hardware required property that is not handled.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20230925122929.10610-1-antoniu.miclaus@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (ina3221) Add support for channel summation disable
Ninad Malwade [Fri, 29 Sep 2023 10:36:49 +0000 (11:36 +0100)]
hwmon: (ina3221) Add support for channel summation disable

The INA3221 allows the Critical alert pin to be controlled by the
summation control function. This function adds the single
shunt-voltage conversions for the desired channels in order to compare
the combined sum to the programmed limit. The Shunt-Voltage Sum Limit
register contains the programmed value that is compared to the value in
the Shunt-Voltage Sum register in order to determine if the total summed
limit is exceeded. If the shunt-voltage sum limit value is exceeded, the
Critical alert pin pulls low.

For the summation limit to have a meaningful value, we have to use the
same shunt-resistor value on all included channels. Unless equal
shunt-resistor values are used for each channel, the summation control
function cannot be used and it is not enabled by the driver.

To address this, add support to disable the summation of specific
channels via device tree property "ti,summation-disable". The channel
which has this property would be excluded from the calculation of
summation control function.

For example, summation control function calculates Shunt-Voltage Sum as:

- input_shunt_voltage_summation = input_shunt_voltage_channel1
                                + input_shunt_voltage_channel2
                                + input_shunt_voltage_channel3

If we want the summation to only use channel1 and channel3, we can add
'ti,summation-disable' property in device tree node for channel2. Then
the calculation will skip channel2.

- input_shunt_voltage_summation = input_shunt_voltage_channel1
                                + input_shunt_voltage_channel3

Note that we only want the channel to be skipped for summation control
function rather than completely disabled. Therefore, even if we add the
property 'ti,summation-disable', the channel is still enabled and
functional.

Finally, create debugfs entries that display if summation is disabled
for each of the channels.

Signed-off-by: Rajkumar Kasirajan <rkasirajan@nvidia.com>
Signed-off-by: Ninad Malwade <nmalwade@nvidia.com>
Co-developed-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20230929103650.86074-4-jonathanh@nvidia.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agodt-bindings: hwmon: ina3221: Add ti,summation-disable
Jon Hunter [Fri, 29 Sep 2023 10:36:48 +0000 (11:36 +0100)]
dt-bindings: hwmon: ina3221: Add ti,summation-disable

The INA3221 has a critical alert pin that can be controlled by the
summation control function. This function adds the single
shunt-voltage conversions for the desired channels in order to
compare the combined sum to the programmed limit. The Shunt-Voltage
Sum Limit register contains the programmed value that is compared
to the value in the Shunt-Voltage Sum register in order to
determine if the total summed limit is exceeded. If the
shunt-voltage sum limit value is exceeded, the critical alert pin
pulls low.

For the summation limit to have a meaningful value, it is necessary
to use the same shunt-resistor value on all included channels. Add a new
vendor specific property, 'ti,summation-disable', to allow specific
channels to be excluded from the summation control function if the shunt
resistor is different to other channels or the channel should not be
considered for triggering the critical alert pin.

Note that the ina3221 has always supported summing the various input
channels and summation is enabled by default if the shunt-resistor
values are the same. This change simply provides a way to exclude
inputs from the summation. If this property is not populated, then the
functionality of the driver does not change.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Ninad Malwade <nmalwade@nvidia.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230929103650.86074-3-jonathanh@nvidia.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agodt-bindings: hwmon: ina3221: Convert to json-schema
Ninad Malwade [Fri, 29 Sep 2023 10:36:47 +0000 (11:36 +0100)]
dt-bindings: hwmon: ina3221: Convert to json-schema

Convert the TI INA3221 bindings from the free-form text format to
json-schema.

Note that the INA3221 input channels default to enabled in the chip.
Unless channels are explicitly disabled in device-tree, input
channels will be enabled.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ninad Malwade <nmalwade@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230929103650.86074-2-jonathanh@nvidia.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (pmbus/mpq7932) Add a support for mpq2286 Power Management IC
Saravanan Sekar [Wed, 11 Oct 2023 16:47:54 +0000 (22:17 +0530)]
hwmon: (pmbus/mpq7932) Add a support for mpq2286 Power Management IC

The MPQ2286 is a programmable, high frequency synchronous buck regulator
designed to power a variety of Automotive system peripherals. Single buck
converters with hardware monitoring capability is configurable over PMBus
interface.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
Link: https://lore.kernel.org/r/20231011164754.449399-5-saravanan@linumiz.com
[groeck: Updated subject (mpq2286 -> mpq7932)]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (pmbus/core) Add helper macro to define single pmbus regulator
Saravanan Sekar [Wed, 11 Oct 2023 16:47:53 +0000 (22:17 +0530)]
hwmon: (pmbus/core) Add helper macro to define single pmbus regulator

The bindings for single instance regulator should be named with no instance
(e.g., buck not buck0). Introduce a new helper macro to define the single pmbus
regulator.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
Link: https://lore.kernel.org/r/20231011164754.449399-4-saravanan@linumiz.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agoregulator: dt-bindings: Add mps,mpq2286 power-management IC
Saravanan Sekar [Wed, 11 Oct 2023 16:47:52 +0000 (22:17 +0530)]
regulator: dt-bindings: Add mps,mpq2286 power-management IC

Document mpq2286 power-management IC.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20231011164754.449399-3-saravanan@linumiz.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (pmbus/mpq7932) Get page count based on chip info
Saravanan Sekar [Wed, 11 Oct 2023 16:47:51 +0000 (22:17 +0530)]
hwmon: (pmbus/mpq7932) Get page count based on chip info

Get page count using compatible match to support the series of chipsets
which differs in number of regualator/page.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
Link: https://lore.kernel.org/r/20231011164754.449399-2-saravanan@linumiz.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agodt-bindings: hwmon: Add possible new properties to max31827 bindings
Daniel Matyas [Tue, 19 Sep 2023 09:34:51 +0000 (12:34 +0300)]
dt-bindings: hwmon: Add possible new properties to max31827 bindings

These modify the corresponding bits in the configuration register.

adi,comp-int is a hardware property, because it affects the behavior
of the interrupt signal and whatever it is connected to.

adi,timeout-enable is a hardware property, because it affects i2c
bus operation.

Signed-off-by: Daniel Matyas <daniel.matyas@analog.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20230919093456.10592-3-daniel.matyas@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (max31827) Modify conversion wait time
Daniel Matyas [Tue, 19 Sep 2023 09:34:50 +0000 (12:34 +0300)]
hwmon: (max31827) Modify conversion wait time

There is nothing in the datasheet indicating that the 1ms error is
needed and I didn't encounter any error during testing with 140ms wait
time.

Signed-off-by: Daniel Matyas <daniel.matyas@analog.com>
Link: https://lore.kernel.org/r/20230919093456.10592-2-daniel.matyas@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (max31827) Make code cleaner
Daniel Matyas [Tue, 19 Sep 2023 09:34:49 +0000 (12:34 +0300)]
hwmon: (max31827) Make code cleaner

Used enums and while loops to replace switch for selecting and getting
update interval from conversion rate bits.

Divided the write_alarm_val function into 2 functions. The new function
is more generic: it can be used not only for alarm writes, but for any
kind of writes which require the device to be in shutdown mode.

Signed-off-by: Daniel Matyas <daniel.matyas@analog.com>
Link: https://lore.kernel.org/r/20230919093456.10592-1-daniel.matyas@analog.com
[groeck: Reverted error return value change (EOPNOTSUPP -> EINVAL)]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agoMAINTAINERS: Add Hal as one of the maintainers of SFCTEMP HWMON DRIVER
Hal Feng [Thu, 28 Sep 2023 07:52:49 +0000 (15:52 +0800)]
MAINTAINERS: Add Hal as one of the maintainers of SFCTEMP HWMON DRIVER

As he is the submitter of this driver, add his mail so he can
maintain the driver and easily reply in the mailing list.

Acked-by: Emil Renner Berthing <kernel@esmil.dk>
Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
Link: https://lore.kernel.org/r/20230928075249.109459-1-hal.feng@starfivetech.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (nct6683) Add another customer ID for ASRock X670E Taichi
Alexander Koskovich [Mon, 23 Oct 2023 18:24:59 +0000 (18:24 +0000)]
hwmon: (nct6683) Add another customer ID for ASRock X670E Taichi

This value was found on an ASRock X670E Taichi with an
NCT6686D chip.

Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
Link: https://lore.kernel.org/r/20231023182442.21943-1-akoskovich@pm.me
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (ltc2992) Avoid division by zero
Antoniu Miclaus [Wed, 11 Oct 2023 13:57:53 +0000 (16:57 +0300)]
hwmon: (ltc2992) Avoid division by zero

Do not allow setting shunt resistor to 0. This results in a division by
zero when performing current value computations based on input voltages
and connected resistor values.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20231011135754.13508-1-antoniu.miclaus@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (npcm750-pwm) Add an error code check in npcm7xx_en_pwm_fan
Su Hui [Fri, 20 Oct 2023 08:55:19 +0000 (16:55 +0800)]
hwmon: (npcm750-pwm) Add an error code check in npcm7xx_en_pwm_fan

npcm7xx_pwm_config_set() can return '-ENODEV' for failed. So check
the value of 'ret' after calling npcm7xx_pwm_config_set().

Signed-off-by: Su Hui <suhui@nfschina.com>
Link: https://lore.kernel.org/r/20231020085518.198477-1-suhui@nfschina.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (hs3001) remove redundant store on division
Colin Ian King [Mon, 23 Oct 2023 13:58:28 +0000 (14:58 +0100)]
hwmon: (hs3001) remove redundant store on division

Currently the local variable hum is being divided by a constant and
the results is being re-assigned back to hum before the value is being
returned to the caller. The assignment to hum is redundant and can
be removed.

Cleans up clang scan build warning:
drivers/hwmon/hs3001.c:65:9: warning: Although the value stored to 'hum'
is used in the enclosing expression, the value is never actually read
from 'hum' [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20231023135828.667297-1-colin.i.king@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agohwmon: (nct6775) use acpi_dev_hid_uid_match() for matching _HID and _UID
Raag Jadav [Tue, 24 Oct 2023 06:20:17 +0000 (11:50 +0530)]
hwmon: (nct6775) use acpi_dev_hid_uid_match() for matching _HID and _UID

Convert manual _UID references to use the standard ACPI helper.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Link: https://lore.kernel.org/r/20231024062018.23839-6-raag.jadav@intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7 months agoporting: update locking requirements
Christian Brauner [Wed, 18 Oct 2023 10:26:20 +0000 (12:26 +0200)]
porting: update locking requirements

Now that s_umount is never taken under open_mutex update the
documentation to say so.

Link: https://lore.kernel.org/r/20231017184823.1383356-1-hch@lst.de
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agofs: assert that open_mutex isn't held over holder ops
Christian Brauner [Tue, 17 Oct 2023 18:48:23 +0000 (20:48 +0200)]
fs: assert that open_mutex isn't held over holder ops

With recent block level changes we should never be in a situation where
we hold disk->open_mutex when calling into these helpers. So assert that
in the code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20231017184823.1383356-6-hch@lst.de
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoblock: assert that we're not holding open_mutex over blk_report_disk_dead
Christian Brauner [Tue, 17 Oct 2023 18:48:22 +0000 (20:48 +0200)]
block: assert that we're not holding open_mutex over blk_report_disk_dead

blk_report_disk_dead() has the following major callers:

(1) del_gendisk()
(2) blk_mark_disk_dead()

Since del_gendisk() acquires disk->open_mutex it's clear that all
callers are assumed to be called without disk->open_mutex held.
In turn, blk_report_disk_dead() is called without disk->open_mutex held
in del_gendisk().

All callers of blk_mark_disk_dead() call it without disk->open_mutex as
well.

Ensure that it is clear that blk_report_disk_dead() is called without
disk->open_mutex on purpose by asserting it and a comment in the code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20231017184823.1383356-5-hch@lst.de
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoblock: move bdev_mark_dead out of disk_check_media_change
Christoph Hellwig [Tue, 17 Oct 2023 18:48:21 +0000 (20:48 +0200)]
block: move bdev_mark_dead out of disk_check_media_change

disk_check_media_change is mostly called from ->open where it makes
little sense to mark the file system on the device as dead, as we
are just opening it.  So instead of calling bdev_mark_dead from
disk_check_media_change move it into the few callers that are not
in an open instance.  This avoid calling into bdev_mark_dead and
thus taking s_umount with open_mutex held.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20231017184823.1383356-4-hch@lst.de
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoblock: WARN_ON_ONCE() when we remove active partitions
Christian Brauner [Tue, 17 Oct 2023 18:48:20 +0000 (20:48 +0200)]
block: WARN_ON_ONCE() when we remove active partitions

The logic for disk->open_partitions is:

blkdev_get_by_*()
-> bdev_is_partition()
   -> blkdev_get_part()
      -> blkdev_get_whole() // bdev_whole->bd_openers++
      -> if (part->bd_openers == 0)
                 disk->open_partitions++
         part->bd_openers

In other words, when we first claim/open a partition we increment
disk->open_partitions and only when all part->bd_openers are closed will
disk->open_partitions be zero. That should mean that
disk->open_partitions is always > 0 as long as there's anyone that
has an open partition.

So the check for disk->open_partitions should mean that we can never
remove an active partition that has a holder and holder ops set. Assert
that in the code. The main disk isn't removed so that check doesn't work
for disk->part0 which is what we want. After all we only care about
partition not about the main disk.

Link: https://lore.kernel.org/r/20231017184823.1383356-3-hch@lst.de
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoblock: simplify bdev_del_partition()
Christian Brauner [Tue, 17 Oct 2023 18:48:19 +0000 (20:48 +0200)]
block: simplify bdev_del_partition()

BLKPG_DEL_PARTITION refuses to delete partitions that still have
openers, i.e., that has an elevated @bdev->bd_openers count. If a device
is claimed by setting @bdev->bd_holder and @bdev->bd_holder_ops
@bdev->bd_openers and @bdev->bd_holders are incremented.
@bdev->bd_openers is effectively guaranteed to be >= @bdev->bd_holders.
So as long as @bdev->bd_openers isn't zero we know that this partition
is still in active use and that there might still be @bdev->bd_holder
and @bdev->bd_holder_ops set.

The only current example is @fs_holder_ops for filesystems. But that
means bdev_mark_dead() which calls into
bdev->bd_holder_ops->mark_dead::fs_bdev_mark_dead() is a nop. As long as
there's an elevated @bdev->bd_openers count we can't delete the
partition and if there isn't an elevated @bdev->bd_openers count then
there's no @bdev->bd_holder or @bdev->bd_holder_ops.

So simply open-code what we need to do. This gets rid of one more
instance where we acquire s_umount under @disk->open_mutex.

Link: https://lore.kernel.org/r/20231016-fototermin-umriss-59f1ea6c1fe6@brauner
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20231017184823.1383356-2-hch@lst.de
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agofs: Avoid grabbing sb->s_umount under bdev->bd_holder_lock
Jan Kara [Wed, 18 Oct 2023 15:29:24 +0000 (17:29 +0200)]
fs: Avoid grabbing sb->s_umount under bdev->bd_holder_lock

The implementation of bdev holder operations such as fs_bdev_mark_dead()
and fs_bdev_sync() grab sb->s_umount semaphore under
bdev->bd_holder_lock. This is problematic because it leads to
disk->open_mutex -> sb->s_umount lock ordering which is counterintuitive
(usually we grab higher level (e.g. filesystem) locks first and lower
level (e.g. block layer) locks later) and indeed makes lockdep complain
about possible locking cycles whenever we open a block device while
holding sb->s_umount semaphore. Implement a function
bdev_super_lock_shared() which safely transitions from holding
bdev->bd_holder_lock to holding sb->s_umount on alive superblock without
introducing the problematic lock dependency. We use this function
fs_bdev_sync() and fs_bdev_mark_dead().

Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20231018152924.3858-1-jack@suse.cz
Link: https://lore.kernel.org/r/20231017184823.1383356-1-hch@lst.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agojfs: fix log->bdev_handle null ptr deref in lbmStartIO
Lizhi Xu [Mon, 9 Oct 2023 09:45:57 +0000 (17:45 +0800)]
jfs: fix log->bdev_handle null ptr deref in lbmStartIO

When sbi->flag is JFS_NOINTEGRITY in lmLogOpen(), log->bdev_handle can't
be inited, so it value will be NULL.
Therefore, add the "log ->no_integrity=1" judgment in lbmStartIO() to avoid such
problems.

Reported-and-tested-by: syzbot+23bc20037854bb335d59@syzkaller.appspotmail.com
Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
Link: https://lore.kernel.org/r/20231009094557.1398920-1-lizhi.xu@windriver.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agobcache: Fixup error handling in register_cache()
Jan Kara [Wed, 4 Oct 2023 09:37:57 +0000 (11:37 +0200)]
bcache: Fixup error handling in register_cache()

Coverity has noticed that the printing of error message in
register_cache() uses already freed bdev_handle to get to bdev. In fact
the problem has been there even before commit "bcache: Convert to
bdev_open_by_path()" just a bit more subtle one - cache object itself
could have been freed by the time we looked at ca->bdev and we don't
hold any reference to bdev either so even that could in principle go
away (due to device unplug or similar). Fix all these problems by
printing the error message before closing the bdev.

Fixes: dc893f51d24a ("bcache: Convert to bdev_open_by_path()")
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20231004093757.11560-1-jack@suse.cz
Asked-by: Coly Li <colyli@suse.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoxfs: Convert to bdev_open_by_path()
Jan Kara [Wed, 27 Sep 2023 09:34:34 +0000 (11:34 +0200)]
xfs: Convert to bdev_open_by_path()

Convert xfs to use bdev_open_by_path() and pass the handle around.

CC: "Darrick J. Wong" <djwong@kernel.org>
CC: linux-xfs@vger.kernel.org
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-28-jack@suse.cz
Acked-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoreiserfs: Convert to bdev_open_by_dev/path()
Jan Kara [Wed, 27 Sep 2023 09:34:33 +0000 (11:34 +0200)]
reiserfs: Convert to bdev_open_by_dev/path()

Convert reiserfs to use bdev_open_by_dev/path() and pass the handle
around.

CC: reiserfs-devel@vger.kernel.org
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-27-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoocfs2: Convert to use bdev_open_by_dev()
Jan Kara [Wed, 27 Sep 2023 09:34:32 +0000 (11:34 +0200)]
ocfs2: Convert to use bdev_open_by_dev()

Convert ocfs2 heartbeat code to use bdev_open_by_dev() and pass the
handle around.

CC: Joseph Qi <joseph.qi@linux.alibaba.com>
CC: ocfs2-devel@oss.oracle.com
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-26-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agonfs/blocklayout: Convert to use bdev_open_by_dev/path()
Jan Kara [Wed, 27 Sep 2023 09:34:31 +0000 (11:34 +0200)]
nfs/blocklayout: Convert to use bdev_open_by_dev/path()

Convert block device handling to use bdev_open_by_dev/path() and pass
the handle around.

CC: linux-nfs@vger.kernel.org
CC: Trond Myklebust <trond.myklebust@hammerspace.com>
CC: Anna Schumaker <anna@kernel.org>
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-25-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agojfs: Convert to bdev_open_by_dev()
Jan Kara [Wed, 27 Sep 2023 09:34:30 +0000 (11:34 +0200)]
jfs: Convert to bdev_open_by_dev()

Convert jfs to use bdev_open_by_dev() and pass the handle around.

CC: Dave Kleikamp <shaggy@kernel.org>
CC: jfs-discussion@lists.sourceforge.net
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-24-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agof2fs: Convert to bdev_open_by_dev/path()
Jan Kara [Wed, 27 Sep 2023 09:34:29 +0000 (11:34 +0200)]
f2fs: Convert to bdev_open_by_dev/path()

Convert f2fs to use bdev_open_by_dev/path() and pass the handle around.

CC: Jaegeuk Kim <jaegeuk@kernel.org>
CC: Chao Yu <chao@kernel.org>
CC: linux-f2fs-devel@lists.sourceforge.net
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-23-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoext4: Convert to bdev_open_by_dev()
Jan Kara [Wed, 27 Sep 2023 09:34:28 +0000 (11:34 +0200)]
ext4: Convert to bdev_open_by_dev()

Convert ext4 to use bdev_open_by_dev() and pass the handle around.

CC: linux-ext4@vger.kernel.org
CC: Ted Tso <tytso@mit.edu>
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-22-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoerofs: Convert to use bdev_open_by_path()
Jan Kara [Wed, 27 Sep 2023 09:34:27 +0000 (11:34 +0200)]
erofs: Convert to use bdev_open_by_path()

Convert erofs to use bdev_open_by_path() and pass the handle around.

CC: Gao Xiang <xiang@kernel.org>
CC: Chao Yu <chao@kernel.org>
CC: linux-erofs@lists.ozlabs.org
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-21-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agobtrfs: Convert to bdev_open_by_path()
Jan Kara [Wed, 27 Sep 2023 09:34:26 +0000 (11:34 +0200)]
btrfs: Convert to bdev_open_by_path()

Convert btrfs to use bdev_open_by_path() and pass the handle around.  We
also drop the holder from struct btrfs_device as it is now not needed
anymore.

CC: David Sterba <dsterba@suse.com>
CC: linux-btrfs@vger.kernel.org
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-20-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agofs: Convert to bdev_open_by_dev()
Jan Kara [Wed, 27 Sep 2023 09:34:25 +0000 (11:34 +0200)]
fs: Convert to bdev_open_by_dev()

Convert mount code to use bdev_open_by_dev() and propagate the handle
around to bdev_release().

Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-19-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agomm/swap: Convert to use bdev_open_by_dev()
Jan Kara [Wed, 27 Sep 2023 09:34:24 +0000 (11:34 +0200)]
mm/swap: Convert to use bdev_open_by_dev()

Convert swapping code to use bdev_open_by_dev() and pass the handle
around.

CC: linux-mm@kvack.org
CC: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-18-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoPM: hibernate: Drop unused snapshot_test argument
Jan Kara [Wed, 27 Sep 2023 09:34:23 +0000 (11:34 +0200)]
PM: hibernate: Drop unused snapshot_test argument

snapshot_test argument is now unused in swsusp_close() and
load_image_and_restore(). Drop it

CC: linux-pm@vger.kernel.org
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: "Rafael J. Wysocki" <rafael@kernel.org>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-17-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoPM: hibernate: Convert to bdev_open_by_dev()
Jan Kara [Wed, 27 Sep 2023 09:34:22 +0000 (11:34 +0200)]
PM: hibernate: Convert to bdev_open_by_dev()

Convert hibernation code to use bdev_open_by_dev().

CC: linux-pm@vger.kernel.org
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: "Rafael J. Wysocki" <rafael@kernel.org>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-16-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoscsi: target: Convert to bdev_open_by_path()
Jan Kara [Wed, 27 Sep 2023 09:34:21 +0000 (11:34 +0200)]
scsi: target: Convert to bdev_open_by_path()

Convert iblock and pscsi drivers to use bdev_open_by_path() and pass the
handle around.

CC: target-devel@vger.kernel.org
CC: linux-scsi@vger.kernel.org
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-15-jack@suse.cz
Reviewed-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agos390/dasd: Convert to bdev_open_by_path()
Jan Kara [Wed, 27 Sep 2023 09:34:20 +0000 (11:34 +0200)]
s390/dasd: Convert to bdev_open_by_path()

Convert dasd to use bdev_open_by_path() and pass the handle around.

CC: linux-s390@vger.kernel.org
CC: Christian Borntraeger <borntraeger@linux.ibm.com>
CC: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-14-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agonvmet: Convert to bdev_open_by_path()
Jan Kara [Wed, 27 Sep 2023 09:34:19 +0000 (11:34 +0200)]
nvmet: Convert to bdev_open_by_path()

Convert nvmet to use bdev_open_by_path() and pass the handle around.

CC: linux-nvme@lists.infradead.org
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-13-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agomtd: block2mtd: Convert to bdev_open_by_dev/path()
Jan Kara [Wed, 27 Sep 2023 09:34:18 +0000 (11:34 +0200)]
mtd: block2mtd: Convert to bdev_open_by_dev/path()

Convert block2mtd to use bdev_open_by_dev() and bdev_open_by_path() and
pass the handle around.

CC: Joern Engel <joern@lazybastard.org>
CC: linux-mtd@lists.infradead.org
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-12-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agomd: Convert to bdev_open_by_dev()
Jan Kara [Wed, 27 Sep 2023 09:34:17 +0000 (11:34 +0200)]
md: Convert to bdev_open_by_dev()

Convert md to use bdev_open_by_dev() and pass the handle around. We also
don't need the 'Holder' flag anymore so remove it.

CC: linux-raid@vger.kernel.org
CC: Song Liu <song@kernel.org>
Acked-by: Song Liu <song@kernel.org>
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-11-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agodm: Convert to bdev_open_by_dev()
Jan Kara [Wed, 27 Sep 2023 09:34:16 +0000 (11:34 +0200)]
dm: Convert to bdev_open_by_dev()

Convert device mapper to use bdev_open_by_dev() and pass the handle
around.

CC: Alasdair Kergon <agk@redhat.com>
CC: Mike Snitzer <snitzer@kernel.org>
CC: dm-devel@redhat.com
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-10-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agobcache: Convert to bdev_open_by_path()
Jan Kara [Wed, 27 Sep 2023 09:34:15 +0000 (11:34 +0200)]
bcache: Convert to bdev_open_by_path()

Convert bcache to use bdev_open_by_path() and pass the handle around.

CC: linux-bcache@vger.kernel.org
CC: Coly Li <colyli@suse.de>
CC: Kent Overstreet <kent.overstreet@gmail.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Acked-by: Coly Li <colyli@suse.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-9-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agozram: Convert to use bdev_open_by_dev()
Jan Kara [Wed, 27 Sep 2023 09:34:14 +0000 (11:34 +0200)]
zram: Convert to use bdev_open_by_dev()

Convert zram to use bdev_open_by_dev() and pass the handle around.

CC: Minchan Kim <minchan@kernel.org>
CC: Sergey Senozhatsky <senozhatsky@chromium.org>
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-8-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoxen/blkback: Convert to bdev_open_by_dev()
Jan Kara [Wed, 27 Sep 2023 09:34:13 +0000 (11:34 +0200)]
xen/blkback: Convert to bdev_open_by_dev()

Convert xen/blkback to use bdev_open_by_dev() and pass the
handle around.

CC: xen-devel@lists.xenproject.org
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-7-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agornbd-srv: Convert to use bdev_open_by_path()
Jan Kara [Wed, 27 Sep 2023 09:34:12 +0000 (11:34 +0200)]
rnbd-srv: Convert to use bdev_open_by_path()

Convert rnbd-srv to use bdev_open_by_path() and pass the handle
around.

CC: Jack Wang <jinpu.wang@ionos.com>
CC: "Md. Haris Iqbal" <haris.iqbal@ionos.com>
Acked-by: "Md. Haris Iqbal" <haris.iqbal@ionos.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-6-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agopktcdvd: Convert to bdev_open_by_dev()
Jan Kara [Wed, 27 Sep 2023 09:34:11 +0000 (11:34 +0200)]
pktcdvd: Convert to bdev_open_by_dev()

Convert pktcdvd to use bdev_open_by_dev().

Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-5-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agodrdb: Convert to use bdev_open_by_path()
Jan Kara [Wed, 27 Sep 2023 09:34:10 +0000 (11:34 +0200)]
drdb: Convert to use bdev_open_by_path()

Convert drdb to use bdev_open_by_path().

CC: drbd-dev@lists.linbit.com
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-4-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoblock: Use bdev_open_by_dev() in disk_scan_partitions() and blkdev_bszset()
Jan Kara [Wed, 27 Sep 2023 09:34:09 +0000 (11:34 +0200)]
block: Use bdev_open_by_dev() in disk_scan_partitions() and blkdev_bszset()

Convert disk_scan_partitions() and blkdev_bszset() to use
bdev_open_by_dev().

Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-3-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoblock: Use bdev_open_by_dev() in blkdev_open()
Jan Kara [Wed, 27 Sep 2023 09:34:08 +0000 (11:34 +0200)]
block: Use bdev_open_by_dev() in blkdev_open()

Convert blkdev_open() to use bdev_open_by_dev(). To be able to propagate
handle from blkdev_open() to blkdev_release() we need to stop using
existence of file->private_data to determine exclusive block device
opens. Use bdev_handle->mode for this purpose since file->f_flags
isn't usable for this (O_EXCL is cleared from the flags during open).

Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-2-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoblock: Provide bdev_open_* functions
Jan Kara [Wed, 27 Sep 2023 09:34:07 +0000 (11:34 +0200)]
block: Provide bdev_open_* functions

Create struct bdev_handle that contains all parameters that need to be
passed to blkdev_put() and provide bdev_open_* functions that return
this structure instead of plain bdev pointer. This will eventually allow
us to pass one more argument to blkdev_put() (renamed to bdev_release())
without too much hassle.

Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230927093442.25915-1-jack@suse.cz
Signed-off-by: Christian Brauner <brauner@kernel.org>
7 months agoplatform/chrome: cros_ec_lpc: Separate host command and irq disable
Lalith Rajendran [Fri, 27 Oct 2023 21:02:22 +0000 (16:02 -0500)]
platform/chrome: cros_ec_lpc: Separate host command and irq disable

Both cros host command and irq disable were moved to suspend
prepare stage from late suspend recently. This is causing EC
to report MKBP event timeouts during suspend stress testing.
When the MKBP event timeouts happen during suspend, subsequent
wakeup of AP by EC using MKBP doesn't happen properly. Move the
irq disabling part back to late suspend stage which is a general
suggestion from the suspend kernel documentaiton to do irq
disable as late as possible.

Fixes: 4b9abbc132b8 ("platform/chrome: cros_ec_lpc: Move host command to prepare/complete")
Signed-off-by: Lalith Rajendran <lalithkraj@chromium.org>
Link: https://lore.kernel.org/r/20231027160221.v4.1.I1725c3ed27eb7cd9836904e49e8bfa9fb0200a97@changeid
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
7 months agoMerge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 28 Oct 2023 02:52:51 +0000 (16:52 -1000)]
Merge tag 'clk-fixes-for-linus' of git://git./linux/kernel/git/clk/linux

Pull clk fixes from Stephen Boyd:
 "Three fixes, one for the clk framework and two for clk drivers:

   - Avoid an oops in possible_parent_show() by checking for no parent
     properly when a DT index based lookup is used

   - Handle errors returned from divider_ro_round_rate() in
     clk_stm32_composite_determine_rate()

   - Fix clk_ops::determine_rate() implementation of socfpga's
     gateclk_ops that was ruining uart output because the divider
     was forgotten about"

* tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
  clk: stm32: Fix a signedness issue in clk_stm32_composite_determine_rate()
  clk: Sanitize possible_parent_show to Handle Return Value of of_clk_get_parent_name
  clk: socfpga: gate: Account for the divider in determine_rate

7 months agoMerge tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Sat, 28 Oct 2023 02:44:58 +0000 (16:44 -1000)]
Merge tag 'pull-fixes' of git://git./linux/kernel/git/viro/vfs

Pull misc filesystem fixes from Al Viro:
 "Assorted fixes all over the place: literally nothing in common, could
  have been three separate pull requests.

  All are simple regression fixes, but not for anything from this cycle"

* tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  ceph_wait_on_conflict_unlink(): grab reference before dropping ->d_lock
  io_uring: kiocb_done() should *not* trust ->ki_pos if ->{read,write}_iter() failed
  sparc32: fix a braino in fault handling in csum_and_copy_..._user()

7 months agoclk: Fix clk gate kunit test on big-endian CPUs
Stephen Boyd [Fri, 27 Oct 2023 22:58:21 +0000 (15:58 -0700)]
clk: Fix clk gate kunit test on big-endian CPUs

The clk gate kunit test checks that the implementation of the basic clk
gate reads and writes the proper bits in an MMIO register. The
implementation of the basic clk gate type uses writel() and readl()
which operate on little-endian registers. This test fails on big-endian
CPUs because the clk gate implementation writes to 'fake_reg' with
writel(), which converts the value to be written to little-endian before
storing the value in the fake register. When the test checks the bits in
the fake register on a big-endian machine it falsely assumes the format
of the register is also big-endian, when it is really always
little-endian. Suffice to say things don't work very well.

Mark 'fake_reg' as __le32 and push through endian accessor fixes
wherever the value is inspected to make this test endian agnostic.
There's a CLK_GATE_BIG_ENDIAN flag for big-endian MMIO devices, which
this test isn't using. A follow-up patch will test with and without that
flag.

Reported-by: Boqun Feng <boqun.feng@gmail.com>
Closes: https://lore.kernel.org/r/ZTLH5o0GlFBYsAHq@boqun-archlinux
Tested-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20231027225821.95833-1-sboyd@kernel.org
7 months agotracing/kprobes: Fix symbol counting logic by looking at modules as well
Andrii Nakryiko [Fri, 27 Oct 2023 23:31:26 +0000 (16:31 -0700)]
tracing/kprobes: Fix symbol counting logic by looking at modules as well

Recent changes to count number of matching symbols when creating
a kprobe event failed to take into account kernel modules. As such, it
breaks kprobes on kernel module symbols, by assuming there is no match.

Fix this my calling module_kallsyms_on_each_symbol() in addition to
kallsyms_on_each_match_symbol() to perform a proper counting.

Link: https://lore.kernel.org/all/20231027233126.2073148-1-andrii@kernel.org/
Cc: Francis Laniel <flaniel@linux.microsoft.com>
Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Fixes: b022f0c7e404 ("tracing/kprobes: Return EADDRNOTAVAIL when func matches several symbols")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Song Liu <song@kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
7 months agoceph_wait_on_conflict_unlink(): grab reference before dropping ->d_lock
Al Viro [Fri, 15 Sep 2023 01:55:29 +0000 (21:55 -0400)]
ceph_wait_on_conflict_unlink(): grab reference before dropping ->d_lock

Use of dget() after we'd dropped ->d_lock is too late - dentry might
be gone by that point.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
7 months agoio_uring: kiocb_done() should *not* trust ->ki_pos if ->{read,write}_iter() failed
Al Viro [Mon, 28 Aug 2023 22:47:31 +0000 (18:47 -0400)]
io_uring: kiocb_done() should *not* trust ->ki_pos if ->{read,write}_iter() failed

->ki_pos value is unreliable in such cases.  For an obvious example,
consider O_DSYNC write - we feed the data to page cache and start IO,
then we make sure it's completed.  Update of ->ki_pos is dealt with
by the first part; failure in the second ends up with negative value
returned _and_ ->ki_pos left advanced as if sync had been successful.
In the same situation write(2) does not advance the file position
at all.

Reviewed-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
7 months agoMerge tag 'io_uring-6.6-2023-10-27' of git://git.kernel.dk/linux
Linus Torvalds [Sat, 28 Oct 2023 00:10:32 +0000 (14:10 -1000)]
Merge tag 'io_uring-6.6-2023-10-27' of git://git.kernel.dk/linux

Pull io_uring fixes from Jens Axboe:
 "Fix for an issue reported where reading fdinfo could find a NULL
  thread as we didn't properly synchronize, and then a disable for the
  IOCB_DIO_CALLER_COMP optimization as a recent reported highlighted how
  that could lead to deadlocks if the task issued async O_DIRECT writes
  and then proceeded to do sync fallocate() calls"

* tag 'io_uring-6.6-2023-10-27' of git://git.kernel.dk/linux:
  io_uring/rw: disable IOCB_DIO_CALLER_COMP
  io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid

7 months agosparc32: fix a braino in fault handling in csum_and_copy_..._user()
Al Viro [Sun, 22 Oct 2023 23:34:28 +0000 (19:34 -0400)]
sparc32: fix a braino in fault handling in csum_and_copy_..._user()

Fault handler used to make non-trivial calls, so it needed
to set a stack frame up.  Used to be
save ... - grab a stack frame, old %o... become %i...
....
ret - go back to address originally in %o7, currently %i7
 restore - switch to previous stack frame, in delay slot
Non-trivial calls had been gone since ab5e8b331244 and that code should
have become
retl - go back to address in %o7
 clr %o0 - have return value set to 0
What it had become instead was
ret - go back to address in %i7 - return address of *caller*
 clr %o0 - have return value set to 0
which is not good, to put it mildly - we forcibly return 0 from
csum_and_copy_{from,to}_iter() (which is what the call of that
thing had been inlined into) and do that without dropping the
stack frame of said csum_and_copy_..._iter().  Confuses the
hell out of the caller of csum_and_copy_..._iter(), obviously...

Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Fixes: ab5e8b331244 "sparc32: propagate the calling conventions change down to __csum_partial_copy_sparc_generic()"
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
7 months agoMerge tag 'block-6.6-2023-10-27' of git://git.kernel.dk/linux
Linus Torvalds [Sat, 28 Oct 2023 00:01:59 +0000 (14:01 -1000)]
Merge tag 'block-6.6-2023-10-27' of git://git.kernel.dk/linux

Pull block fix from Jens Axboe:
 "Just a single fix for a potential divide-by-zero, introduced in this
  cycle"

* tag 'block-6.6-2023-10-27' of git://git.kernel.dk/linux:
  blk-throttle: check for overflow in calculate_bytes_allowed

7 months agoMerge tag 'ata-6.6-final' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal...
Linus Torvalds [Fri, 27 Oct 2023 23:38:59 +0000 (13:38 -1000)]
Merge tag 'ata-6.6-final' of git://git./linux/kernel/git/dlemoal/libata

Pull ATA fix from Damien Le Moal:
 "A single patch to fix a regression introduced by the recent
  suspend/resume fixes.

  The regression is that ATA disks are not stopped on system shutdown,
  which is not recommended and increases the disks SMART counters for
  unclean power off events.

  This patch fixes this by refining the recent rework of the scsi device
  manage_xxx flags"

* tag 'ata-6.6-final' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata:
  scsi: sd: Introduce manage_shutdown device flag

7 months agoMerge tag 'platform-drivers-x86-v6.6-6' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Fri, 27 Oct 2023 23:32:48 +0000 (13:32 -1000)]
Merge tag 'platform-drivers-x86-v6.6-6' of git://git./linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver fix from Hans de Goede:
 "A single patch to extend the AMD PMC driver DMI quirk list
  for laptops which need special handling to avoid NVME s2idle
  suspend/resume errors"

* tag 'platform-drivers-x86-v6.6-6' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
  platform/x86: Add s2idle quirk for more Lenovo laptops