Skip to contentSkip to conversation

firewire-ohci: work around oversized DMA reads on JMicron controllers

PATCH In review Sasha Levin 14 participants 275 messages Apr 9, 2018 – May 3, 2018 Page 1 of 2

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/161 firewire-ohci: work around oversized DMA reads on JMicron controllers

From: Hector Martin <[email protected]>

[ Upstream commit 188775181bc05f29372b305ef96485840e351fde ]

At least some JMicron controllers issue buggy oversized DMA reads when fetching context descriptors, always fetching 0x20 bytes at once for descriptors which are only 0x10 bytes long. This is often harmless, but can cause page faults on modern systems with IOMMUs:

DMAR: [DMA Read] Request device [05:00.0] fault addr fff56000 [fault reason 06] PTE Read access is not set firewire_ohci 0000:05:00.0: DMA context IT0 has stopped, error code: evt_descriptor_read

This works around the problem by always leaving 0x10 padding bytes at the end of descriptor buffer pages, which should be harmless to do unconditionally for controllers in case others have the same behavior.

---
 drivers/firewire/ohci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/firewire/ohci.c +7 -1
index 8bf89267dc25..d731b413cb2c 100644
@@ -1130,7 +1130,13 @@ static int context_add_buffer(struct context *ctx)
 		return -ENOMEM;
 
 	offset = (void *)&desc->buffer - (void *)desc;
-	desc->buffer_size = PAGE_SIZE - offset;
+	/*
+	 * Some controllers, like JMicron ones, always issue 0x20-byte DMA reads
+	 * for descriptors, even 0x10-byte ones. This can cause page faults when
+	 * an IOMMU is in use and the oversized read crosses a page boundary.
+	 * Work around this by always leaving at least 0x10 bytes of padding.
+	 */
+	desc->buffer_size = PAGE_SIZE - offset - 0x10;
 	desc->buffer_bus = bus_addr + offset;
 	desc->used = 0;
 
Signature · 1 line
2.15.1
#1 lore raw

PATCH 2/161 x86/tsc: Allow TSC calibration without PIT

From: Peter Zijlstra <[email protected]>

[ Upstream commit 30c7e5b123673d5e570e238dbada2fb68a87212c ]

Zhang Rui reported that a Surface Pro 4 will fail to boot with lapic=notscdeadline. Part of the problem is that that machine doesn't have a PIT.

If, for some reason, the TSC init has to fall back to TSC calibration, it relies on the PIT to be present.

Allow TSC calibration to reliably fall back to HPET.

The below results in an accurate TSC measurement when forced on a IVB:

tsc: Unable to calibrate against PIT
tsc: No reference (HPET/PMTIMER) available
tsc: Unable to calibrate against PIT
tsc: using HPET reference calibration
tsc: Detected 2792.451 MHz processor

---
 arch/x86/include/asm/i8259.h |  5 +++++
 arch/x86/kernel/tsc.c        | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+)
arch/x86/include/asm/i8259.h +5 -0
index c8376b40e882..5cdcdbd4d892 100644
@@ -69,6 +69,11 @@ struct legacy_pic {
 extern struct legacy_pic *legacy_pic;
 extern struct legacy_pic null_legacy_pic;
 
+static inline bool has_legacy_pic(void)
+{
+	return legacy_pic != &null_legacy_pic;
+}
+
 static inline int nr_legacy_irqs(void)
 {
 	return legacy_pic->nr_legacy_irqs;
arch/x86/kernel/tsc.c +18 -0
index 47506567435e..03d8e9204a6a 100644
@@ -25,6 +25,7 @@
 #include <asm/geode.h>
 #include <asm/apic.h>
 #include <asm/intel-family.h>
+#include <asm/i8259.h>
 
 unsigned int __read_mostly cpu_khz;	/* TSC clocks / usec, not used here */
 EXPORT_SYMBOL(cpu_khz);
@@ -363,6 +364,20 @@ static unsigned long pit_calibrate_tsc(u32 latch, unsigned long ms, int loopmin)
 	unsigned long tscmin, tscmax;
 	int pitcnt;
 
+	if (!has_legacy_pic()) {
+		/*
+		 * Relies on tsc_early_delay_calibrate() to have given us semi
+		 * usable udelay(), wait for the same 50ms we would have with
+		 * the PIT loop below.
+		 */
+		udelay(10 * USEC_PER_MSEC);
+		udelay(10 * USEC_PER_MSEC);
+		udelay(10 * USEC_PER_MSEC);
+		udelay(10 * USEC_PER_MSEC);
+		udelay(10 * USEC_PER_MSEC);
+		return ULONG_MAX;
+	}
+
 	/* Set the Gate high, disable speaker */
 	outb((inb(0x61) & ~0x02) | 0x01, 0x61);
 
@@ -487,6 +502,9 @@ static unsigned long quick_pit_calibrate(void)
 	u64 tsc, delta;
 	unsigned long d1, d2;
 
+	if (!has_legacy_pic())
+		return 0;
+
 	/* Set the Gate high, disable speaker */
 	outb((inb(0x61) & ~0x02) | 0x01, 0x61);
 
Signature · 1 line
2.15.1
#2 lore raw

PATCH 3/161 NFSv4: always set NFS_LOCK_LOST when a lock is lost.

In reply to Sasha Levin

From: NeilBrown <[email protected]>

[ Upstream commit dce2630c7da73b0634686bca557cc8945cc450c8 ]

There are 2 comments in the NFSv4 code which suggest that SIGLOST should possibly be sent to a process. In these cases a lock has been lost.
The current practice is to set NFS_LOCK_LOST so that read/write returns EIO when a lock is lost.
So change these comments to code when sets NFS_LOCK_LOST.

One case is when lock recovery after apparent server restart fails with NFS4ERR_DENIED, NFS4ERR_RECLAIM_BAD, or NFS4ERRO_RECLAIM_CONFLICT. The other case is when a lock attempt as part of lease recovery fails with NFS4ERR_DENIED.

In an ideal world, these should not happen. However I have a packet trace showing an NFSv4.1 session getting NFS4ERR_BADSESSION after an extended network parition. The NFSv4.1 client treats this like server reboot until/unless it get NFS4ERR_NO_GRACE, in which case it switches over to "nograce" recovery mode. In this network trace, the client attempts to recover a lock and the server (incorrectly) reports NFS4ERR_DENIED rather than NFS4ERR_NO_GRACE. This leads to the ineffective comment and the client then continues to write using the OPEN stateid.

---
 fs/nfs/nfs4proc.c  | 12 ++++++++----
 fs/nfs/nfs4state.c |  5 ++++-
 2 files changed, 12 insertions(+), 5 deletions(-)
fs/nfs/nfs4proc.c +8 -4
index 2241d52710f7..ae8f43d270d6 100644
@@ -1885,7 +1885,7 @@ static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *sta
 	return ret;
 }
 
-static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct nfs4_state *state, const nfs4_stateid *stateid, int err)
+static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct nfs4_state *state, const nfs4_stateid *stateid, struct file_lock *fl, int err)
 {
 	switch (err) {
 		default:
@@ -1932,7 +1932,11 @@ static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct
 			return -EAGAIN;
 		case -ENOMEM:
 		case -NFS4ERR_DENIED:
-			/* kill_proc(fl->fl_pid, SIGLOST, 1); */
+			if (fl) {
+				struct nfs4_lock_state *lsp = fl->fl_u.nfs4_fl.owner;
+				if (lsp)
+					set_bit(NFS_LOCK_LOST, &lsp->ls_flags);
+			}
 			return 0;
 	}
 	return err;
@@ -1968,7 +1972,7 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx,
 		err = nfs4_open_recover_helper(opendata, FMODE_READ);
 	}
 	nfs4_opendata_put(opendata);
-	return nfs4_handle_delegation_recall_error(server, state, stateid, err);
+	return nfs4_handle_delegation_recall_error(server, state, stateid, NULL, err);
 }
 
 static void nfs4_open_confirm_prepare(struct rpc_task *task, void *calldata)
@@ -6595,7 +6599,7 @@ int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state,
 	if (err != 0)
 		return err;
 	err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW);
-	return nfs4_handle_delegation_recall_error(server, state, stateid, err);
+	return nfs4_handle_delegation_recall_error(server, state, stateid, fl, err);
 }
 
 struct nfs_release_lockowner_data {
fs/nfs/nfs4state.c +4 -1
index 0378e2257ca7..45873ed92057 100644
@@ -1447,6 +1447,7 @@ static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_
 	struct inode *inode = state->inode;
 	struct nfs_inode *nfsi = NFS_I(inode);
 	struct file_lock *fl;
+	struct nfs4_lock_state *lsp;
 	int status = 0;
 	struct file_lock_context *flctx = inode->i_flctx;
 	struct list_head *list;
@@ -1487,7 +1488,9 @@ restart:
 		case -NFS4ERR_DENIED:
 		case -NFS4ERR_RECLAIM_BAD:
 		case -NFS4ERR_RECLAIM_CONFLICT:
-			/* kill_proc(fl->fl_pid, SIGLOST, 1); */
+			lsp = fl->fl_u.nfs4_fl.owner;
+			if (lsp)
+				set_bit(NFS_LOCK_LOST, &lsp->ls_flags);
 			status = 0;
 		}
 		spin_lock(&flctx->flc_lock);
Signature · 1 line
2.15.1
#3 lore raw

PATCH 4/161 ACPI / LPSS: Do not instiate platform_dev for devs without MMIO resources

In reply to Sasha Levin

From: Hans de Goede <[email protected]>

[ Upstream commit e1681599345b8466786b6e54a2db2a00a068a3f3 ]

acpi_lpss_create_device() skips handling LPSS devices which do not have a mmio resources in their resource list (typically these devices are disabled by the firmware). But since the LPSS code does not bind to the device, acpi_bus_attach() ends up still creating a platform device for it and the regular platform_driver for the ACPI HID still tries to bind to it.

This happens e.g. on some boards which do not use the pwm-controller and have an empty or invalid resource-table for it. Currently this causes these error messages to get logged:

[    3.281966] pwm-lpss 80862288:00: invalid resource
[    3.287098] pwm-lpss: probe of 80862288:00 failed with error -22

This commit stops the undesirable creation of a platform_device for disabled LPSS devices by setting pnp.type.platform_id to 0. Note that acpi_scan_attach_handler() also sets pnp.type.platform_id to 0 when there is a matching handler for the device and that handler has no attach callback, so we simply behave as a handler without an attach function in this case.

---
 drivers/acpi/acpi_lpss.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/acpi_lpss.c +2 -0
index 032ae44710e5..a2be3fd2c72b 100644
@@ -465,6 +465,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
 	acpi_dev_free_resource_list(&resource_list);
 
 	if (!pdata->mmio_base) {
+		/* Avoid acpi_bus_attach() instantiating a pdev for this dev. */
+		adev->pnp.type.platform_id = 0;
 		/* Skip the device, but continue the namespace scan. */
 		ret = 0;
 		goto err_out;
Signature · 1 line
2.15.1
#4 lore raw

PATCH 5/161 ALSA: hda - Use IS_REACHABLE() for dependency on input

In reply to Sasha Levin

From: Takashi Iwai <[email protected]>

[ Upstream commit c469652bb5e8fb715db7d152f46d33b3740c9b87 ]

The commit ffcd28d88e4f ("ALSA: hda - Select INPUT for Realtek HD-audio codec") introduced the reverse-selection of CONFIG_INPUT for Realtek codec in order to avoid the mess with dependency between built-in and modules. Later on, we obtained IS_REACHABLE() macro exactly for this kind of problems, and now we can remove th INPUT selection in Kconfig and put IS_REACHABLE(INPUT) to the appropriate places in the code, so that the driver doesn't need to select other subsystem forcibly.

Fixes ffcd28d88e4f ("ALSA: hda - Select INPUT for Realtek HD-audio codec")
---
 sound/pci/hda/Kconfig         | 1 -
 sound/pci/hda/patch_realtek.c | 5 +++++
 2 files changed, 5 insertions(+), 1 deletion(-)
sound/pci/hda/Kconfig +0 -1
index 7f3b5ed81995..f7a492c382d9 100644
@@ -88,7 +88,6 @@ config SND_HDA_PATCH_LOADER
 config SND_HDA_CODEC_REALTEK
 	tristate "Build Realtek HD-audio codec support"
 	select SND_HDA_GENERIC
-	select INPUT
 	help
 	  Say Y or M here to include Realtek HD-audio codec support in
 	  snd-hda-intel driver, such as ALC880.
sound/pci/hda/patch_realtek.c +5 -0
index e44a9758f2eb..0cf552a0d5c5 100644
@@ -3721,6 +3721,7 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
 	}
 }
 
+#if IS_REACHABLE(INPUT)
 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
 				   struct hda_jack_callback *event)
 {
@@ -3853,6 +3854,10 @@ static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
 		spec->kb_dev = NULL;
 	}
 }
+#else /* INPUT */
+#define alc280_fixup_hp_gpio2_mic_hotkey	NULL
+#define alc233_fixup_lenovo_line2_mic_hotkey	NULL
+#endif /* INPUT */
 
 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
 				const struct hda_fixup *fix, int action)
Signature · 1 line
2.15.1
#5 lore raw

PATCH 6/161 ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read()

In reply to Sasha Levin

From: Dan Carpenter <[email protected]>

[ Upstream commit 123af9043e93cb6f235207d260d50f832cdb5439 ]

The loop timeout doesn't work because it's a post op and ends with "tmo" set to -1. I changed it from a post-op to a pre-op and I changed the initial the starting value from 5 to 6 so we still iterate 5 times. I left the other as it was because it's a large number.

Fixes b3c70c9ea62a ("ASoC: Alchemy AC97C/I2SC audio support")
---
 sound/soc/au1x/ac97c.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/au1x/ac97c.c +3 -3
index 29a97d52e8ad..66d6c52e7761 100644
@@ -91,8 +91,8 @@ static unsigned short au1xac97c_ac97_read(struct snd_ac97 *ac97,
 	do {
 		mutex_lock(&ctx->lock);
 
-		tmo = 5;
-		while ((RD(ctx, AC97_STATUS) & STAT_CP) && tmo--)
+		tmo = 6;
+		while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo)
 			udelay(21);	/* wait an ac97 frame time */
 		if (!tmo) {
 			pr_debug("ac97rd timeout #1\n");
@@ -105,7 +105,7 @@ static unsigned short au1xac97c_ac97_read(struct snd_ac97 *ac97,
 		 * poll, Forrest, poll...
 		 */
 		tmo = 0x10000;
-		while ((RD(ctx, AC97_STATUS) & STAT_CP) && tmo--)
+		while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo)
 			asm volatile ("nop");
 		data = RD(ctx, AC97_CMDRESP);
 
Signature · 1 line
2.15.1
#6 lore raw

PATCH 7/161 kvm: x86: fix KVM_XEN_HVM_CONFIG ioctl

In reply to Sasha Levin

From: Paolo Bonzini <[email protected]>

[ Upstream commit 51776043afa415435c7e4636204fbe4f7edc4501 ]

This ioctl is obsolete (it was used by Xenner as far as I know) but still let's not break it gratuitously... Its handler is copying directly into struct kvm. Go through a bounce buffer instead, with the added benefit that we can actually do something useful with the flags argument---the previous code was exiting with -EINVAL but still doing the copy.

This technically is a userspace ABI breakage, but since no one should be using the ioctl, it's a good occasion to see if someone actually complains.

---
 arch/x86/kvm/x86.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +4 -3
index b9afb4784d12..d7728bcd9a3c 100644
@@ -4225,13 +4225,14 @@ long kvm_arch_vm_ioctl(struct file *filp,
 		mutex_unlock(&kvm->lock);
 		break;
 	case KVM_XEN_HVM_CONFIG: {
+		struct kvm_xen_hvm_config xhc;
 		r = -EFAULT;
-		if (copy_from_user(&kvm->arch.xen_hvm_config, argp,
-				   sizeof(struct kvm_xen_hvm_config)))
+		if (copy_from_user(&xhc, argp, sizeof(xhc)))
 			goto out;
 		r = -EINVAL;
-		if (kvm->arch.xen_hvm_config.flags)
+		if (xhc.flags)
 			goto out;
+		memcpy(&kvm->arch.xen_hvm_config, &xhc, sizeof(xhc));
 		r = 0;
 		break;
 	}
Signature · 1 line
2.15.1
#7 lore raw

PATCH 8/161 RDMA/core: Clarify rdma_ah_find_type

In reply to Sasha Levin

From: Parav Pandit <[email protected]>

[ Upstream commit a6532e7139660c103dda181aa5b2c734aa26ed6c ]

iWARP does not use rdma_ah_attr_type, and for this reason we do not have a RDMA_AH_ATTR_TYPE_IWARP. rdma_ah_find_type should not even be called on iwarp ports and for clarity it shouldn't have a special test for iWarp.

This changes the result from RDMA_AH_ATTR_TYPE_ROCE to RDMA_AH_ATTR_TYPE_IB when wrongly called on an iWarp port.

Fixes 44c58487d51a ("IB/core: Define 'ib' and 'roce' rdma_ah_attr types")
---
 include/rdma/ib_verbs.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/rdma/ib_verbs.h +1 -2
index 6533aa64f009..a9fae49a1883 100644
@@ -3766,8 +3766,7 @@ static inline void rdma_ah_set_grh(struct rdma_ah_attr *attr,
 static inline enum rdma_ah_attr_type rdma_ah_find_type(struct ib_device *dev,
 						       u32 port_num)
 {
-	if ((rdma_protocol_roce(dev, port_num)) ||
-	    (rdma_protocol_iwarp(dev, port_num)))
+	if (rdma_protocol_roce(dev, port_num))
 		return RDMA_AH_ATTR_TYPE_ROCE;
 	else if ((rdma_protocol_ib(dev, port_num)) &&
 		 (rdma_cap_opa_ah(dev, port_num)))
Signature · 1 line
2.15.1
#8 lore raw

PATCH 9/161 KVM: PPC: Book3S HV: Enable migration of decrementer register

In reply to Sasha Levin

From: Paul Mackerras <[email protected]>

[ Upstream commit 5855564c8ab2d9cefca7b2933bd19818eb795e40 ]

This adds a register identifier for use with the one_reg interface to allow the decrementer expiry time to be read and written by userspace. The decrementer expiry time is in guest timebase units and is equal to the sum of the decrementer and the guest timebase. (The expiry time is used rather than the decrementer value itself because the expiry time is not constantly changing, though the decrementer value is, while the guest vcpu is not running.)

Without this, a guest vcpu migrated to a new host will see its decrementer set to some random value. On POWER8 and earlier, the decrementer is 32 bits wide and counts down at 512MHz, so the guest vcpu will potentially see no decrementer interrupts for up to about 4 seconds, which will lead to a stall. With POWER9, the decrementer is now 56 bits side, so the stall can be much longer (up to 2.23 years) and more noticeable.

To help work around the problem in cases where userspace has not been updated to migrate the decrementer expiry time, we now set the default decrementer expiry at vcpu creation time to the current time rather than the maximum possible value. This should mean an immediate decrementer interrupt when a migrated vcpu starts running. In cases where the decrementer is 32 bits wide and more than 4 seconds elapse between the creation of the vcpu and when it first runs, the decrementer would have wrapped around to positive values and there may still be a stall - but this is no worse than the current situation. In the large-decrementer case, we are sure to get an immediate decrementer interrupt (assuming the time from vcpu creation to first run is less than 2.23 years) and we thus avoid a very long stall.

---
 Documentation/virtual/kvm/api.txt   | 1 +
 arch/powerpc/include/uapi/asm/kvm.h | 2 ++
 arch/powerpc/kvm/book3s_hv.c        | 8 ++++++++
 arch/powerpc/kvm/powerpc.c          | 2 +-
 4 files changed, 12 insertions(+), 1 deletion(-)
Documentation/virtual/kvm/api.txt +1 -0
index e63a35fafef0..0f9089416b4c 100644
@@ -1837,6 +1837,7 @@ registers, find a list below:
   PPC	| KVM_REG_PPC_DBSR              | 32
   PPC   | KVM_REG_PPC_TIDR              | 64
   PPC   | KVM_REG_PPC_PSSCR             | 64
+  PPC   | KVM_REG_PPC_DEC_EXPIRY        | 64
   PPC   | KVM_REG_PPC_TM_GPR0           | 64
           ...
   PPC   | KVM_REG_PPC_TM_GPR31          | 64
arch/powerpc/include/uapi/asm/kvm.h +2 -0
index 61d6049f4c1e..8aaec831053a 100644
@@ -607,6 +607,8 @@ struct kvm_ppc_rmmu_info {
 #define KVM_REG_PPC_TIDR	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbc)
 #define KVM_REG_PPC_PSSCR	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbd)
 
+#define KVM_REG_PPC_DEC_EXPIRY	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbe)
+
 /* Transactional Memory checkpointed state:
  * This is all GPRs, all VSX regs and a subset of SPRs
  */
arch/powerpc/kvm/book3s_hv.c +8 -0
index f48e3379a18a..e094dc90ff1b 100644
@@ -1497,6 +1497,10 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
 	case KVM_REG_PPC_ARCH_COMPAT:
 		*val = get_reg_val(id, vcpu->arch.vcore->arch_compat);
 		break;
+	case KVM_REG_PPC_DEC_EXPIRY:
+		*val = get_reg_val(id, vcpu->arch.dec_expires +
+				   vcpu->arch.vcore->tb_offset);
+		break;
 	default:
 		r = -EINVAL;
 		break;
@@ -1724,6 +1728,10 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
 	case KVM_REG_PPC_ARCH_COMPAT:
 		r = kvmppc_set_arch_compat(vcpu, set_reg_val(id, *val));
 		break;
+	case KVM_REG_PPC_DEC_EXPIRY:
+		vcpu->arch.dec_expires = set_reg_val(id, *val) -
+			vcpu->arch.vcore->tb_offset;
+		break;
 	default:
 		r = -EINVAL;
 		break;
arch/powerpc/kvm/powerpc.c +1 -1
index 2b02d51d14d8..ecb45361095b 100644
@@ -758,7 +758,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
 
 	hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
 	vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup;
-	vcpu->arch.dec_expires = ~(u64)0;
+	vcpu->arch.dec_expires = get_tb();
 
 #ifdef CONFIG_KVM_EXIT_TIMING
 	mutex_init(&vcpu->arch.exit_timing_lock);
Signature · 1 line
2.15.1
#9 lore raw

PATCH 10/161 netfilter: ipv6: nf_defrag: Pass on packets to stack per RFC2460

In reply to Sasha Levin

From: Subash Abhinov Kasiviswanathan <[email protected]>

[ Upstream commit 83f1999caeb14e15df205e80d210699951733287 ]

ipv6_defrag pulls network headers before fragment header. In case of an error, the netfilter layer is currently dropping these packets. This results in failure of some IPv6 standards tests which passed on older kernels due to the netfilter framework using cloning.

The test case run here is a check for ICMPv6 error message replies when some invalid IPv6 fragments are sent. This specific test case is listed in https://www.ipv6ready.org/docs/Core_Conformance_Latest.pdf
in the Extension Header Processing Order section.

A packet with unrecognized option Type 11 is sent and the test expects an ICMP error in line with RFC2460 section 4.2 -

11 - discard the packet and, only if the packet's Destination
Address was not a multicast address, send an ICMP Parameter Problem, Code 2, message to the packet's Source Address, pointing to the unrecognized Option Type.

Since netfilter layer now drops all invalid IPv6 frag packets, we no longer see the ICMP error message and fail the test case.

To fix this, save the transport header. If defrag is unable to process the packet due to RFC2460, restore the transport header and allow packet to be processed by stack. There is no change for other packet processing paths.

Tested by confirming that stack sends an ICMP error when it receives these packets. Also tested that fragmented ICMP pings succeed.

v1->v2: Instead of cloning always, save the transport_header and restore it in case of this specific error. Update the title and commit message accordingly.

---
 net/ipv6/netfilter/nf_conntrack_reasm.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
net/ipv6/netfilter/nf_conntrack_reasm.c +10 -5
index b263bf3a19f7..5edfe66a3d7a 100644
@@ -230,7 +230,7 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb,
 
 	if ((unsigned int)end > IPV6_MAXPLEN) {
 		pr_debug("offset is too large.\n");
-		return -1;
+		return -EINVAL;
 	}
 
 	ecn = ip6_frag_ecn(ipv6_hdr(skb));
@@ -263,7 +263,7 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb,
 			 * this case. -DaveM
 			 */
 			pr_debug("end of fragment not rounded to 8 bytes.\n");
-			return -1;
+			return -EPROTO;
 		}
 		if (end > fq->q.len) {
 			/* Some bits beyond end -> corruption. */
@@ -357,7 +357,7 @@ found:
 discard_fq:
 	inet_frag_kill(&fq->q, &nf_frags);
 err:
-	return -1;
+	return -EINVAL;
 }
 
 /*
@@ -566,6 +566,7 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
 
 int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user)
 {
+	u16 savethdr = skb->transport_header;
 	struct net_device *dev = skb->dev;
 	int fhoff, nhoff, ret;
 	struct frag_hdr *fhdr;
@@ -599,8 +600,12 @@ int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user)
 
 	spin_lock_bh(&fq->q.lock);
 
-	if (nf_ct_frag6_queue(fq, skb, fhdr, nhoff) < 0) {
-		ret = -EINVAL;
+	ret = nf_ct_frag6_queue(fq, skb, fhdr, nhoff);
+	if (ret < 0) {
+		if (ret == -EPROTO) {
+			skb->transport_header = savethdr;
+			ret = 0;
+		}
 		goto out_unlock;
 	}
 
Signature · 1 line
2.15.1
#10 lore raw

PATCH 11/161 tracing/hrtimer: Fix tracing bugs by taking all clock bases and modes into account

In reply to Sasha Levin

From: Anna-Maria Gleixner <[email protected]>

[ Upstream commit 91633eed73a3ac37aaece5c8c1f93a18bae616a9 ]

So far only CLOCK_MONOTONIC and CLOCK_REALTIME were taken into account as well as HRTIMER_MODE_ABS/REL in the hrtimer_init tracepoint. The query for detecting the ABS or REL timer modes is not valid anymore, it got broken by the introduction of HRTIMER_MODE_PINNED.

HRTIMER_MODE_PINNED is not evaluated in the hrtimer_init() call, but for the sake of completeness print all given modes.

---
 include/trace/events/timer.h | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
include/trace/events/timer.h +16 -4
index 16e305e69f34..c6f728037c53 100644
@@ -136,6 +136,20 @@ DEFINE_EVENT(timer_class, timer_cancel,
 	TP_ARGS(timer)
 );
 
+#define decode_clockid(type)						\
+	__print_symbolic(type,						\
+		{ CLOCK_REALTIME,	"CLOCK_REALTIME"	},	\
+		{ CLOCK_MONOTONIC,	"CLOCK_MONOTONIC"	},	\
+		{ CLOCK_BOOTTIME,	"CLOCK_BOOTTIME"	},	\
+		{ CLOCK_TAI,		"CLOCK_TAI"		})
+
+#define decode_hrtimer_mode(mode)					\
+	__print_symbolic(mode,						\
+		{ HRTIMER_MODE_ABS,		"ABS"		},	\
+		{ HRTIMER_MODE_REL,		"REL"		},	\
+		{ HRTIMER_MODE_ABS_PINNED,	"ABS|PINNED"	},	\
+		{ HRTIMER_MODE_REL_PINNED,	"REL|PINNED"	})
+
 /**
  * hrtimer_init - called when the hrtimer is initialized
  * @hrtimer:	pointer to struct hrtimer
@@ -162,10 +176,8 @@ TRACE_EVENT(hrtimer_init,
 	),
 
 	TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer,
-		  __entry->clockid == CLOCK_REALTIME ?
-			"CLOCK_REALTIME" : "CLOCK_MONOTONIC",
-		  __entry->mode == HRTIMER_MODE_ABS ?
-			"HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL")
+		  decode_clockid(__entry->clockid),
+		  decode_hrtimer_mode(__entry->mode))
 );
 
 /**
Signature · 1 line
2.15.1
#11 lore raw

PATCH 12/161 KVM: s390: use created_vcpus in more places

In reply to Sasha Levin

From: Christian Borntraeger <[email protected]>

[ Upstream commit 241e3ec0faf5ab1a0d9b1f6c43eefa919fb9c112 ]

commit a03825bbd0c3 ("KVM: s390: use kvm->created_vcpus") introduced kvm->created_vcpus to avoid races with the existing kvm->online_vcpus scheme. One place was "forgotten" and one new place was "added". Let's fix those.

Fixes 4e0b1ab72b8a ("KVM: s390: gs support for kvm guests")
Fixes a03825bbd0c3 ("KVM: s390: use kvm->created_vcpus")
---
 arch/s390/kvm/kvm-s390.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kvm/kvm-s390.c +2 -2
index 0fa3a788dd20..0bce918db11a 100644
@@ -601,7 +601,7 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap)
 	case KVM_CAP_S390_GS:
 		r = -EINVAL;
 		mutex_lock(&kvm->lock);
-		if (atomic_read(&kvm->online_vcpus)) {
+		if (kvm->created_vcpus) {
 			r = -EBUSY;
 		} else if (test_facility(133)) {
 			set_kvm_facility(kvm->arch.model.fac_mask, 133);
@@ -1121,7 +1121,7 @@ static int kvm_s390_set_processor_feat(struct kvm *kvm,
 		return -EINVAL;
 
 	mutex_lock(&kvm->lock);
-	if (!atomic_read(&kvm->online_vcpus)) {
+	if (!kvm->created_vcpus) {
 		bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat,
 			    KVM_S390_VM_CPU_FEAT_NR_BITS);
 		ret = 0;
Signature · 1 line
2.15.1
#12 lore raw

PATCH 13/161 platform/x86: dell-laptop: Filter out spurious keyboard backlight change events

In reply to Sasha Levin

From: Hans de Goede <[email protected]>

[ Upstream commit 4d6bde512a86c32df3a1f289d2b4cd04b17758d1 ]

On some Dell XPS models WMI events of type 0x0000 reporting a keycode of 0xe00c get reported when the brightness of the LCD panel changes.

This leads to us reporting false-positive kbd_led change events to userspace which in turn leads to the kbd backlight OSD showing when it should not.

We already read the current keyboard backlight brightness value when reporting events because the led_classdev_notify_brightness_hw_changed API requires this. Compare this value to the last known value and filter out duplicate events, fixing this.

Note the fixed issue is esp. a problem on XPS models with an ambient light sensor and automatic brightness adjustments turned on, this causes the kbd backlight OSD to show all the time there.

Fixes 9c656b0799 ("platform/x86: dell-*: Call new led hw_changed API ...")
---
 drivers/platform/x86/dell-laptop.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/platform/x86/dell-laptop.c +22 -2
index 7424e53157b0..dd5043a6a114 100644
@@ -1177,6 +1177,7 @@ static u8 kbd_previous_mode_bit;
 
 static bool kbd_led_present;
 static DEFINE_MUTEX(kbd_led_mutex);
+static enum led_brightness kbd_led_level;
 
 /*
  * NOTE: there are three ways to set the keyboard backlight level.
@@ -2020,6 +2021,7 @@ static enum led_brightness kbd_led_level_get(struct led_classdev *led_cdev)
 static int kbd_led_level_set(struct led_classdev *led_cdev,
 			     enum led_brightness value)
 {
+	enum led_brightness new_value = value;
 	struct kbd_state state;
 	struct kbd_state new_state;
 	u16 num;
@@ -2049,6 +2051,9 @@ static int kbd_led_level_set(struct led_classdev *led_cdev,
 	}
 
 out:
+	if (ret == 0)
+		kbd_led_level = new_value;
+
 	mutex_unlock(&kbd_led_mutex);
 	return ret;
 }
@@ -2076,6 +2081,9 @@ static int __init kbd_led_init(struct device *dev)
 		if (kbd_led.max_brightness)
 			kbd_led.max_brightness--;
 	}
+
+	kbd_led_level = kbd_led_level_get(NULL);
+
 	ret = led_classdev_register(dev, &kbd_led);
 	if (ret)
 		kbd_led_present = false;
@@ -2100,13 +2108,25 @@ static void kbd_led_exit(void)
 static int dell_laptop_notifier_call(struct notifier_block *nb,
 				     unsigned long action, void *data)
 {
+	bool changed = false;
+	enum led_brightness new_kbd_led_level;
+
 	switch (action) {
 	case DELL_LAPTOP_KBD_BACKLIGHT_BRIGHTNESS_CHANGED:
 		if (!kbd_led_present)
 			break;
 
-		led_classdev_notify_brightness_hw_changed(&kbd_led,
-						kbd_led_level_get(&kbd_led));
+		mutex_lock(&kbd_led_mutex);
+		new_kbd_led_level = kbd_led_level_get(&kbd_led);
+		if (kbd_led_level != new_kbd_led_level) {
+			kbd_led_level = new_kbd_led_level;
+			changed = true;
+		}
+		mutex_unlock(&kbd_led_mutex);
+
+		if (changed)
+			led_classdev_notify_brightness_hw_changed(&kbd_led,
+								kbd_led_level);
 		break;
 	}
 
Signature · 1 line
2.15.1
#13 lore raw

PATCH 14/161 xprtrdma: Fix backchannel allocation of extra rpcrdma_reps

In reply to Sasha Levin

From: Chuck Lever <[email protected]>

[ Upstream commit d698c4a02ee02053bbebe051322ff427a2dad56a ]

The backchannel code uses rpcrdma_recv_buffer_put to add new reps to the free rep list. This also decrements rb_recv_count, which spoofs the receive overrun logic in rpcrdma_buffer_get_rep.

Commit 9b06688bc3b9 ("xprtrdma: Fix additional uses of spin_lock_irqsave(rb_lock)") replaced the original open-coded list_add with a call to rpcrdma_recv_buffer_put(), but then a year later, commit 05c974669ece ("xprtrdma: Fix receive buffer accounting") added rep accounting to rpcrdma_recv_buffer_put. It was an oversight to let the backchannel continue to use this function.

The fix this, let's combine the "add to free list" logic with rpcrdma_create_rep.

Also, do not allocate RPCRDMA_MAX_BC_REQUESTS rpcrdma_reps in rpcrdma_buffer_create and then allocate additional rpcrdma_reps in rpcrdma_bc_setup_reps. Allocating the extra reps during backchannel set-up is sufficient.

Fixes 05c974669ece ("xprtrdma: Fix receive buffer accounting")
---
 net/sunrpc/xprtrdma/backchannel.c | 12 ++----------
 net/sunrpc/xprtrdma/verbs.c       | 32 +++++++++++++++++++-------------
 net/sunrpc/xprtrdma/xprt_rdma.h   |  2 +-
 3 files changed, 22 insertions(+), 24 deletions(-)
net/sunrpc/xprtrdma/backchannel.c +2 -10
index 823a781ec89c..25e3602aa41f 100644
@@ -74,21 +74,13 @@ out_fail:
 static int rpcrdma_bc_setup_reps(struct rpcrdma_xprt *r_xprt,
 				 unsigned int count)
 {
-	struct rpcrdma_rep *rep;
 	int rc = 0;
 
 	while (count--) {
-		rep = rpcrdma_create_rep(r_xprt);
-		if (IS_ERR(rep)) {
-			pr_err("RPC:       %s: reply buffer alloc failed\n",
-			       __func__);
-			rc = PTR_ERR(rep);
+		rc = rpcrdma_create_rep(r_xprt);
+		if (rc)
 			break;
-		}
-
-		rpcrdma_recv_buffer_put(rep);
 	}
-
 	return rc;
 }
 
net/sunrpc/xprtrdma/verbs.c +19 -13
index 9e8e1de19b2e..97b9d4f671ac 100644
@@ -951,10 +951,17 @@ rpcrdma_create_req(struct rpcrdma_xprt *r_xprt)
 	return req;
 }
 
-struct rpcrdma_rep *
+/**
+ * rpcrdma_create_rep - Allocate an rpcrdma_rep object
+ * @r_xprt: controlling transport
+ *
+ * Returns 0 on success or a negative errno on failure.
+ */
+int
 rpcrdma_create_rep(struct rpcrdma_xprt *r_xprt)
 {
 	struct rpcrdma_create_data_internal *cdata = &r_xprt->rx_data;
+	struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
 	struct rpcrdma_rep *rep;
 	int rc;
 
@@ -979,12 +986,18 @@ rpcrdma_create_rep(struct rpcrdma_xprt *r_xprt)
 	rep->rr_recv_wr.wr_cqe = &rep->rr_cqe;
 	rep->rr_recv_wr.sg_list = &rep->rr_rdmabuf->rg_iov;
 	rep->rr_recv_wr.num_sge = 1;
-	return rep;
+
+	spin_lock(&buf->rb_lock);
+	list_add(&rep->rr_list, &buf->rb_recv_bufs);
+	spin_unlock(&buf->rb_lock);
+	return 0;
 
 out_free:
 	kfree(rep);
 out:
-	return ERR_PTR(rc);
+	dprintk("RPC:       %s: reply buffer %d alloc failed\n",
+		__func__, rc);
+	return rc;
 }
 
 int
@@ -1027,17 +1040,10 @@ rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt)
 	}
 
 	INIT_LIST_HEAD(&buf->rb_recv_bufs);
-	for (i = 0; i < buf->rb_max_requests + RPCRDMA_MAX_BC_REQUESTS; i++) {
-		struct rpcrdma_rep *rep;
-
-		rep = rpcrdma_create_rep(r_xprt);
-		if (IS_ERR(rep)) {
-			dprintk("RPC:       %s: reply buffer %d alloc failed\n",
-				__func__, i);
-			rc = PTR_ERR(rep);
+	for (i = 0; i <= buf->rb_max_requests; i++) {
+		rc = rpcrdma_create_rep(r_xprt);
+		if (rc)
 			goto out;
-		}
-		list_add(&rep->rr_list, &buf->rb_recv_bufs);
 	}
 
 	return 0;
net/sunrpc/xprtrdma/xprt_rdma.h +1 -1
index e26a97d2f922..fcb0b3227ee1 100644
@@ -550,8 +550,8 @@ int rpcrdma_ep_post_recv(struct rpcrdma_ia *, struct rpcrdma_rep *);
  * Buffer calls - xprtrdma/verbs.c
  */
 struct rpcrdma_req *rpcrdma_create_req(struct rpcrdma_xprt *);
-struct rpcrdma_rep *rpcrdma_create_rep(struct rpcrdma_xprt *);
 void rpcrdma_destroy_req(struct rpcrdma_req *);
+int rpcrdma_create_rep(struct rpcrdma_xprt *r_xprt);
 int rpcrdma_buffer_create(struct rpcrdma_xprt *);
 void rpcrdma_buffer_destroy(struct rpcrdma_buffer *);
 
Signature · 1 line
2.15.1
#14 lore raw

PATCH 15/161 printk: Add console owner and waiter logic to load balance console writes

In reply to Sasha Levin

From: "Steven Rostedt (VMware)" <[email protected]>

[ Upstream commit dbdda842fe96f8932bae554f0adf463c27c42bc7 ]

This patch implements what I discussed in Kernel Summit. I added lockdep annotation (hopefully correctly), and it hasn't had any splats (since I fixed some bugs in the first iterations). It did catch problems when I had the owner covering too much. But now that the owner is only set when actively calling the consoles, lockdep has stayed quiet.

Here's the design again:

I added a "console_owner" which is set to a task that is actively writing to the consoles. It is *not* the same as the owner of the console_lock. It is only set when doing the calls to the console functions. It is protected by a console_owner_lock which is a raw spin lock.

There is a console_waiter. This is set when there is an active console owner that is not current, and waiter is not set. This too is protected by console_owner_lock.

In printk() when it tries to write to the consoles, we have:

	if (console_trylock())
		console_unlock();

Now I added an else, which will check if there is an active owner, and no current waiter. If that is the case, then console_waiter is set, and the task goes into a spin until it is no longer set.

When the active console owner finishes writing the current message to the consoles, it grabs the console_owner_lock and sees if there is a waiter, and clears console_owner.

If there is a waiter, then it breaks out of the loop, clears the waiter flag (because that will release the waiter from its spin), and exits. Note, it does *not* release the console semaphore. Because it is a semaphore, there is no owner. Another task may release it. This means that the waiter is guaranteed to be the new console owner! Which it becomes.

Then the waiter calls console_unlock() and continues to write to the consoles.

If another task comes along and does a printk() it too can become the new waiter, and we wash rinse and repeat!

By Petr Mladek about possible new deadlocks:

The thing is that we move console_sem only to printk() call that normally calls console_unlock() as well. It means that the transferred owner should not bring new type of dependencies. As Steven said somewhere: "If there is a deadlock, it was there even before."

We could look at it from this side. The possible deadlock would look like:

CPU0 CPU1

console_unlock()

  console_owner = current;
				spin_lockA()
				  printk()
				    spin = true;
				    while (...)

    call_console_drivers()
      spin_lockA()

This would be a deadlock. CPU0 would wait for the lock A. While CPU1 would own the lockA and would wait for CPU0 to finish calling the console drivers and pass the console_sem owner.

But if the above is true than the following scenario was already possible before:

CPU0

spin_lockA()
printk()
console_unlock()
call_console_drivers()
spin_lockA()

By other words, this deadlock was there even before. Such deadlocks are prevented by using printk_deferred() in the sections guarded by the lock A.

By Steven Rostedt:

To demonstrate the issue, this module has been shown to lock up a system with 4 CPUs and a slow console (like a serial console). It is also able to lock up a 8 CPU system with only a fast (VGA) console, by passing in "loops=100". The changes in this commit prevent this module from locking up the system.

#include <linux/module.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>
#include <linux/hrtimer.h>

static bool stop_testing;
static unsigned int loops = 1;

static void preempt_printk_workfn(struct work_struct *work) {
int i;

while (!READ_ONCE(stop_testing)) {
for (i = 0; i < loops && !READ_ONCE(stop_testing); i++) {
preempt_disable(); pr_emerg("%5d%-75s\n", smp_processor_id(),
" XXX NOPREEMPT");
preempt_enable();
}
msleep(1);
}
}

static struct work_struct __percpu *works;

static void finish(void)
{
int cpu;

WRITE_ONCE(stop_testing, true); for_each_online_cpu(cpu)
flush_work(per_cpu_ptr(works, cpu));
free_percpu(works);
}

static int __init test_init(void)
{
int cpu;

works = alloc_percpu(struct work_struct);
if (!works)
return -ENOMEM;

/*
* This is just a test module. This will break if you
* do any CPU hot plugging between loading and
* unloading the module.
*/

for_each_online_cpu(cpu) {
struct work_struct *work = per_cpu_ptr(works, cpu);

INIT_WORK(work, &preempt_printk_workfn); schedule_work_on(cpu, work);
}

return 0;
}

static void __exit test_exit(void)
{
finish();
}

module_param(loops, uint, 0);
module_init(test_init);
module_exit(test_exit);
MODULE_LICENSE("GPL");

Cc Cong Wang <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Jan Kara <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Tetsuo Handa <[email protected]>
Cc Byungchul Park <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Pavel Machek <[email protected]>
[[email protected]: Commit message about possible deadlocks]
---
 kernel/printk/printk.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 107 insertions(+), 1 deletion(-)
kernel/printk/printk.c +107 -1
index 512f7c2baedd..89c3496975cc 100644
@@ -86,8 +86,15 @@ EXPORT_SYMBOL_GPL(console_drivers);
 static struct lockdep_map console_lock_dep_map = {
 	.name = "console_lock"
 };
+static struct lockdep_map console_owner_dep_map = {
+	.name = "console_owner"
+};
 #endif
 
+static DEFINE_RAW_SPINLOCK(console_owner_lock);
+static struct task_struct *console_owner;
+static bool console_waiter;
+
 enum devkmsg_log_bits {
 	__DEVKMSG_LOG_BIT_ON = 0,
 	__DEVKMSG_LOG_BIT_OFF,
@@ -1753,8 +1760,56 @@ asmlinkage int vprintk_emit(int facility, int level,
 		 * semaphore.  The release will print out buffers and wake up
 		 * /dev/kmsg and syslog() users.
 		 */
-		if (console_trylock())
+		if (console_trylock()) {
 			console_unlock();
+		} else {
+			struct task_struct *owner = NULL;
+			bool waiter;
+			bool spin = false;
+
+			printk_safe_enter_irqsave(flags);
+
+			raw_spin_lock(&console_owner_lock);
+			owner = READ_ONCE(console_owner);
+			waiter = READ_ONCE(console_waiter);
+			if (!waiter && owner && owner != current) {
+				WRITE_ONCE(console_waiter, true);
+				spin = true;
+			}
+			raw_spin_unlock(&console_owner_lock);
+
+			/*
+			 * If there is an active printk() writing to the
+			 * consoles, instead of having it write our data too,
+			 * see if we can offload that load from the active
+			 * printer, and do some printing ourselves.
+			 * Go into a spin only if there isn't already a waiter
+			 * spinning, and there is an active printer, and
+			 * that active printer isn't us (recursive printk?).
+			 */
+			if (spin) {
+				/* We spin waiting for the owner to release us */
+				spin_acquire(&console_owner_dep_map, 0, 0, _THIS_IP_);
+				/* Owner will clear console_waiter on hand off */
+				while (READ_ONCE(console_waiter))
+					cpu_relax();
+
+				spin_release(&console_owner_dep_map, 1, _THIS_IP_);
+				printk_safe_exit_irqrestore(flags);
+
+				/*
+				 * The owner passed the console lock to us.
+				 * Since we did not spin on console lock, annotate
+				 * this as a trylock. Otherwise lockdep will
+				 * complain.
+				 */
+				mutex_acquire(&console_lock_dep_map, 0, 1, _THIS_IP_);
+				console_unlock();
+				printk_safe_enter_irqsave(flags);
+			}
+			printk_safe_exit_irqrestore(flags);
+
+		}
 	}
 
 	return printed_len;
@@ -2141,6 +2196,7 @@ void console_unlock(void)
 	static u64 seen_seq;
 	unsigned long flags;
 	bool wake_klogd = false;
+	bool waiter = false;
 	bool do_cond_resched, retry;
 
 	if (console_suspended) {
@@ -2229,14 +2285,64 @@ skip:
 		console_seq++;
 		raw_spin_unlock(&logbuf_lock);
 
+		/*
+		 * While actively printing out messages, if another printk()
+		 * were to occur on another CPU, it may wait for this one to
+		 * finish. This task can not be preempted if there is a
+		 * waiter waiting to take over.
+		 */
+		raw_spin_lock(&console_owner_lock);
+		console_owner = current;
+		raw_spin_unlock(&console_owner_lock);
+
+		/* The waiter may spin on us after setting console_owner */
+		spin_acquire(&console_owner_dep_map, 0, 0, _THIS_IP_);
+
 		stop_critical_timings();	/* don't trace print latency */
 		call_console_drivers(ext_text, ext_len, text, len);
 		start_critical_timings();
+
+		raw_spin_lock(&console_owner_lock);
+		waiter = READ_ONCE(console_waiter);
+		console_owner = NULL;
+		raw_spin_unlock(&console_owner_lock);
+
+		/*
+		 * If there is a waiter waiting for us, then pass the
+		 * rest of the work load over to that waiter.
+		 */
+		if (waiter)
+			break;
+
+		/* There was no waiter, and nothing will spin on us here */
+		spin_release(&console_owner_dep_map, 1, _THIS_IP_);
+
 		printk_safe_exit_irqrestore(flags);
 
 		if (do_cond_resched)
 			cond_resched();
 	}
+
+	/*
+	 * If there is an active waiter waiting on the console_lock.
+	 * Pass off the printing to the waiter, and the waiter
+	 * will continue printing on its CPU, and when all writing
+	 * has finished, the last printer will wake up klogd.
+	 */
+	if (waiter) {
+		WRITE_ONCE(console_waiter, false);
+		/* The waiter is now free to continue */
+		spin_release(&console_owner_dep_map, 1, _THIS_IP_);
+		/*
+		 * Hand off console_lock to waiter. The waiter will perform
+		 * the up(). After this, the waiter is the console_lock owner.
+		 */
+		mutex_release(&console_lock_dep_map, 1, _THIS_IP_);
+		printk_safe_exit_irqrestore(flags);
+		/* Note, if waiter is set, logbuf_lock is not held */
+		return;
+	}
+
 	console_locked = 0;
 
 	/* Release the exclusive_console once it is used */
Signature · 1 line
2.15.1
#15 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 10 lines · Sasha Levin

From: "Steven Rostedt (VMware)" <[email protected]>

[ Upstream commit dbdda842fe96f8932bae554f0adf463c27c42bc7 ]

This patch implements what I discussed in Kernel Summit. I added lockdep annotation (hopefully correctly), and it hasn't had any splats (since I fixed some bugs in the first iterations). It did catch problems when I had the owner covering too much. But now that the owner is only set when actively calling the consoles, lockdep has stayed quiet.

Same here. I do not thing that this is a material for stable backport. More details can be found in my reply to the patch for 4.15, see
https://lkml.kernel.org/r/[email protected]

Best Regards,
Petr

PS: I wonder how much time you give people to react before releasing this. The number of autosel mails is increasing and I am involved only in very small amount of them. I wonder if some other people gets overwhelmed by this.

#16 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 4 lines · Petr Mladek

PS: I wonder how much time you give people to react before releasing this. The number of autosel mails is increasing and I am involved only in very small amount of them. I wonder if some other people gets overwhelmed by this.

My review cycle gives at least a week, and there's usually another week until Greg releases them.

I know it's a lot of mails, but in reality it's a lot of commits that should go in -stable.

Would a different format for review would make it easier?

#17 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 6 lines · On Sun, 15 Apr 2018 14:42:51 +0000 Sasha Levin <[email protected]>…
Quoted 4 lines · Petr Mladek

PS: I wonder how much time you give people to react before releasing this. The number of autosel mails is increasing and I am involved only in very small amount of them. I wonder if some other people gets overwhelmed by this.

Quoted 7 lines

My review cycle gives at least a week, and there's usually another week until Greg releases them.

I know it's a lot of mails, but in reality it's a lot of commits that should go in -stable.

Would a different format for review would make it easier?

I wonder if the "AUTOSEL" patches should at least have an "ack-by" from someone before they are pulled in. Otherwise there may be some subtle issues that can find their way into stable releases.

-- Steve

#18 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 4 lines · Steven Rostedt

I wonder if the "AUTOSEL" patches should at least have an "ack-by" from someone before they are pulled in. Otherwise there may be some subtle issues that can find their way into stable releases.

I don't know about anybody else, but I get so many of the patch-bot patches for stable etc that I will *not* reply to normal cases. Only if there's some issue with a patch will I reply.

I probably do get more than most, but still - requiring active participation for the steady flow of normal stable patches is almost pointless.

Just look at the subject line of this thread. The numbers are so big that you almost need exponential notation for them.

Linus

#19 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 10 lines · Linus Torvalds
Quoted 4 lines · Steven Rostedt

I wonder if the "AUTOSEL" patches should at least have an "ack-by" from someone before they are pulled in. Otherwise there may be some subtle issues that can find their way into stable releases.

I don't know about anybody else, but I get so many of the patch-bot patches for stable etc that I will *not* reply to normal cases. Only if there's some issue with a patch will I reply.

Quoted 6 lines

I probably do get more than most, but still - requiring active participation for the steady flow of normal stable patches is almost pointless.

Just look at the subject line of this thread. The numbers are so big that you almost need exponential notation for them.

Question is if we need that many stable patches? Autosel seems to be picking up race conditions in LED state and W+X page fixes... I'd really like to see less stable patches.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#20 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 15 lines · Pavel Machek
Quoted 14 lines · Linus Torvalds
Quoted 4 lines · Steven Rostedt

I wonder if the "AUTOSEL" patches should at least have an "ack-by" from someone before they are pulled in. Otherwise there may be some subtle issues that can find their way into stable releases.

I don't know about anybody else, but I get so many of the patch-bot patches for stable etc that I will *not* reply to normal cases. Only if there's some issue with a patch will I reply.

I probably do get more than most, but still - requiring active participation for the steady flow of normal stable patches is almost pointless.

Quoted 6 lines
Quoted 2 lines

Just look at the subject line of this thread. The numbers are so big that you almost need exponential notation for them.

Question is if we need that many stable patches? Autosel seems to be picking up race conditions in LED state and W+X page fixes... I'd really like to see less stable patches.

Why? Given that the kernel keeps seeing more and more lines of code in each new release, tools around the kernel keep evolving (new fuzzers, testing suites, etc), and code gets more eyes, this guarantees that you'll see more and more stable patches for each release as well.

Is there a reason not to take LED fixes if they fix a bug and don't cause a regression? Sure, we can draw some arbitrary line, maybe designate some subsystems that are more "important" than others, but what's the point?

#21 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 28 lines · Sasha Levin
Quoted 15 lines · Pavel Machek
Quoted 14 lines · Linus Torvalds
Quoted 4 lines · Steven Rostedt

I wonder if the "AUTOSEL" patches should at least have an "ack-by" from someone before they are pulled in. Otherwise there may be some subtle issues that can find their way into stable releases.

I don't know about anybody else, but I get so many of the patch-bot patches for stable etc that I will *not* reply to normal cases. Only if there's some issue with a patch will I reply.

I probably do get more than most, but still - requiring active participation for the steady flow of normal stable patches is almost pointless.

Quoted 6 lines
Quoted 2 lines

Just look at the subject line of this thread. The numbers are so big that you almost need exponential notation for them.

Question is if we need that many stable patches? Autosel seems to be picking up race conditions in LED state and W+X page fixes... I'd really like to see less stable patches.

Why? Given that the kernel keeps seeing more and more lines of code in each new release, tools around the kernel keep evolving (new fuzzers, testing suites, etc), and code gets more eyes, this guarantees that you'll see more and more stable patches for each release as well.

Quoted 4 lines

Is there a reason not to take LED fixes if they fix a bug and don't cause a regression? Sure, we can draw some arbitrary line, maybe designate some subsystems that are more "important" than others, but what's the point?

There's a tradeoff.

You want to fix serious bugs in stable, and you really don't want regressions in stable. And ... stable not having 1000s of patches would be nice, too.

That means you want to ignore not-so-serious bugs, because benefit of fixing them is lower than risk of the regressions. I believe bugs that do not bother anyone should _not_ be fixed in stable.

That was case of the LED patch. Yes, the commit fixed bug, but it introduced regressions that were fixed by subsequent patches.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#22 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 34 lines · Pavel Machek
Quoted 28 lines · Sasha Levin
Quoted 15 lines · Pavel Machek
Quoted 14 lines · Linus Torvalds
Quoted 4 lines · Steven Rostedt

I wonder if the "AUTOSEL" patches should at least have an "ack-by" from someone before they are pulled in. Otherwise there may be some subtle issues that can find their way into stable releases.

I don't know about anybody else, but I get so many of the patch-bot patches for stable etc that I will *not* reply to normal cases. Only if there's some issue with a patch will I reply.

I probably do get more than most, but still - requiring active participation for the steady flow of normal stable patches is almost pointless.

Quoted 6 lines
Quoted 2 lines

Just look at the subject line of this thread. The numbers are so big that you almost need exponential notation for them.

Question is if we need that many stable patches? Autosel seems to be picking up race conditions in LED state and W+X page fixes... I'd really like to see less stable patches.

Why? Given that the kernel keeps seeing more and more lines of code in each new release, tools around the kernel keep evolving (new fuzzers, testing suites, etc), and code gets more eyes, this guarantees that you'll see more and more stable patches for each release as well.

Quoted 4 lines

Is there a reason not to take LED fixes if they fix a bug and don't cause a regression? Sure, we can draw some arbitrary line, maybe designate some subsystems that are more "important" than others, but what's the point?

Quoted 5 lines

There's a tradeoff.

You want to fix serious bugs in stable, and you really don't want regressions in stable. And ... stable not having 1000s of patches would be nice, too.

I don't think we should use a number cap here, but rather look at the regression rate: how many patches broke something?

Since the rate we're seeing now with AUTOSEL is similar to what we were seeing before AUTOSEL, what's the problem it's causing?

Quoted 6 lines

That means you want to ignore not-so-serious bugs, because benefit of fixing them is lower than risk of the regressions. I believe bugs that do not bother anyone should _not_ be fixed in stable.

That was case of the LED patch. Yes, the commit fixed bug, but it introduced regressions that were fixed by subsequent patches.

How do you know if a bug bothers someone?

If a user is annoyed by a LED issue, is he expected to triage the bug, report it on LKML and patiently wait for the appropriate patch to be backported?

#23 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 2 lines · On Mon, 16 Apr 2018 16:14:15 +0000 Sasha Levin <[email protected]>…

Since the rate we're seeing now with AUTOSEL is similar to what we were seeing before AUTOSEL, what's the problem it's causing?

Does that mean we just doubled the rate of regressions? That's the problem.

Quoted 6 lines

How do you know if a bug bothers someone?

If a user is annoyed by a LED issue, is he expected to triage the bug, report it on LKML and patiently wait for the appropriate patch to be backported?

Yes.

-- Steve

#24 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 8 lines · Steven Rostedt
Quoted 2 lines · On Mon, 16 Apr 2018 16:14:15 +0000 Sasha Levin <[email protected]>…

Since the rate we're seeing now with AUTOSEL is similar to what we were seeing before AUTOSEL, what's the problem it's causing?

Does that mean we just doubled the rate of regressions? That's the problem.

No, the rate stayed the same :)

If before ~2% of stable commits were buggy, this is still the case with AUTOSEL.

Quoted 8 lines
Quoted 6 lines

How do you know if a bug bothers someone?

If a user is annoyed by a LED issue, is he expected to triage the bug, report it on LKML and patiently wait for the appropriate patch to be backported?

Yes.

I'm honestly not sure how to respond.

Let me ask my wife (who is happy using Linux as a regular desktop user) how comfortable she would be with triaging kernel bugs...

#25 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 7 lines · On Mon, 16 Apr 2018 16:31:09 +0000 Sasha Levin <[email protected]>…
Quoted 6 lines · Steven Rostedt
Quoted 2 lines · On Mon, 16 Apr 2018 16:14:15 +0000 Sasha Levin <[email protected]>…

Since the rate we're seeing now with AUTOSEL is similar to what we were seeing before AUTOSEL, what's the problem it's causing?

Quoted 7 lines
Quoted 2 lines

Does that mean we just doubled the rate of regressions? That's the problem.

No, the rate stayed the same :)

If before ~2% of stable commits were buggy, this is still the case with AUTOSEL.

Sorry, I didn't mean "rate" I meant "number". If the rate stayed the same, that means the number increased.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

How do you know if a bug bothers someone?

If a user is annoyed by a LED issue, is he expected to triage the bug, report it on LKML and patiently wait for the appropriate patch to be backported?

Quoted 6 lines
Quoted 1 line

Yes.

I'm honestly not sure how to respond.

Let me ask my wife (who is happy using Linux as a regular desktop user) how comfortable she would be with triaging kernel bugs...

That's really up to the distribution, not the main kernel stable. Does she download and compile the kernels herself? Does she use LEDs?

The point is, stable is to keep what was working continued working. If we don't care about introducing a regression, and just want to keep regressions the same as mainline, why not just go to mainline? That way you can also get the new features? Mainline already has the mantra to not break user space. When I work on new features, I sometimes stumble on bugs with the current features. And some of those fixes require a rewrite. It was "good enough" before, but every so often could cause a bug that the new feature would trigger more often. Do we back port that rewrite? Do we backport fixes to old code that are more likely to be triggered by new features?

Ideally, we should be working on getting to no regressions to stable.

-- Steve

#26 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 13 lines · Steven Rostedt
Quoted 10 lines · On Mon, 16 Apr 2018 16:31:09 +0000 Sasha Levin <[email protected]>…
Quoted 8 lines · Steven Rostedt
Quoted 2 lines · On Mon, 16 Apr 2018 16:14:15 +0000 Sasha Levin <[email protected]>…

Since the rate we're seeing now with AUTOSEL is similar to what we were seeing before AUTOSEL, what's the problem it's causing?

Does that mean we just doubled the rate of regressions? That's the problem.

Quoted 7 lines
Quoted 4 lines

No, the rate stayed the same :)

If before ~2% of stable commits were buggy, this is still the case with AUTOSEL.

Sorry, I didn't mean "rate" I meant "number". If the rate stayed the same, that means the number increased.

Indeed, just like the number of regressions in mainline has increased over time.

Quoted 29 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

How do you know if a bug bothers someone?

If a user is annoyed by a LED issue, is he expected to triage the bug, report it on LKML and patiently wait for the appropriate patch to be backported?

Quoted 6 lines
Quoted 1 line

Yes.

I'm honestly not sure how to respond.

Let me ask my wife (who is happy using Linux as a regular desktop user) how comfortable she would be with triaging kernel bugs...

That's really up to the distribution, not the main kernel stable. Does she download and compile the kernels herself? Does she use LEDs?

The point is, stable is to keep what was working continued working. If we don't care about introducing a regression, and just want to keep regressions the same as mainline, why not just go to mainline? That way you can also get the new features? Mainline already has the mantra to not break user space. When I work on new features, I sometimes stumble on bugs with the current features. And some of those fixes require a rewrite. It was "good enough" before, but every so often could cause a bug that the new feature would trigger more often. Do we back port that rewrite? Do we backport fixes to old code that are more likely to be triggered by new features?

Quoted 1 line

Ideally, we should be working on getting to no regressions to stable.

This is exactly what we're doing.

If a fix for a bug in -stable introduces a different regression, should we take it or not?

#27 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Hi!

Quoted 17 lines
Quoted 17 lines
Quoted 2 lines

Let me ask my wife (who is happy using Linux as a regular desktop user) how comfortable she would be with triaging kernel bugs...

That's really up to the distribution, not the main kernel stable. Does she download and compile the kernels herself? Does she use LEDs?

The point is, stable is to keep what was working continued working. If we don't care about introducing a regression, and just want to keep regressions the same as mainline, why not just go to mainline? That way you can also get the new features? Mainline already has the mantra to not break user space. When I work on new features, I sometimes stumble on bugs with the current features. And some of those fixes require a rewrite. It was "good enough" before, but every so often could cause a bug that the new feature would trigger more often. Do we back port that rewrite? Do we backport fixes to old code that are more likely to be triggered by new features?

Quoted 6 lines
Quoted 1 line

Ideally, we should be working on getting to no regressions to stable.

This is exactly what we're doing.

If a fix for a bug in -stable introduces a different regression, should we take it or not?

If a fix for bug introduces regression, would you call it "obviously correct"?

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#28 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 21 lines · Pavel Machek

Hi!

Quoted 19 lines
Quoted 18 lines
Quoted 2 lines

Let me ask my wife (who is happy using Linux as a regular desktop user) how comfortable she would be with triaging kernel bugs...

That's really up to the distribution, not the main kernel stable. Does she download and compile the kernels herself? Does she use LEDs?

The point is, stable is to keep what was working continued working. If we don't care about introducing a regression, and just want to keep regressions the same as mainline, why not just go to mainline? That way you can also get the new features? Mainline already has the mantra to not break user space. When I work on new features, I sometimes stumble on bugs with the current features. And some of those fixes require a rewrite. It was "good enough" before, but every so often could cause a bug that the new feature would trigger more often. Do we back port that rewrite? Do we backport fixes to old code that are more likely to be triggered by new features?

Ideally, we should be working on getting to no regressions to stable.

Quoted 7 lines
Quoted 4 lines

This is exactly what we're doing.

If a fix for a bug in -stable introduces a different regression, should we take it or not?

If a fix for bug introduces regression, would you call it "obviously correct"?

I honestly can't believe you all are arguing about this. We backport bugfixes to the stable tree. If those fixes also are buggy we either apply the fix for that problem that ended up in Linus's tree, or we revert the patch. If the fix is not in Linus's tree, sometimes we leave the "bug" in stable for a bit to apply some pressure on the developer/maintainer to get it fixed in Linus's tree (that's what I mean by being "bug compatible".)

This is exactly what we have been doing for over a decade now, why are people suddenly getting upset?

Oh, I know why, suddenly subsystems that never were taking the time to mark patches for stable are getting patches backported and are getting nervous. The simple way to stop that from happening is to PROPERLY MARK PATCHES FOR STABLE IN THE FIRST PLACE!

If you do that, then, no "automated" patches will get selected as you already handled them all. Or if there are some automated patches picked, you can easily NAK them (like xfs does as they know better than everyone else, and honestly, I trust them, and don't run xfs myself), or do like what I do when it happens to me and go "hey, nice, I missed that one!"

There, problem solved, if you do that, no more worrying by you at all, and this thread can properly die.

ugh,

greg k-h

#29 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 3 lines · Greg KH

Oh, I know why, suddenly subsystems that never were taking the time to mark patches for stable are getting patches backported and are getting nervous.

Yes, I am getting nervous because of this. The number of printk fixes nominated for stable is increasing exponentially (just my feeling) during last few months.

The problem is that I want to be responsible and think about possible regressions. Sometimes it requires checking the state of the particular kernel release. The older code base the more complicated the decision is.

You might argue that backporting the fixes helps to get the same code in all supported code bases. But it is not true. It never will be the same.

Anyway, in the past the "automatically" nominated printk fixes were trivial. They did not cause harm. But they also were not worth it, IMHO. They fixed corner cases that were there for ages. Most of these fixes were found by code review when working on a feature. They were not backed by bug reports.

Last week, autosel nominated pretty non-trivial patch (started this thread). It partly solved a problem we tried to fix last few years.

On one side, this was an annoying problem that motivated several people spend a lot of time on it. This might be a motivation for a backport.

On the other hand, it took many years to come somewhere. The main problem was the fear of regressions. We fixed/improved many things in the mean time. It shows that the problem really is not trivial. The same is true for the fix. We did our best to avoid regressions. But it does not mean that there are none. Also it does not mean that it will really give better results in all situations.

I really do not see a reason to hurry and backport this to the older kernel releases. It means to spread the fix but also eventual problems. It is easy to miss a dependant patch. The less trivial fix, the more possible problems are there.

Back to the trend. Last week I got autosel mails even for patches that were still being discussed, had issues, and were far from upstream:

https://lkml.kernel.org/r/DM5PR2101MB1032AB19B489D46B717B50D4FBBB0@DM5PR2101MB1032.namprd21.prod.outlook.com
https://lkml.kernel.org/r/DM5PR2101MB10327FA0A7E0D2C901E33B79FBBB0@DM5PR2101MB1032.namprd21.prod.outlook.com

It might be a good idea if the mail asked to add Fixes: tag or stable mailing list. But the mail suggested to add the unfinished patch into stable branch directly (even before upstreaming?).

Now, there are only hand full of printk patches in each release, so it is still doable. I just do not understand how other maintainers, from much more busy subsystems, could cope with this trend.

By other words. If you want to automatize patch nomination, you might need to automatize also patch review. Or you need to keep the patch rate low. This might mean to nominate only important and rather trivial fixes.

Best Regards,
Petr

#30 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

On Tue 17-04-18 14:24:54, Petr Mladek wrote:
[...]

Quoted 11 lines

Back to the trend. Last week I got autosel mails even for patches that were still being discussed, had issues, and were far from upstream:

https://lkml.kernel.org/r/DM5PR2101MB1032AB19B489D46B717B50D4FBBB0@DM5PR2101MB1032.namprd21.prod.outlook.com
https://lkml.kernel.org/r/DM5PR2101MB10327FA0A7E0D2C901E33B79FBBB0@DM5PR2101MB1032.namprd21.prod.outlook.com

It might be a good idea if the mail asked to add Fixes: tag or stable mailing list. But the mail suggested to add the unfinished patch into stable branch directly (even before upstreaming?).

Well, I think that poking subsystems which ignore stable trees with such emails early during review might be quite helpful. Maybe people start marking for stable and we do not need the guessing later. I wouldn't bother poking those who are known to mark stable patches though.

Signature · 2 lines
Michal Hocko
SUSE Labs
#31 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 14 lines · Michal Hocko

On Tue 17-04-18 14:24:54, Petr Mladek wrote:
[...]

Quoted 11 lines

Back to the trend. Last week I got autosel mails even for patches that were still being discussed, had issues, and were far from upstream:

https://lkml.kernel.org/r/DM5PR2101MB1032AB19B489D46B717B50D4FBBB0@DM5PR2101MB1032.namprd21.prod.outlook.com
https://lkml.kernel.org/r/DM5PR2101MB10327FA0A7E0D2C901E33B79FBBB0@DM5PR2101MB1032.namprd21.prod.outlook.com

It might be a good idea if the mail asked to add Fixes: tag or stable mailing list. But the mail suggested to add the unfinished patch into stable branch directly (even before upstreaming?).

Quoted 4 lines

Well, I think that poking subsystems which ignore stable trees with such emails early during review might be quite helpful. Maybe people start marking for stable and we do not need the guessing later. I wouldn't bother poking those who are known to mark stable patches though.

Yup, mm/ needs far less poking that XFS (for example).

What makes mm/ so good about this is that it's a rather small set of devs who are good at marking things for stable. As long as the commit came from one of these "core" mm/ folks it's almost guaranteed to have proper stable tags.

But mm/ commits don't come only from these people. Here's a concrete example we can discuss:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c61611f70958d86f659bca25c02ae69413747a8d

This was merged in a few days ago, and seems relevant for older kernel trees as well. Should it not have a stable tag?

#32 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

On Tue 17-04-18 13:39:33, Sasha Levin wrote:
[...]

Quoted 4 lines

But mm/ commits don't come only from these people. Here's a concrete example we can discuss:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c61611f70958d86f659bca25c02ae69413747a8d

I would be really careful. Because that reqiures to audit all callers to be compliant with the change. This is just _too_ easy to backport without noticing a failure. Now consider the other side. Is there any real bug report backing this? This behavior was like that for quite some time but I do not remember any actual bug report and the changelog doesn't mention one either. It is about theoretical problem.

So if this was to be merged to stable then the changelog should contain a big fat warning about the existing users and how they should be checked.

Besides that I can see Reviewed-by: akpm and Andrew is usually very careful about stable backports so there probably _was_ a reson to exclude stable.

Signature · 2 lines
Michal Hocko
SUSE Labs
#33 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 5 lines · Michal Hocko

On Tue 17-04-18 13:39:33, Sasha Levin wrote:
[...]

Quoted 3 lines

But mm/ commits don't come only from these people. Here's a concrete example we can discuss:

Quoted 8 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c61611f70958d86f659bca25c02ae69413747a8d

I would be really careful. Because that reqiures to audit all callers to be compliant with the change. This is just _too_ easy to backport without noticing a failure. Now consider the other side. Is there any real bug report backing this? This behavior was like that for quite some time but I do not remember any actual bug report and the changelog doesn't mention one either. It is about theoretical problem.

https://lkml.org/lkml/2018/3/19/430

There's even a fun little reproducer that allowed me to confirm it's an issue (at least) on 4.15.

Heck, it might even qualify as a CVE.

Quoted 3 lines

So if this was to be merged to stable then the changelog should contain a big fat warning about the existing users and how they should be checked.

So what I'm asking is why *wasn't* it sent to stable? Yes, it requires additional work backporting this, but what I'm saying is that this didn't happen at all.

Quoted 6 lines

Besides that I can see Reviewed-by: akpm and Andrew is usually very careful about stable backports so there probably _was_ a reson to exclude stable.

Signature · 2 lines
Michal Hocko
SUSE Labs
#34 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 22 lines · Sasha Levin
Quoted 5 lines · Michal Hocko

On Tue 17-04-18 13:39:33, Sasha Levin wrote:
[...]

Quoted 3 lines

But mm/ commits don't come only from these people. Here's a concrete example we can discuss:

Quoted 8 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c61611f70958d86f659bca25c02ae69413747a8d

I would be really careful. Because that reqiures to audit all callers to be compliant with the change. This is just _too_ easy to backport without noticing a failure. Now consider the other side. Is there any real bug report backing this? This behavior was like that for quite some time but I do not remember any actual bug report and the changelog doesn't mention one either. It is about theoretical problem.

https://lkml.org/lkml/2018/3/19/430

There's even a fun little reproducer that allowed me to confirm it's an issue (at least) on 4.15.

Heck, it might even qualify as a CVE.

Quoted 7 lines
Quoted 3 lines

So if this was to be merged to stable then the changelog should contain a big fat warning about the existing users and how they should be checked.

So what I'm asking is why *wasn't* it sent to stable? Yes, it requires additional work backporting this, but what I'm saying is that this didn't happen at all.

Do not ask me. I wasn't involved. But I would _guess_ that the original bug is not all that serious because it requires some specific privileges and it is quite unlikely that somebody privileged would want to shoot its feet. But this is just my wild guess.

Anyway, I am pretty sure that if the triggering BUG was serious enough then it would be much safer to remove it for stable backports.

Signature · 2 lines
Michal Hocko
SUSE Labs
#35 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Petr Mladek
Quoted 11 lines · Petr Mladek

Back to the trend. Last week I got autosel mails even for patches that were still being discussed, had issues, and were far from upstream:

https://lkml.kernel.org/r/DM5PR2101MB1032AB19B489D46B717B50D4FBBB0@DM5PR2101MB1032.namprd21.prod.outlook.com
https://lkml.kernel.org/r/DM5PR2101MB10327FA0A7E0D2C901E33B79FBBB0@DM5PR2101MB1032.namprd21.prod.outlook.com

It might be a good idea if the mail asked to add Fixes: tag or stable mailing list. But the mail suggested to add the unfinished patch into stable branch directly (even before upstreaming?).

I obviously didn't suggest that this patch will go in -stable before it's upstream.

I've started doing those because some folks can't be arsed to reply to a review request for a patch that is months old. I found that if I send these mails while the discussion is still going on I'd get a much better response rate from people.

If you think any of these patches should go in stable there were two ways about it:

- You end up adding the -stable tag yourself, and it would follow the usual route where Greg picks it up.
- You reply to that mail, and the patch would wait in a list until my script notices it made it upstream, at which point it would get queued for stable.

Quoted 9 lines

Now, there are only hand full of printk patches in each release, so it is still doable. I just do not understand how other maintainers, from much more busy subsystems, could cope with this trend.

By other words. If you want to automatize patch nomination, you might need to automatize also patch review. Or you need to keep the patch rate low. This might mean to nominate only important and rather trivial fixes.

I also have an effort to help review the patches. See what I'm working on for the xfs folks:

	https://lkml.org/lkml/2018/3/29/1113

Where in addition to build tests I'd also run each commit, for each stable kernel through a set of xfstests and provide them along with the mail.

So yes, I'm aware that the volume of patches is huge, but there's not much I can do about it because it's just a subset of the kernel's patch volume and since the kernel gets more and more patches each release, the volume of stable commits is bound to grow as well.

#36 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 13 lines · Sasha Levin
Quoted 11 lines · Petr Mladek

Back to the trend. Last week I got autosel mails even for patches that were still being discussed, had issues, and were far from upstream:

https://lkml.kernel.org/r/DM5PR2101MB1032AB19B489D46B717B50D4FBBB0@DM5PR2101MB1032.namprd21.prod.outlook.com
https://lkml.kernel.org/r/DM5PR2101MB10327FA0A7E0D2C901E33B79FBBB0@DM5PR2101MB1032.namprd21.prod.outlook.com

It might be a good idea if the mail asked to add Fixes: tag or stable mailing list. But the mail suggested to add the unfinished patch into stable branch directly (even before upstreaming?).

Quoted 7 lines

I obviously didn't suggest that this patch will go in -stable before it's upstream.

I've started doing those because some folks can't be arsed to reply to a review request for a patch that is months old. I found that if I send these mails while the discussion is still going on I'd get a much better response rate from people.

I see. It makes sense.

Quoted 8 lines

If you think any of these patches should go in stable there were two ways about it:

- You end up adding the -stable tag yourself, and it would follow the usual route where Greg picks it up.
- You reply to that mail, and the patch would wait in a list until my script notices it made it upstream, at which point it would get queued for stable.

It would be great if the options are described in the mail.

I wonder if it would make sense to add also a tag that would say that the commit is not suitable for stable. It might help both sides. The maintainers will be able to share their opinion and eventually reduce mails from autosel. You would get feedback that maintainers considered the patch for stable. It might be even useful for teaching the AI.

Quoted 9 lines
Quoted 4 lines

Now, there are only hand full of printk patches in each release, so it is still doable. I just do not understand how other maintainers, from much more busy subsystems, could cope with this trend.

So yes, I'm aware that the volume of patches is huge, but there's not much I can do about it because it's just a subset of the kernel's patch volume and since the kernel gets more and more patches each release, the volume of stable commits is bound to grow as well.

Yes, but the grow in the stable is much faster than the grow in maintain at the moment. It might be fine if it was caused just by engaging subsystems that ignored stable so far. But I am not sure if it is the case. Also I am not sure about your plans.

Anyway, I am surprised that the patches might go into stable so easily (no response -> accepted). While it is pretty hard to get through the review process for mainline.

Of course, many patches go into mainline without review as well. But the difference is that they are pushed by people that are familiar and responsible for the affected area.

I could understand the pain. There are surely people that do not care about stable, because it takes time, it is hard to make decisions, flashbacks to the old code are painful, etc. Well, this is the reason why the maintenance support is and should be limited.

Anyway, I think that it cannot be done reasonably without maintainers. You should be careful so that even the currently cooperating maintainers will not start considering autosel mails as a spam. (It is not my case. printk is small thing. But I could imagine that it might stop being bearable in bigger subsystems. As is already the case with xfs.)

Best Regards,
Petr

#37 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Sasha Levin
Quoted 12 lines
Quoted 11 lines
Quoted 5 lines

Is there a reason not to take LED fixes if they fix a bug and don't cause a regression? Sure, we can draw some arbitrary line, maybe designate some subsystems that are more "important" than others, but what's the point?

There's a tradeoff.

You want to fix serious bugs in stable, and you really don't want regressions in stable. And ... stable not having 1000s of patches would be nice, too.

Quoted 5 lines

I don't think we should use a number cap here, but rather look at the regression rate: how many patches broke something?

Since the rate we're seeing now with AUTOSEL is similar to what we were seeing before AUTOSEL, what's the problem it's causing?

Regression rate should not be the only criteria.

More patches mean bigger chance customer's patches will have a conflict with something in -stable, for example.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#38 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 15 lines · Pavel Machek
Quoted 15 lines
Quoted 11 lines
Quoted 5 lines

Is there a reason not to take LED fixes if they fix a bug and don't cause a regression? Sure, we can draw some arbitrary line, maybe designate some subsystems that are more "important" than others, but what's the point?

There's a tradeoff.

You want to fix serious bugs in stable, and you really don't want regressions in stable. And ... stable not having 1000s of patches would be nice, too.

I don't think we should use a number cap here, but rather look at the regression rate: how many patches broke something?

Quoted 7 lines
Quoted 2 lines

Since the rate we're seeing now with AUTOSEL is similar to what we were seeing before AUTOSEL, what's the problem it's causing?

Regression rate should not be the only criteria.

More patches mean bigger chance customer's patches will have a conflict with something in -stable, for example.

Out of tree patches can't be a consideration here. There are no guarantees for out of tree code, ever.

#39 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 19 lines · Sasha Levin
Quoted 18 lines · Pavel Machek
Quoted 17 lines
Quoted 11 lines
Quoted 5 lines

Is there a reason not to take LED fixes if they fix a bug and don't cause a regression? Sure, we can draw some arbitrary line, maybe designate some subsystems that are more "important" than others, but what's the point?

There's a tradeoff.

You want to fix serious bugs in stable, and you really don't want regressions in stable. And ... stable not having 1000s of patches would be nice, too.

I don't think we should use a number cap here, but rather look at the regression rate: how many patches broke something?

Since the rate we're seeing now with AUTOSEL is similar to what we were seeing before AUTOSEL, what's the problem it's causing?

Quoted 7 lines
Quoted 4 lines

Regression rate should not be the only criteria.

More patches mean bigger chance customer's patches will have a conflict with something in -stable, for example.

Out of tree patches can't be a consideration here. There are no guarantees for out of tree code, ever.

Out of tree code is not consideration for mainline, agreed. Stable should be different.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#40 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 22 lines · Pavel Machek
Quoted 21 lines · Sasha Levin
Quoted 20 lines · Pavel Machek
Quoted 12 lines
Quoted 11 lines
Quoted 5 lines

Is there a reason not to take LED fixes if they fix a bug and don't cause a regression? Sure, we can draw some arbitrary line, maybe designate some subsystems that are more "important" than others, but what's the point?

There's a tradeoff.

You want to fix serious bugs in stable, and you really don't want regressions in stable. And ... stable not having 1000s of patches would be nice, too.

Quoted 5 lines

I don't think we should use a number cap here, but rather look at the regression rate: how many patches broke something?

Since the rate we're seeing now with AUTOSEL is similar to what we were seeing before AUTOSEL, what's the problem it's causing?

Regression rate should not be the only criteria.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

More patches mean bigger chance customer's patches will have a conflict with something in -stable, for example.

Out of tree patches can't be a consideration here. There are no guarantees for out of tree code, ever.

Out of tree code is not consideration for mainline, agreed. Stable should be different.

This is a discussion we could have with in right forum, but FYI stable doesn't even guarantee KABI compatibility between minor versions at this point.

#41 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 29 lines · Sasha Levin
Quoted 28 lines · Pavel Machek
Quoted 26 lines · Sasha Levin
Quoted 15 lines · Pavel Machek
Quoted 15 lines
Quoted 11 lines
Quoted 5 lines

Is there a reason not to take LED fixes if they fix a bug and don't cause a regression? Sure, we can draw some arbitrary line, maybe designate some subsystems that are more "important" than others, but what's the point?

There's a tradeoff.

You want to fix serious bugs in stable, and you really don't want regressions in stable. And ... stable not having 1000s of patches would be nice, too.

I don't think we should use a number cap here, but rather look at the regression rate: how many patches broke something?

Quoted 7 lines
Quoted 2 lines

Since the rate we're seeing now with AUTOSEL is similar to what we were seeing before AUTOSEL, what's the problem it's causing?

Regression rate should not be the only criteria.

More patches mean bigger chance customer's patches will have a conflict with something in -stable, for example.

Out of tree patches can't be a consideration here. There are no guarantees for out of tree code, ever.

Quoted 6 lines
Quoted 2 lines

Out of tree code is not consideration for mainline, agreed. Stable should be different.

This is a discussion we could have with in right forum, but FYI stable doesn't even guarantee KABI compatibility between minor versions at this point.

Stable should be useful base for distributions. They carry out of tree patches, and yes, you should try to make their lives easy.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#42 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 33 lines · Pavel Machek
Quoted 32 lines · Sasha Levin
Quoted 30 lines · Pavel Machek
Quoted 19 lines · Sasha Levin
Quoted 18 lines · Pavel Machek
Quoted 17 lines
Quoted 11 lines
Quoted 5 lines

Is there a reason not to take LED fixes if they fix a bug and don't cause a regression? Sure, we can draw some arbitrary line, maybe designate some subsystems that are more "important" than others, but what's the point?

There's a tradeoff.

You want to fix serious bugs in stable, and you really don't want regressions in stable. And ... stable not having 1000s of patches would be nice, too.

I don't think we should use a number cap here, but rather look at the regression rate: how many patches broke something?

Since the rate we're seeing now with AUTOSEL is similar to what we were seeing before AUTOSEL, what's the problem it's causing?

Quoted 7 lines
Quoted 4 lines

Regression rate should not be the only criteria.

More patches mean bigger chance customer's patches will have a conflict with something in -stable, for example.

Out of tree patches can't be a consideration here. There are no guarantees for out of tree code, ever.

Out of tree code is not consideration for mainline, agreed. Stable should be different.

Quoted 6 lines
Quoted 3 lines

This is a discussion we could have with in right forum, but FYI stable doesn't even guarantee KABI compatibility between minor versions at this point.

Stable should be useful base for distributions. They carry out of tree patches, and yes, you should try to make their lives easy.

How do you know I already don't do that?

But no, in the end, it's not my job to make their life easier if they are off in their own corner never providing me feedback or help. For those companies/distros/SoCs that do provide that feedback, I am glad to work with them.

As proof of that, there are at least 3 "major" SoC vendors that have been merging every one of the stable releases into their internal trees for the past 6+ months now. I get reports when they do the merge and test, and so far, we have only had 1 regression. And that regression was because that SoC vendor forgot to upstream a patch that they had in their internal tree (i.e. they fixed it a while ago but forgot to tell anyone else, nothing we can do about that.)

So if you are a distro/company/whatever that takes stable releases, and have run into problems, please let me know, and I will be glad to work with you.

If you are not that, then please don't attempt to speak for them...

thanks,

greg k-h

#43 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Sasha Levin

Hi!

Quoted 5 lines

How do you know if a bug bothers someone?

If a user is annoyed by a LED issue, is he expected to triage the bug, report it on LKML and patiently wait for the appropriate patch to be backported?

If the user is annoyed by a LED issue, you are actually expected to tell him that it is not going to be fixed, because it is not on the list:

- It must fix a problem that causes a build error (but not for things marked CONFIG_BROKEN), an oops, a hang, data corruption, a real security issue, or some "oh, that's not good" issue. In short, something critical.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#44 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 8 lines · Pavel Machek

Hi!

Quoted 5 lines

How do you know if a bug bothers someone?

If a user is annoyed by a LED issue, is he expected to triage the bug, report it on LKML and patiently wait for the appropriate patch to be backported?

Quoted 7 lines

If the user is annoyed by a LED issue, you are actually expected to tell him that it is not going to be fixed, because it is not on the list:

- It must fix a problem that causes a build error (but not for things marked CONFIG_BROKEN), an oops, a hang, data corruption, a real security issue, or some "oh, that's not good" issue. In short, something critical.

So if a user is operating a nuclear power plant, and has 2 leds: green one that says "All OK!" and a red one saying "NUCLEAR MELTDOWN!", and once in a blue moon a race condition is causing the red one to go on and cause panic in the little province he lives in, we should tell that user to fuck off?

LEDs may not be critical for you, but they can be critical for someone else. Think of all the different users we have and the wildly different ways they use the kernel.

#45 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 9 lines · On Mon, 16 Apr 2018 17:16:10 +0000 Sasha Levin <[email protected]>…

So if a user is operating a nuclear power plant, and has 2 leds: green one that says "All OK!" and a red one saying "NUCLEAR MELTDOWN!", and once in a blue moon a race condition is causing the red one to go on and cause panic in the little province he lives in, we should tell that user to fuck off?

LEDs may not be critical for you, but they can be critical for someone else. Think of all the different users we have and the wildly different ways they use the kernel.

We can point them to the fix and have them backport it. Or they should ask their distribution to backport it.

Hopefully they tested the kernel they are using for something like that, and only want critical fixes. What happens if they take the next stable assuming that it has critical fixes only, and this fix causes a regression that creates the "ALL OK!" when it wasn't.

Basically, I rather have stable be more bug compatible with the version it is based on with only critical fixes (things that will cause an oops) than to try to be bug compatible with mainline, as then we get into a state where things are a frankenstein of the stable base version and mainline. I could say, "Yeah this feature works better on this 4.x version of the kernel" and not worry about "4.x.y" versions having it better.

-- Steve

#46 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 10 lines · Steven Rostedt
Quoted 6 lines · On Mon, 16 Apr 2018 17:16:10 +0000 Sasha Levin <[email protected]>…

So if a user is operating a nuclear power plant, and has 2 leds: green one that says "All OK!" and a red one saying "NUCLEAR MELTDOWN!", and once in a blue moon a race condition is causing the red one to go on and cause panic in the little province he lives in, we should tell that user to fuck off?

Quoted 6 lines
Quoted 3 lines

LEDs may not be critical for you, but they can be critical for someone else. Think of all the different users we have and the wildly different ways they use the kernel.

We can point them to the fix and have them backport it. Or they should ask their distribution to backport it.

It may work in your subsystem, but it really doesn't work this way with the kernel.

Let me share a concrete example with you: there's a vfs bug that's a pain to reproduce going around. It was originally reported on CoreOS/AWS:

	https://github.com/coreos/bugs/issues/2356

But our customers reported to us that they're hitting this issue too.

We couldn't reproduce it, and the call trace indicated it may be a memory corrution. We could however confirm with the customers that the latest mainline fixes the issue.

Given that we couldn't reproduce it, and neither of us is a fs/ expert, we sent a mail to LKML, just like you suggested doing:

	https://lkml.org/lkml/2018/3/2/1038

But unlike what you said, no one pointed us to the fix, even though the issue was fixed on mainline. Heck, no one engaged in any meaningful conversation about the bug.

I really think that we have a different views as to how well the whole "let me shoot a mail to LKML" process works, which leads to different views on -stable.

Quoted 5 lines

Hopefully they tested the kernel they are using for something like that, and only want critical fixes. What happens if they take the next stable assuming that it has critical fixes only, and this fix causes a regression that creates the "ALL OK!" when it wasn't.

Quoted 7 lines

Basically, I rather have stable be more bug compatible with the version it is based on with only critical fixes (things that will cause an oops) than to try to be bug compatible with mainline, as then we get into a state where things are a frankenstein of the stable base version and mainline. I could say, "Yeah this feature works better on this 4.x version of the kernel" and not worry about "4.x.y" versions having it better.

This is how things used to work, right? Look at redhat kernels for example, they'd stick with a kernel for tens of years, doing the tiniest fixes, only when customers complained, and encouraging users to upgrade only when the kernel would go EoL, and when customers couldn't do that because they were too locked on that kernel version.

redhat still supports 2.6.9.

I thought we agreed that this is bad? We wanted users to be closer to mainline, and we can't do it without bringing -stable closer to mainline as well.

#47 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 3 lines · On Mon, 16 Apr 2018 18:17:17 +0000 Sasha Levin <[email protected]>…

I thought we agreed that this is bad? We wanted users to be closer to mainline, and we can't do it without bringing -stable closer to mainline as well.

I guess the question comes down to, what do the users of stable kernels want? For my machines, I always stay one or two releases behind mainline. Right now my kernels are on 4.15.x, and will probably jump to 4.16.x the next time I upgrade my machines. I'm fine with something breaking every so often as long as it's not data corruption (although I have lots of backups of my systems in case that happens, just a PITA to fix it). I only hit bugs on these boxes probably once a year at most in doing so. But I mostly do what other kernel developers do and that means the bugs I would mostly hit, other developers hit before their code is released.

Thus, if stable users are fine with being regression compatible with mainline, then I'm fine with it too.

-- Steve

#48 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Sasha Levin
Quoted 9 lines · Sasha Levin

So if a user is operating a nuclear power plant, and has 2 leds: green one that says "All OK!" and a red one saying "NUCLEAR MELTDOWN!", and once in a blue moon a race condition is causing the red one to go on and cause panic in the little province he lives in, we should tell that user to fuck off?

LEDs may not be critical for you, but they can be critical for someone else. Think of all the different users we have and the wildly different ways they use the kernel.

I am pretty sure that for almost every fix there is a person on a planet that'd rate it "critical". We can't really use this as an argument for inclusion of code into -stable, as that'd mean that -stable and Linus' tree would have to be basically the same.

Signature · 2 lines
Jiri Kosina
SUSE Labs
#49 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 8 lines · Jiri Kosina
Quoted 6 lines · Sasha Levin

So if a user is operating a nuclear power plant, and has 2 leds: green one that says "All OK!" and a red one saying "NUCLEAR MELTDOWN!", and once in a blue moon a race condition is causing the red one to go on and cause panic in the little province he lives in, we should tell that user to fuck off?

Quoted 7 lines
Quoted 3 lines

LEDs may not be critical for you, but they can be critical for someone else. Think of all the different users we have and the wildly different ways they use the kernel.

I am pretty sure that for almost every fix there is a person on a planet that'd rate it "critical". We can't really use this as an argument for inclusion of code into -stable, as that'd mean that -stable and Linus'

So I think that Linus's claim that users come first applies here as well. If there's a user that cares about a particular feature being broken, then we go ahead and fix his bug rather then ignoring him.

Quoted 1 line

tree would have to be basically the same.

Basically the same minus all new features/subsystems/arch/etc. But yes, ideally we'd want all bugfixes that go in mainline. Who not?

Instead of keeping bug fixes out, we need to work on improving our testing story. Instead of ignoring that "person that'd rate it critical" we should add his usecase into our testing matrix.

#50 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 3 lines · Sasha Levin

So I think that Linus's claim that users come first applies here as well. If there's a user that cares about a particular feature being broken, then we go ahead and fix his bug rather then ignoring him.

So one extreme is fixing -stable *iff* users actually do report an issue.

The other extreme is backporting everything that potentially looks like a potential fix of "something" (according to some arbitrary metric), pro-actively.

The former voilates the "users first" rule, the latter has a very, very high risk of regressions.

So this whole debate is about finding a compromise.

My gut feeling always was that the statement in

Documentation/process/stable-kernel-rules.rst

is very reasonable, but making the process way more "aggresive" when backporting patches is breaking much of its original spirit for me.

Signature · 2 lines
Jiri Kosina
SUSE Labs
#51 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 15 lines · Jiri Kosina
Quoted 3 lines · Sasha Levin

So I think that Linus's claim that users come first applies here as well. If there's a user that cares about a particular feature being broken, then we go ahead and fix his bug rather then ignoring him.

So one extreme is fixing -stable *iff* users actually do report an issue.

The other extreme is backporting everything that potentially looks like a potential fix of "something" (according to some arbitrary metric), pro-actively.

The former voilates the "users first" rule, the latter has a very, very high risk of regressions.

Quoted 8 lines

So this whole debate is about finding a compromise.

My gut feeling always was that the statement in

Documentation/process/stable-kernel-rules.rst

is very reasonable, but making the process way more "aggresive" when backporting patches is breaking much of its original spirit for me.

I agree that as an enterprise distro taking everything from -stable isn't the best idea. Ideally you'd want to be close to the first extreme you've mentioned and only take commits if customers are asking you to do so.

I think that the rule we're trying to agree upon is the "It must fix a real bug that bothers people".

I think that we can agree that it's impossible to expect every single Linux user to go on LKML and complain about a bug he encountered, so the rule quickly becomes "It must fix a real bug that can bother people".

My "aggressiveness" comes from the whole "bother" part: it doesn't have to be critical, it doesn't have to cause data corruption, it doesn't have to be a security issue. It's enough that the bug actually affects a user in a way he didn't expect it to (if a user doesn't have expectations, it would fall under the "This could be a problem..." exception.

We can go into a discussion about what exactly "bothering" is, but on the flip side, the whole -stable tag is just a way for folks to indicate they want a given patch reviewed for stable, it's not actually a guarantee of whether the patch will go in to -stable or not.

#52 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 11 lines · Sasha Levin

I agree that as an enterprise distro taking everything from -stable isn't the best idea. Ideally you'd want to be close to the first extreme you've mentioned and only take commits if customers are asking you to do so.

I think that the rule we're trying to agree upon is the "It must fix a real bug that bothers people".

I think that we can agree that it's impossible to expect every single Linux user to go on LKML and complain about a bug he encountered, so the rule quickly becomes "It must fix a real bug that can bother people".

So is there a reason why stable couldn't become some hybrid-form union of

- really critical issues (data corruption, boot issues, severe security issues) taken from bleeding edge upstream
- [reviewed] cherry-picks of functional fixes from major distro kernels (based on that very -stable release), as that's apparently what people are hitting in the real world with that particular kernel

?

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
#53 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 14 lines · Jiri Kosina
Quoted 11 lines · Sasha Levin

I agree that as an enterprise distro taking everything from -stable isn't the best idea. Ideally you'd want to be close to the first extreme you've mentioned and only take commits if customers are asking you to do so.

I think that the rule we're trying to agree upon is the "It must fix a real bug that bothers people".

I think that we can agree that it's impossible to expect every single Linux user to go on LKML and complain about a bug he encountered, so the rule quickly becomes "It must fix a real bug that can bother people".

Quoted 7 lines

So is there a reason why stable couldn't become some hybrid-form union of

- really critical issues (data corruption, boot issues, severe security issues) taken from bleeding edge upstream
- [reviewed] cherry-picks of functional fixes from major distro kernels (based on that very -stable release), as that's apparently what people are hitting in the real world with that particular kernel

It already is that :)

The problem Sasha is trying to solve here is that for many subsystems, maintainers do not mark patches for stable at all. So real bugfixes that do hit people are not getting to those kernels, which force the distros to do extra work to triage a bug, dig through upstream kernels, find and apply the patch.

By identifying the patches that should have been marked for stable, based on the ways that the changelog text is written and the logic in the patch itself, we circumvent that extra annoyance of users hitting problems and complaining, or ignoring them and hoping they go away if they reboot.

I've been doing this "by hand" for many years now, with no complaints so far. Sasha has taken it to the next level as I don't scale and has started to automate it using some really nice tools. That's all, this isn't crazy new features being backported, it's just patches that are obviously fixes being added to the stable tree.

Yes, sometimes those fixes need additional fixes, and that's fine, normal stable-marked patches need that all the time. I don't see anyone complaining about that, right?

So nothing "new" is happening here, EXCEPT we are actually starting to get a better kernel-wide coverage for stable fixes, which we have not had in the past. That's a good thing! The number of patches applied to stable is still a very very very tiny % compared to mainline, so nothing new is happening here.

Oh, and if you do want to complain about huge new features being backported, look at the mess that Spectre and Meltdown has caused in the stable trees. I don't see anyone complaining about those massive changes :)

thanks,

greg k-h

#54 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 23 lines · Greg KH
Quoted 14 lines · Jiri Kosina
Quoted 11 lines · Sasha Levin

I agree that as an enterprise distro taking everything from -stable isn't the best idea. Ideally you'd want to be close to the first extreme you've mentioned and only take commits if customers are asking you to do so.

I think that the rule we're trying to agree upon is the "It must fix a real bug that bothers people".

I think that we can agree that it's impossible to expect every single Linux user to go on LKML and complain about a bug he encountered, so the rule quickly becomes "It must fix a real bug that can bother people".

Quoted 7 lines

So is there a reason why stable couldn't become some hybrid-form union of

- really critical issues (data corruption, boot issues, severe security issues) taken from bleeding edge upstream
- [reviewed] cherry-picks of functional fixes from major distro kernels (based on that very -stable release), as that's apparently what people are hitting in the real world with that particular kernel

Quoted 4 lines

It already is that :)

The problem Sasha is trying to solve here is that for many subsystems, maintainers do not mark patches for stable at all.

The way he is trying to do that is just wrong. Generate a pressure on those subsystems by referring to bug reports and unhappy users and I am pretty sure they will try harder... You cannot solve the problem by bypassing them without having deep understanding of the specific subsytem. Once you have it, just make sure you are part of the review process and make sure to mark patches before they are merged.

Quoted 4 lines

So real bugfixes
that do hit people are not getting to those kernels, which force the distros to do extra work to triage a bug, dig through upstream kernels, find and apply the patch.

I would say that this is the primary role of the distro. To hide the jungle of the upstream work and provide the additional of bug filtering and forwarding them the right direction.

Quoted 5 lines

By identifying the patches that should have been marked for stable, based on the ways that the changelog text is written and the logic in the patch itself, we circumvent that extra annoyance of users hitting problems and complaining, or ignoring them and hoping they go away if they reboot.

Well, but this is a two edge sword. You are not only backporting obvious bug fixes but also pulling many patch out of the context they were merged to and double checking all the assumptions are still true is a non-trivial task to do. I am still not convinced any script or AI can do that right now.

Quoted 2 lines

I've been doing this "by hand" for many years now, with no complaints so far.

Really? I remember quite some complains about broken stable releases and also many discussions on KS how the current workflow doesn't really work for some users (e.g. distributions).

Quoted 4 lines

Sasha has taken it to the next level as I don't scale and has started to automate it using some really nice tools. That's all, this isn't crazy new features being backported, it's just patches that are obviously fixes being added to the stable tree.

I have yet to see a tool which can recognize an "obvious fix". Seriously! Matching keywords in the changelog and some pattern recognition in the diff can help to do some pre filtering _can_ help a lot but there is still a human interaction needed to do sanity checking. And that really requires deep subsystem knowledge. I really fail to see how that can work without relevant people involvement. Pretending that you can do stable without maintainers will simply not work IMNHO.

Quoted 9 lines

Yes, sometimes those fixes need additional fixes, and that's fine, normal stable-marked patches need that all the time. I don't see anyone complaining about that, right?

So nothing "new" is happening here, EXCEPT we are actually starting to get a better kernel-wide coverage for stable fixes, which we have not had in the past. That's a good thing! The number of patches applied to stable is still a very very very tiny % compared to mainline, so nothing new is happening here.

yes I do agree, the stable process is not very much different from the past and I would tend both processes broken because they explicitly try to avoid maintainers which is just wrong.

Quoted 4 lines

Oh, and if you do want to complain about huge new features being backported, look at the mess that Spectre and Meltdown has caused in the stable trees. I don't see anyone complaining about those massive changes :)

Are you serious? Are you going the compare the biggest PITA that the community had to undergo because of HW issues with random pattern matching in changelog/diffs? Come on!

Signature · 2 lines
Michal Hocko
SUSE Labs
#55 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 29 lines · Michal Hocko
Quoted 23 lines · Greg KH
Quoted 14 lines · Jiri Kosina
Quoted 11 lines · Sasha Levin

I agree that as an enterprise distro taking everything from -stable isn't the best idea. Ideally you'd want to be close to the first extreme you've mentioned and only take commits if customers are asking you to do so.

I think that the rule we're trying to agree upon is the "It must fix a real bug that bothers people".

I think that we can agree that it's impossible to expect every single Linux user to go on LKML and complain about a bug he encountered, so the rule quickly becomes "It must fix a real bug that can bother people".

Quoted 7 lines

So is there a reason why stable couldn't become some hybrid-form union of

- really critical issues (data corruption, boot issues, severe security issues) taken from bleeding edge upstream
- [reviewed] cherry-picks of functional fixes from major distro kernels (based on that very -stable release), as that's apparently what people are hitting in the real world with that particular kernel

Quoted 4 lines

It already is that :)

The problem Sasha is trying to solve here is that for many subsystems, maintainers do not mark patches for stable at all.

Quoted 6 lines

The way he is trying to do that is just wrong. Generate a pressure on those subsystems by referring to bug reports and unhappy users and I am pretty sure they will try harder... You cannot solve the problem by bypassing them without having deep understanding of the specific subsytem. Once you have it, just make sure you are part of the review process and make sure to mark patches before they are merged.

I think we just don't agree on how we should "pressure".

Look at the discussion I had with the XFS folks who just don't want to deal with this -stable thing because they have to much work upstream.

There wasn't a single patch in -stable coming from XFS for the past 6+ months. I'm aware of more than one way to corrupt an XFS volume for any distro that uses a kernel older than 4.15.

Sure, please buy them a beer at LSF/MM (I'll pay) and ask them to be better about it, but I don't see this changing.

The solution to this, in my opinion, is to automate the whole selection and review process. We do selection using AI, and we run every possible test that's relevant to that subsystem.

At which point, the amount of work a human needs to do to review a patch shrinks into something far more managable for some maintainers.

Quoted 8 lines
Quoted 4 lines

So real bugfixes
that do hit people are not getting to those kernels, which force the distros to do extra work to triage a bug, dig through upstream kernels, find and apply the patch.

I would say that this is the primary role of the distro. To hide the jungle of the upstream work and provide the additional of bug filtering and forwarding them the right direction.

More often than triaging, you'll just be asked to upgrade to the latest version. What sort of user experience does that provide?

[snip]

Quoted 9 lines
Quoted 5 lines

So nothing "new" is happening here, EXCEPT we are actually starting to get a better kernel-wide coverage for stable fixes, which we have not had in the past. That's a good thing! The number of patches applied to stable is still a very very very tiny % compared to mainline, so nothing new is happening here.

yes I do agree, the stable process is not very much different from the past and I would tend both processes broken because they explicitly try to avoid maintainers which is just wrong.

Avoid maintainers?! We send so much "spam" trying to get maintainers more involved in the process. How is that avoiding them?

If you're a maintainer who has specific requirements for the -stable flow, or you have any automated testing you'd like to be run on these commits, or you want these mails to come in a different format, or pretty much anything else at all just shoot me a mail!

It's been almost impossible to get maintainers involved in this process.

We don't sneak anything past maintainers, there are multiple mails over multiple weeks for each commit that would go in. You don't have to review it right away either, just reply with "please don't merge until I'm done reviewing" and it'll get removed from the queue.

Quoted 8 lines
Quoted 4 lines

Oh, and if you do want to complain about huge new features being backported, look at the mess that Spectre and Meltdown has caused in the stable trees. I don't see anyone complaining about those massive changes :)

Are you serious? Are you going the compare the biggest PITA that the community had to undergo because of HW issues with random pattern matching in changelog/diffs? Come on!

HW Issues are irrelevant here. You had a bug that allowed arbitrary kernel memory access. I can easily list quite a few commits, that are not tagged for stable, that fix exactly the same thing.

#56 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 6 lines · On Tue, 17 Apr 2018 14:04:36 +0000 Sasha Levin <[email protected]>…

The solution to this, in my opinion, is to automate the whole selection and review process. We do selection using AI, and we run every possible test that's relevant to that subsystem.

At which point, the amount of work a human needs to do to review a patch shrinks into something far more managable for some maintainers.

I guess the real question is, who are the stable kernels for? Is it just a place to look at to see what distros should think about. A superset of what distros would take. Then distros would have a nice place to look to find what patches they should look at. But the stable tree itself wont be used. But it's not being used today by major distros (Red Hat and SuSE). Debian may be using it, but that's because the stable maintainer for its kernels is also the Debian maintainer.

Who are the customers of the stable trees? They are the ones that should be determining the "equation" for what goes into it.

Personally, I use stable as a one off from mainline. Like I mentioned in another email. I'm currently on 4.15.x and will probably move to 4.16.x next. Unless there's some critical bug announcement, I update my machines once a month. I originally just used mainline, but that was a bit too unstable for my work machines ;-)

-- Steve

#57 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 18 lines · Steven Rostedt
Quoted 6 lines · On Tue, 17 Apr 2018 14:04:36 +0000 Sasha Levin <[email protected]>…

The solution to this, in my opinion, is to automate the whole selection and review process. We do selection using AI, and we run every possible test that's relevant to that subsystem.

At which point, the amount of work a human needs to do to review a patch shrinks into something far more managable for some maintainers.

I guess the real question is, who are the stable kernels for? Is it just a place to look at to see what distros should think about. A superset of what distros would take. Then distros would have a nice place to look to find what patches they should look at. But the stable tree itself wont be used. But it's not being used today by major distros (Red Hat and SuSE). Debian may be using it, but that's because the stable maintainer for its kernels is also the Debian maintainer.

Quoted 2 lines

Who are the customers of the stable trees? They are the ones that should be determining the "equation" for what goes into it.

The "customers" of the stable trees are anyone who uses Linux.

Right now, it's estimated that only about 1/3 of the kernels running out there, at the best, are an "enterprise" kernel/distro. 2/3 of the world either run a kernel.org-based release + their own patches, or Debian. And Debian piggy-backs on the stable kernel releases pretty regularily.

So the majority of the Linux users out there are what we are doing this for. Those that do not pay for a company to sift through things and only cherry-pick what they want to pick out (hint, they almost always miss things, some do this better than others...)

That's who this is all for, which is why we are doing our best to keep on top of the avalanche of patches going into upstream to get the needed fixes (both security and "normal" fixes) out to users as soon as possible.

So again, if you are a subsystem maintainer, tag your patches for stable. If you do not, you will get automated emails asking you about patches that should be applied (like the one that started this thread). If you want to just have us ignore your subsystem entirely, we will be glad to do so, and we will tell the world to not use your subsystem if at all possible (see previous comments about xfs, and I would argue IB right now...)

Quoted 5 lines

Personally, I use stable as a one off from mainline. Like I mentioned in another email. I'm currently on 4.15.x and will probably move to 4.16.x next. Unless there's some critical bug announcement, I update my machines once a month. I originally just used mainline, but that was a bit too unstable for my work machines ;-)

That's great, you are a user of these trees then. So you benifit directly, along with everyone else who relies on them.

And again, I'm working with the SoC vendors to directly incorporate these trees into their device trees, and I've already seen some devices in the wild push out updated 4.4.y kernels a few weeks after they are released. That's the end goal here, to have the world's devices in a much more secure and stable shape by relying on these kernels.

thanks,

greg k-h

#58 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Sasha Levin
Quoted 37 lines · Sasha Levin
Quoted 29 lines · Michal Hocko
Quoted 23 lines · Greg KH
Quoted 14 lines · Jiri Kosina
Quoted 11 lines · Sasha Levin

I agree that as an enterprise distro taking everything from -stable isn't the best idea. Ideally you'd want to be close to the first extreme you've mentioned and only take commits if customers are asking you to do so.

I think that the rule we're trying to agree upon is the "It must fix a real bug that bothers people".

I think that we can agree that it's impossible to expect every single Linux user to go on LKML and complain about a bug he encountered, so the rule quickly becomes "It must fix a real bug that can bother people".

Quoted 7 lines

So is there a reason why stable couldn't become some hybrid-form union of

- really critical issues (data corruption, boot issues, severe security issues) taken from bleeding edge upstream
- [reviewed] cherry-picks of functional fixes from major distro kernels (based on that very -stable release), as that's apparently what people are hitting in the real world with that particular kernel

Quoted 4 lines

It already is that :)

The problem Sasha is trying to solve here is that for many subsystems, maintainers do not mark patches for stable at all.

Quoted 6 lines

The way he is trying to do that is just wrong. Generate a pressure on those subsystems by referring to bug reports and unhappy users and I am pretty sure they will try harder... You cannot solve the problem by bypassing them without having deep understanding of the specific subsytem. Once you have it, just make sure you are part of the review process and make sure to mark patches before they are merged.

Quoted 4 lines

I think we just don't agree on how we should "pressure".

Look at the discussion I had with the XFS folks who just don't want to deal with this -stable thing because they have to much work upstream.

So do you really think that you or any script decide without them? My recollection from that discussion was quite opposite. Dave was quite clear that most of fixes are quite hard to evaluate and most of them are simply not worth risking the backport.

Quoted 3 lines

There wasn't a single patch in -stable coming from XFS for the past 6+ months. I'm aware of more than one way to corrupt an XFS volume for any distro that uses a kernel older than 4.15.

Then try to poke/bribe somebody to have it fixed. But applying _something_ is just not a solution. You should also evaluate whether "I am able to corrupt" is something that "people see in the wild". Sure there are zillions of bugs hidden in the large code base like the kernel. People just do not tend to hit them and this will likely not change very much in the future.

Quoted 2 lines

Sure, please buy them a beer at LSF/MM (I'll pay) and ask them to be better about it, but I don't see this changing.

I can surely have one or two and discuss this. I am pretty sure xfs guys are not going to pretend older kernels do not exist.

Quoted 6 lines

The solution to this, in my opinion, is to automate the whole selection and review process. We do selection using AI, and we run every possible test that's relevant to that subsystem.

At which point, the amount of work a human needs to do to review a patch shrinks into something far more managable for some maintainers.

I really disagree. I am pretty sure maintainers are very well aware of how the patch is important. Some do no care about stable and I agree you should poke those. But some have really good reasons to not throw many patches that direction because they do not feel the patch is important enough.

Remember this is not about numbers. The more is not always better.

Quoted 20 lines
Quoted 8 lines
Quoted 4 lines

So real bugfixes
that do hit people are not getting to those kernels, which force the distros to do extra work to triage a bug, dig through upstream kernels, find and apply the patch.

I would say that this is the primary role of the distro. To hide the jungle of the upstream work and provide the additional of bug filtering and forwarding them the right direction.

More often than triaging, you'll just be asked to upgrade to the latest version. What sort of user experience does that provide?

[snip]

Quoted 6 lines
Quoted 5 lines

So nothing "new" is happening here, EXCEPT we are actually starting to get a better kernel-wide coverage for stable fixes, which we have not had in the past. That's a good thing! The number of patches applied to stable is still a very very very tiny % compared to mainline, so nothing new is happening here.

Quoted 6 lines
Quoted 3 lines

yes I do agree, the stable process is not very much different from the past and I would tend both processes broken because they explicitly try to avoid maintainers which is just wrong.

Avoid maintainers?! We send so much "spam" trying to get maintainers more involved in the process. How is that avoiding them?

Just read what your wrote again. I am pretty sure AUTOSEL is on filter list on many people. We have a good volume of email traffic already and seeing more automatic one just doesn't help. At all!

Quoted 6 lines

If you're a maintainer who has specific requirements for the -stable flow, or you have any automated testing you'd like to be run on these commits, or you want these mails to come in a different format, or pretty much anything else at all just shoot me a mail!

It's been almost impossible to get maintainers involved in this process.

The whole stable history was that about not bothering maintainers and here is the result.

Quoted 4 lines

We don't sneak anything past maintainers, there are multiple mails over multiple weeks for each commit that would go in. You don't have to review it right away either, just reply with "please don't merge until I'm done reviewing" and it'll get removed from the queue.

I am not talking about sneaking or pushing behind the backs. I am just saying that you cannot do this without direct involvement of maintainers. If they do not respond to bug reports should at them and I am pretty sure that those subsystems will get a bigger pressure to find their way to select _important_ fixes to users who are not running the bleeding edge because those users _matter_ as well (maybe even more because they are a much larger group).

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Oh, and if you do want to complain about huge new features being backported, look at the mess that Spectre and Meltdown has caused in the stable trees. I don't see anyone complaining about those massive changes :)

Quoted 7 lines
Quoted 3 lines

Are you serious? Are you going the compare the biggest PITA that the community had to undergo because of HW issues with random pattern matching in changelog/diffs? Come on!

HW Issues are irrelevant here. You had a bug that allowed arbitrary kernel memory access. I can easily list quite a few commits, that are not tagged for stable, that fix exactly the same thing.

Those are important fixes and if you are aware of them then you should be involving the respective maintainer. I haven't heard about _any_ maintainer who would refuse to help.

Signature · 2 lines
Michal Hocko
SUSE Labs
#59 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 40 lines · Michal Hocko
Quoted 39 lines · Sasha Levin
Quoted 29 lines · Michal Hocko
Quoted 23 lines · Greg KH
Quoted 14 lines · Jiri Kosina
Quoted 11 lines · Sasha Levin

I agree that as an enterprise distro taking everything from -stable isn't the best idea. Ideally you'd want to be close to the first extreme you've mentioned and only take commits if customers are asking you to do so.

I think that the rule we're trying to agree upon is the "It must fix a real bug that bothers people".

I think that we can agree that it's impossible to expect every single Linux user to go on LKML and complain about a bug he encountered, so the rule quickly becomes "It must fix a real bug that can bother people".

Quoted 7 lines

So is there a reason why stable couldn't become some hybrid-form union of

- really critical issues (data corruption, boot issues, severe security issues) taken from bleeding edge upstream
- [reviewed] cherry-picks of functional fixes from major distro kernels (based on that very -stable release), as that's apparently what people are hitting in the real world with that particular kernel

Quoted 4 lines

It already is that :)

The problem Sasha is trying to solve here is that for many subsystems, maintainers do not mark patches for stable at all.

Quoted 6 lines

The way he is trying to do that is just wrong. Generate a pressure on those subsystems by referring to bug reports and unhappy users and I am pretty sure they will try harder... You cannot solve the problem by bypassing them without having deep understanding of the specific subsytem. Once you have it, just make sure you are part of the review process and make sure to mark patches before they are merged.

I think we just don't agree on how we should "pressure".

Quoted 7 lines
Quoted 2 lines

Look at the discussion I had with the XFS folks who just don't want to deal with this -stable thing because they have to much work upstream.

So do you really think that you or any script decide without them? My recollection from that discussion was quite opposite. Dave was quite clear that most of fixes are quite hard to evaluate and most of them are simply not worth risking the backport.

No, *some* fixes are hard, not most.

I'm not trying to decide for them, I'm trying to help them decide.

Quoted 10 lines
Quoted 3 lines

There wasn't a single patch in -stable coming from XFS for the past 6+ months. I'm aware of more than one way to corrupt an XFS volume for any distro that uses a kernel older than 4.15.

Then try to poke/bribe somebody to have it fixed. But applying _something_ is just not a solution. You should also evaluate whether "I am able to corrupt" is something that "people see in the wild". Sure there are zillions of bugs hidden in the large code base like the kernel. People just do not tend to hit them and this will likely not change very much in the future.

We can't ignore bugs just because people don't notice.

Data corruption bugs in particular are a pain to report as well, the corruption might have happened months before and there's not much to report at that point.

There's quite a few bug classes like that.

Quoted 13 lines
Quoted 2 lines

Sure, please buy them a beer at LSF/MM (I'll pay) and ask them to be better about it, but I don't see this changing.

I can surely have one or two and discuss this. I am pretty sure xfs guys are not going to pretend older kernels do not exist.

Quoted 6 lines

The solution to this, in my opinion, is to automate the whole selection and review process. We do selection using AI, and we run every possible test that's relevant to that subsystem.

At which point, the amount of work a human needs to do to review a patch shrinks into something far more managable for some maintainers.

Quoted 7 lines

I really disagree. I am pretty sure maintainers are very well aware of how the patch is important. Some do no care about stable and I agree you should poke those. But some have really good reasons to not throw many patches that direction because they do not feel the patch is important enough.

Remember this is not about numbers. The more is not always better.

So what is "important"? Look at the XFS issues, they were important enough to get fixed upstream, and have an appropriate test added to xfstests.

Why didn't they go back to -stable?

Quoted 63 lines
Quoted 20 lines
Quoted 8 lines
Quoted 4 lines

So real bugfixes
that do hit people are not getting to those kernels, which force the distros to do extra work to triage a bug, dig through upstream kernels, find and apply the patch.

I would say that this is the primary role of the distro. To hide the jungle of the upstream work and provide the additional of bug filtering and forwarding them the right direction.

More often than triaging, you'll just be asked to upgrade to the latest version. What sort of user experience does that provide?

[snip]

Quoted 6 lines
Quoted 5 lines

So nothing "new" is happening here, EXCEPT we are actually starting to get a better kernel-wide coverage for stable fixes, which we have not had in the past. That's a good thing! The number of patches applied to stable is still a very very very tiny % compared to mainline, so nothing new is happening here.

Quoted 6 lines
Quoted 3 lines

yes I do agree, the stable process is not very much different from the past and I would tend both processes broken because they explicitly try to avoid maintainers which is just wrong.

Avoid maintainers?! We send so much "spam" trying to get maintainers more involved in the process. How is that avoiding them?

Just read what your wrote again. I am pretty sure AUTOSEL is on filter list on many people. We have a good volume of email traffic already and seeing more automatic one just doesn't help. At all!

Quoted 6 lines

If you're a maintainer who has specific requirements for the -stable flow, or you have any automated testing you'd like to be run on these commits, or you want these mails to come in a different format, or pretty much anything else at all just shoot me a mail!

It's been almost impossible to get maintainers involved in this process.

The whole stable history was that about not bothering maintainers and here is the result.

Quoted 4 lines

We don't sneak anything past maintainers, there are multiple mails over multiple weeks for each commit that would go in. You don't have to review it right away either, just reply with "please don't merge until I'm done reviewing" and it'll get removed from the queue.

I am not talking about sneaking or pushing behind the backs. I am just saying that you cannot do this without direct involvement of maintainers. If they do not respond to bug reports should at them and I am pretty sure that those subsystems will get a bigger pressure to find their way to select _important_ fixes to users who are not running the bleeding edge because those users _matter_ as well (maybe even more because they are a much larger group).

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

Oh, and if you do want to complain about huge new features being backported, look at the mess that Spectre and Meltdown has caused in the stable trees. I don't see anyone complaining about those massive changes :)

Are you serious? Are you going the compare the biggest PITA that the community had to undergo because of HW issues with random pattern matching in changelog/diffs? Come on!

Quoted 7 lines
Quoted 3 lines

HW Issues are irrelevant here. You had a bug that allowed arbitrary kernel memory access. I can easily list quite a few commits, that are not tagged for stable, that fix exactly the same thing.

Those are important fixes and if you are aware of them then you should be involving the respective maintainer. I haven't heard about _any_ maintainer who would refuse to help.

Let's do it this way: let's assume my AUTOSEL project is bad and I'll get rid of it tomorrow.

How do I get the XFS folks to send their stuff to -stable? (we have quite a few customers who use XFS)

How do I get the KVM folks to be more consistent about tagging patches for -stable? (we support nested KVM!)

How Do I get people who are not aware of how the -stable project to tag their commits properly? (there's quite a long tail of authors sending 1 important bugfix and disappearing forever)

We can agree that just asking them nicely doesn't work: Greg has been poking maintainers for years, the -stable project got bunch of publicity, and the instructions for including a patch in -stable are pretty straightforward.

You're saying that AUTOSEL doesn't work, so let's ignore that too.

How should we proceed?

#60 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 2 lines · Sasha Levin

How do I get the XFS folks to send their stuff to -stable? (we have quite a few customers who use XFS)

If XFS (or *any* other subsystem) doesn't have enough manpower of upstream maintainers to deal with stable, we just have to accept that and find an answer to that.

If XFS folks claim that they don't have enough mental capacity to create/verify XFS backports, I totally don't see how any kind of AI would have.

If your business relies on XFS (and so does ours, BTW) or any other subsystem that doesn't have enough manpower to care for stable, the proper solution (and contribution) would be just bringing more people into the XFS community.

To put it simply -- I don't think the simple lack of actual human brainpower can be reasonably resolved in other way than bringing more of it in.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
#61 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 8 lines · Jiri Kosina
Quoted 2 lines · Sasha Levin

How do I get the XFS folks to send their stuff to -stable? (we have quite a few customers who use XFS)

If XFS (or *any* other subsystem) doesn't have enough manpower of upstream maintainers to deal with stable, we just have to accept that and find an answer to that.

This is exactly what I'm doing. Many subsystems don't have enough manpower to deal with -stable, so I'm trying to help.

Quoted 3 lines

If XFS folks claim that they don't have enough mental capacity to create/verify XFS backports, I totally don't see how any kind of AI would have.

Because creating backports is not all about mental capacity!

A lot of time gets wasted on going through the list of commits, backporting each of those commits into every -stable tree we have, building it, running tests, etc.

So it's not all about pure mental capacity, but more about the time per-patch it takes to get -stable done.

If I can cut down on that, by suggesting a list of commits, doing builds and tests, what's the problem?

Quoted 4 lines

If your business relies on XFS (and so does ours, BTW) or any other subsystem that doesn't have enough manpower to care for stable, the proper solution (and contribution) would be just bringing more people into the XFS community.

Microsoft's business relies on quite a few kernel subsystems. While we try to bring more people in the kernel (we're hiring!), as you might know it's not easy getting kernel folks.

So just "get more people" isn't a good solution. It doesn't scale either.

Quoted 10 lines

To put it simply -- I don't think the simple lack of actual human brainpower can be reasonably resolved in other way than bringing more of it in.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
#62 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 6 lines · Sasha Levin
Quoted 5 lines · Jiri Kosina
Quoted 2 lines · Sasha Levin

How do I get the XFS folks to send their stuff to -stable? (we have quite a few customers who use XFS)

Quoted 6 lines
Quoted 3 lines

If XFS (or *any* other subsystem) doesn't have enough manpower of upstream maintainers to deal with stable, we just have to accept that and find an answer to that.

This is exactly what I'm doing. Many subsystems don't have enough manpower to deal with -stable, so I'm trying to help.

...and the torrent of spams from the AUTOSEL subsystem actually makes that worse.

And when you are told particular fix to LEDs is not that important after all, you start arguing about nuclear power plants (without really knowing how critical subsystems work).

If you want cooperation with maintainers to work, the rules need to be clear, first. They are documented, so follow them. If you think rules are wrong, lets talk about changing the rules; but arguing "every bug is important because someone may be hitting it" is not ok.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#63 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 14 lines · Pavel Machek
Quoted 6 lines · Sasha Levin
Quoted 5 lines · Jiri Kosina
Quoted 2 lines · Sasha Levin

How do I get the XFS folks to send their stuff to -stable? (we have quite a few customers who use XFS)

Quoted 6 lines
Quoted 3 lines

If XFS (or *any* other subsystem) doesn't have enough manpower of upstream maintainers to deal with stable, we just have to accept that and find an answer to that.

This is exactly what I'm doing. Many subsystems don't have enough manpower to deal with -stable, so I'm trying to help.

Quoted 6 lines

...and the torrent of spams from the AUTOSEL subsystem actually makes that worse.

And when you are told particular fix to LEDs is not that important after all, you start arguing about nuclear power plants (without really knowing how critical subsystems work).

Obviously your knowledge far surpasses mine.

Quoted 4 lines

If you want cooperation with maintainers to work, the rules need to be clear, first. They are documented, so follow them. If you think rules are wrong, lets talk about changing the rules; but arguing "every bug is important because someone may be hitting it" is not ok.

I'm sorry but you're just unfamiliar with the process. I'd point out that all my AUTOSEL commits go through Greg, who wrote the rules, and accepts my patches.

The rules are there as a guideline to allow us to not take certain patches, they're not there as a strict set of rules we must follow at all times.

#64 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Jiri Kosina
Quoted 13 lines · Jiri Kosina
Quoted 2 lines · Sasha Levin

How do I get the XFS folks to send their stuff to -stable? (we have quite a few customers who use XFS)

If XFS (or *any* other subsystem) doesn't have enough manpower of upstream maintainers to deal with stable, we just have to accept that and find an answer to that.

If XFS folks claim that they don't have enough mental capacity to create/verify XFS backports, I totally don't see how any kind of AI would have.

Quoted 8 lines

If your business relies on XFS (and so does ours, BTW) or any other subsystem that doesn't have enough manpower to care for stable, the proper solution (and contribution) would be just bringing more people into the XFS community.

To put it simply -- I don't think the simple lack of actual human brainpower can be reasonably resolved in other way than bringing more of it in.

Not to worry... soon enough it'll be submitting properly massaged backports of the stuff it submitted upstream :)

-Mike

#65 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Greg KH
Quoted 1 line · Greg KH

It already is that :)

I have a question: I guess a stable team has an idea who they are preparing the tree for, IOW who is the target consumer. Who is it?

Certainly it's not major distros, as both RH and SUSE already stated that they are either not basing off the stable kernel (only cherry-pick fixes from it) (RH), or are quite far in the process of moving away from stable tree towards combination of what RH is doing + semi-automated evaluation of Fixes: tag (SUSE).

If the target audience is somewhere else, that's perfectly fine, but then it'd have to be stated explicitly I guess.

I can't speak for RH, but for us (at least me personally), the pace of patches flowing into -stable is way too high for us to keep control of what is landing in our tree.

In some sense, stability should be equivalent to "minimal necessary amout of super-critical changes". That's not what this "let's backport proactively almost everything that has word 'fixes' in changelog" (I'm a bit exaggerating of course) seems to be about.

Again, the rules stated out in

Documentation/process/stable-kernel-rules.rst

are very nice, and are exactly something at least we would be very happy about. They have the nice hidden asumption in them, that someone actually has to actively invest human brain power to think about the fix, its consequences, prerequisities, etc. Not just doing a big dump of all commits that "might fix something".

How many of the actual patches flowing into -stable would satisfy those criteria these days?

IOW, I'm pretty sure our users are much happier with us supplying them reactive fixes than pro-active uncertainity.

Quoted 2 lines

The problem Sasha is trying to solve here is that for many subsystems, maintainers do not mark patches for stable at all.

The pressure on those subsystems should be coming from unhappy users (being it end-users or vendors redistributing the tree) of the stable tree, who would be complaining about missing fixes for those subsystems. Is this actually happening? Where?

Quoted 4 lines

Oh, and if you do want to complain about huge new features being backported, look at the mess that Spectre and Meltdown has caused in the stable trees. I don't see anyone complaining about those massive changes :)

Umm, sorry, how is this related?

There simply was no other way, and I took it for given that this is seen by everybody involved as an absolute exception, due to the nature of the issue and of the massive changes that were needed.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
#66 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Sasha Levin
Quoted 20 lines · Sasha Levin
Quoted 19 lines · Jiri Kosina
Quoted 3 lines · Sasha Levin

So I think that Linus's claim that users come first applies here as well. If there's a user that cares about a particular feature being broken, then we go ahead and fix his bug rather then ignoring him.

So one extreme is fixing -stable *iff* users actually do report an issue.

The other extreme is backporting everything that potentially looks like a potential fix of "something" (according to some arbitrary metric), pro-actively.

The former voilates the "users first" rule, the latter has a very, very high risk of regressions.

So this whole debate is about finding a compromise.

My gut feeling always was that the statement in

Quoted 7 lines
Quoted 4 lines

Documentation/process/stable-kernel-rules.rst

is very reasonable, but making the process way more "aggresive" when backporting patches is breaking much of its original spirit for me.

I agree that as an enterprise distro taking everything from -stable isn't the best idea. Ideally you'd want to be close to the first

Original purpose of -stable was "to be common base of enterprise distros" and our documentation still says it is.

Quoted 4 lines

I think that we can agree that it's impossible to expect every single Linux user to go on LKML and complain about a bug he encountered, so the rule quickly becomes "It must fix a real bug that can bother people".

I think you are playing dangerous word games.

Quoted 6 lines

My "aggressiveness" comes from the whole "bother" part: it doesn't have to be critical, it doesn't have to cause data corruption, it doesn't have to be a security issue. It's enough that the bug actually affects a user in a way he didn't expect it to (if a user doesn't have expectations, it would fall under the "This could be a problem..." exception.

And it seems documentation says you should be less aggressive and world tells you they expect to be less aggressive. So maybe that's what you should do?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#67 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 23 lines · Pavel Machek
Quoted 22 lines · Sasha Levin
Quoted 21 lines · Jiri Kosina
Quoted 3 lines · Sasha Levin

So I think that Linus's claim that users come first applies here as well. If there's a user that cares about a particular feature being broken, then we go ahead and fix his bug rather then ignoring him.

So one extreme is fixing -stable *iff* users actually do report an issue.

The other extreme is backporting everything that potentially looks like a potential fix of "something" (according to some arbitrary metric), pro-actively.

The former voilates the "users first" rule, the latter has a very, very high risk of regressions.

So this whole debate is about finding a compromise.

My gut feeling always was that the statement in

Documentation/process/stable-kernel-rules.rst

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

is very reasonable, but making the process way more "aggresive" when backporting patches is breaking much of its original spirit for me.

I agree that as an enterprise distro taking everything from -stable isn't the best idea. Ideally you'd want to be close to the first

Original purpose of -stable was "to be common base of enterprise distros" and our documentation still says it is.

I guess that the world changes?

At this point calling enterprise distros a niche wouldn't be too far from the truth. Furthermore, some enterprise distros (as stated earlier in this thread) don't even follow -stable anymore and cherry pick their own commits.

So no, the main driving force behind -stable is not traditional enterprise distributions.

Quoted 14 lines
Quoted 4 lines

I think that we can agree that it's impossible to expect every single Linux user to go on LKML and complain about a bug he encountered, so the rule quickly becomes "It must fix a real bug that can bother people".

I think you are playing dangerous word games.

Quoted 6 lines

My "aggressiveness" comes from the whole "bother" part: it doesn't have to be critical, it doesn't have to cause data corruption, it doesn't have to be a security issue. It's enough that the bug actually affects a user in a way he didn't expect it to (if a user doesn't have expectations, it would fall under the "This could be a problem..." exception.

Quoted 3 lines

And it seems documentation says you should be less aggressive and world tells you they expect to be less aggressive. So maybe that's what you should do?

Who is this "world" you're referring to?

#68 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Pavel Machek
Quoted 6 lines · On Mon, 16 Apr 2018 18:06:08 +0200 Pavel Machek <[email protected]> wrote:

That means you want to ignore not-so-serious bugs, because benefit of fixing them is lower than risk of the regressions. I believe bugs that do not bother anyone should _not_ be fixed in stable.

That was case of the LED patch. Yes, the commit fixed bug, but it introduced regressions that were fixed by subsequent patches.

I agree. I would disagree that the patch this thread is on should go to stable. What's the point of stable if it introduces regressions by backporting bug fixes for non major bugs.

Every fix I make I consider labeling it for stable. The ones I don't, I feel the bug fix is not worth the risk of added regressions.

I worry that people will get lazy and stop marking commits for stable (or even thinking about it) because they know that there's a bot that will pull it for them. That thought crossed my mind. Why do I want to label anything stable if a bot will probably catch it. Then I could just wait till the bot posts it before I even think about stable.

-- Steve

#69 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 7 lines · Steven Rostedt
Quoted 4 lines · On Mon, 16 Apr 2018 18:06:08 +0200 Pavel Machek <[email protected]> wrote:

That means you want to ignore not-so-serious bugs, because benefit of fixing them is lower than risk of the regressions. I believe bugs that do not bother anyone should _not_ be fixed in stable.

Quoted 6 lines
Quoted 2 lines

That was case of the LED patch. Yes, the commit fixed bug, but it introduced regressions that were fixed by subsequent patches.

I agree. I would disagree that the patch this thread is on should go to stable. What's the point of stable if it introduces regressions by backporting bug fixes for non major bugs.

One such reason is that users will then hit the regression when they upgrade to the next -stable version anyways.

Quoted 8 lines

Every fix I make I consider labeling it for stable. The ones I don't, I feel the bug fix is not worth the risk of added regressions.

I worry that people will get lazy and stop marking commits for stable (or even thinking about it) because they know that there's a bot that will pull it for them. That thought crossed my mind. Why do I want to label anything stable if a bot will probably catch it. Then I could just wait till the bot posts it before I even think about stable.

People are already "lazy". You are actually an exception for marking your commits.

Yes, folks will chime in with "sure, I mark my patches too!", but if you look at the entire committer pool in the kernel you'll see that most don't bother with this to begin with.

#70 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 11 lines · Sasha Levin
Quoted 10 lines · Steven Rostedt
Quoted 6 lines · On Mon, 16 Apr 2018 18:06:08 +0200 Pavel Machek <[email protected]> wrote:

That means you want to ignore not-so-serious bugs, because benefit of fixing them is lower than risk of the regressions. I believe bugs that do not bother anyone should _not_ be fixed in stable.

That was case of the LED patch. Yes, the commit fixed bug, but it introduced regressions that were fixed by subsequent patches.

Quoted 6 lines
Quoted 3 lines

I agree. I would disagree that the patch this thread is on should go to stable. What's the point of stable if it introduces regressions by backporting bug fixes for non major bugs.

One such reason is that users will then hit the regression when they upgrade to the next -stable version anyways.

Well, yes, testing is required when moving from 4.14 to 4.15. But testing should not be required when moving from 4.14.5 to 4.14.6.

Quoted 9 lines
Quoted 8 lines

Every fix I make I consider labeling it for stable. The ones I don't, I feel the bug fix is not worth the risk of added regressions.

I worry that people will get lazy and stop marking commits for stable (or even thinking about it) because they know that there's a bot that will pull it for them. That thought crossed my mind. Why do I want to label anything stable if a bot will probably catch it. Then I could just wait till the bot posts it before I even think about stable.

Quoted 6 lines

People are already "lazy". You are actually an exception for marking your commits.

Yes, folks will chime in with "sure, I mark my patches too!", but if you look at the entire committer pool in the kernel you'll see that most don't bother with this to begin with.

So you take everything and put it into stable? I don't think that's a solution.

If you are worried about people not putting enough "Stable: " tags in their commits, perhaps you can write them emails "hey, I think this should go to stable, do you agree"? You should get people marking their commits themselves pretty quickly...

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#71 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 16 lines · Pavel Machek
Quoted 15 lines · Sasha Levin
Quoted 13 lines · Steven Rostedt
Quoted 6 lines · On Mon, 16 Apr 2018 18:06:08 +0200 Pavel Machek <[email protected]> wrote:

That means you want to ignore not-so-serious bugs, because benefit of fixing them is lower than risk of the regressions. I believe bugs that do not bother anyone should _not_ be fixed in stable.

That was case of the LED patch. Yes, the commit fixed bug, but it introduced regressions that were fixed by subsequent patches.

I agree. I would disagree that the patch this thread is on should go to stable. What's the point of stable if it introduces regressions by backporting bug fixes for non major bugs.

Quoted 5 lines
Quoted 2 lines

One such reason is that users will then hit the regression when they upgrade to the next -stable version anyways.

Well, yes, testing is required when moving from 4.14 to 4.15. But testing should not be required when moving from 4.14.5 to 4.14.6.

You always have to test, even without the AUTOSEL stuff. The rejection rate was 2% even before AUTOSEL, so there was always a chance of regression when upgrading minor stable versions.

Quoted 12 lines
Quoted 12 lines
Quoted 8 lines

Every fix I make I consider labeling it for stable. The ones I don't, I feel the bug fix is not worth the risk of added regressions.

I worry that people will get lazy and stop marking commits for stable (or even thinking about it) because they know that there's a bot that will pull it for them. That thought crossed my mind. Why do I want to label anything stable if a bot will probably catch it. Then I could just wait till the bot posts it before I even think about stable.

People are already "lazy". You are actually an exception for marking your commits.

Quoted 6 lines
Quoted 3 lines

Yes, folks will chime in with "sure, I mark my patches too!", but if you look at the entire committer pool in the kernel you'll see that most don't bother with this to begin with.

So you take everything and put it into stable? I don't think that's a solution.

I don't think I ever said that I want to put *everything*

Quoted 4 lines

If you are worried about people not putting enough "Stable: " tags in their commits, perhaps you can write them emails "hey, I think this should go to stable, do you agree"? You should get people marking their commits themselves pretty quickly...

Greg has been doing this for years, ask him how that worked out for him.

#72 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 6 lines · On Mon, 16 Apr 2018 16:43:13 +0000 Sasha Levin <[email protected]>…
Quoted 4 lines

If you are worried about people not putting enough "Stable: " tags in their commits, perhaps you can write them emails "hey, I think this should go to stable, do you agree"? You should get people marking their commits themselves pretty quickly...

Greg has been doing this for years, ask him how that worked out for him.

Then he shouldn't pull in the fix. Let it be broken. As soon as someone complains about it being broken, then bug the maintainer again. "Hey, this is broken in 4.x, and this looks like the fix for it. Do you agree?"

I agree that some patches don't need this discussion. Things that are obvious. Off-by-one and stack-overflow and other bugs like that. Or another common bug is error paths that don't release locks. These should just be backported. But subtle fixes like this thread should default to (not backport unless someones complains or the author/maintainer acks it).

-- Steve

#73 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 15 lines · Steven Rostedt
Quoted 6 lines · On Mon, 16 Apr 2018 16:43:13 +0000 Sasha Levin <[email protected]>…
Quoted 4 lines

If you are worried about people not putting enough "Stable: " tags in their commits, perhaps you can write them emails "hey, I think this should go to stable, do you agree"? You should get people marking their commits themselves pretty quickly...

Greg has been doing this for years, ask him how that worked out for him.

Then he shouldn't pull in the fix. Let it be broken. As soon as someone complains about it being broken, then bug the maintainer again. "Hey, this is broken in 4.x, and this looks like the fix for it. Do you agree?"

Quoted 6 lines

I agree that some patches don't need this discussion. Things that are obvious. Off-by-one and stack-overflow and other bugs like that. Or another common bug is error paths that don't release locks. These should just be backported. But subtle fixes like this thread should default to (not backport unless someones complains or the author/maintainer acks it).

Agreed. And it scares me we are even discussing this.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#74 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Steven Rostedt
Quoted 8 lines · Steven Rostedt
Quoted 5 lines · On Mon, 16 Apr 2018 16:43:13 +0000 Sasha Levin <[email protected]>…
Quoted 4 lines

If you are worried about people not putting enough "Stable: " tags in their commits, perhaps you can write them emails "hey, I think this should go to stable, do you agree"? You should get people marking their commits themselves pretty quickly...

Quoted 6 lines
Quoted 1 line

Greg has been doing this for years, ask him how that worked out for him.

Then he shouldn't pull in the fix. Let it be broken. As soon as someone complains about it being broken, then bug the maintainer again. "Hey, this is broken in 4.x, and this looks like the fix for it. Do you agree?"

If that process would work, I would also get ACK/NACK on every AUTOSEL request I'm sending.

What usually happens with customer reported issues is that either they're just told to upgrade to the latest kernel (where the bug is fixed), or if the distro team can't get them to do that and go hunting for that bug, they'll just pick it for their kernel tree without ever telling -stable.

I had a project to get all the fixes Cannonical had in their trees that we're not in -stable. We're talking hundreds of patches here.

Quoted 6 lines

I agree that some patches don't need this discussion. Things that are obvious. Off-by-one and stack-overflow and other bugs like that. Or another common bug is error paths that don't release locks. These should just be backported. But subtle fixes like this thread should default to (not backport unless someones complains or the author/maintainer acks it).

Let's play a "be the -stable maintainer" game. Would you take any of the following commits?

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit?id=fc90441e728aa461a8ed1cfede08b0b9efef43fb
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit?id=a918d2bcea6aab6e671bfb0901cbecc3cf68fca1
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit?id=b1999fa6e8145305a6c8bda30ea20783717708e6

#75 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 4 lines · On Mon, 16 Apr 2018 17:09:38 +0000 Sasha Levin <[email protected]>…

Let's play a "be the -stable maintainer" game. Would you take any of the following commits?

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit?id=fc90441e728aa461a8ed1cfede08b0b9efef43fb

No, not automatically, or without someone from KVM letting me know what side-effects that may have. Not stopping on a breakpoint is not that critical, it may be a bit annoying. I would ask the KVM maintainers if they feel it's critical enough for backporting, but without hearing from them, I would leave it be.

Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit?id=a918d2bcea6aab6e671bfb0901cbecc3cf68fca1

Sure. Even if it has a subtle regression, that's a critical bug being fixed.

Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit?id=b1999fa6e8145305a6c8bda30ea20783717708e6

I would consider unlocking a mutex that one didn't lock a critical bug, so yes.

Again, things that deal with locking or buffer overflows, I would take the fix, as those are critical. But other behavior issues where it's not critical, I would leave be unless told further by someone else.

-- Steve

#76 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 6 lines · Steven Rostedt
Quoted 3 lines · On Mon, 16 Apr 2018 17:09:38 +0000 Sasha Levin <[email protected]>…

Let's play a "be the -stable maintainer" game. Would you take any of the following commits?

Quoted 7 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit?id=fc90441e728aa461a8ed1cfede08b0b9efef43fb

No, not automatically, or without someone from KVM letting me know what side-effects that may have. Not stopping on a breakpoint is not that critical, it may be a bit annoying. I would ask the KVM maintainers if they feel it's critical enough for backporting, but without hearing from them, I would leave it be.

Fair enough.

Quoted 4 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit?id=a918d2bcea6aab6e671bfb0901cbecc3cf68fca1

Sure. Even if it has a subtle regression, that's a critical bug being fixed.

This was later reverted, in -stable:

"""
Commit d63c7dd5bcb9 ("ipr: Fix out-of-bounds null overwrite") removed the end of line handling when storing the update_fw sysfs attribute. This changed the userpace API because it started refusing writes terminated by a line feed, which broke the update tools we already have. """

Quoted 8 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit?id=b1999fa6e8145305a6c8bda30ea20783717708e6

I would consider unlocking a mutex that one didn't lock a critical bug, so yes.

Again, things that deal with locking or buffer overflows, I would take the fix, as those are critical. But other behavior issues where it's not critical, I would leave be unless told further by someone else.

This too, was reverted:

"""
It causes run-time breakage in the 4.4-stable tree and more patches are needed to be applied first before this one in order to resolve the issue.
"""

This is how fun it is reviewing AUTOSEL commits :)

Even the small "trivial", "obviously correct" patches have room for errors for various reasons.

Also note that all of these patches were tagged for stable and actually ended up in at least one tree.

This is why I'm basing a lot of my decision making on the rejection rate. If the AUTOSEL process does the job well enough as the "regular" process did before, why push it back?

#77 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 5 lines · On Mon, 16 Apr 2018 17:42:38 +0000 Sasha Levin <[email protected]>…
Quoted 4 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit?id=a918d2bcea6aab6e671bfb0901cbecc3cf68fca1

Sure. Even if it has a subtle regression, that's a critical bug being fixed.

Quoted 8 lines

This was later reverted, in -stable:

"""
Commit d63c7dd5bcb9 ("ipr: Fix out-of-bounds null overwrite") removed the end of line handling when storing the update_fw sysfs attribute. This changed the userpace API because it started refusing writes terminated by a line feed, which broke the update tools we already have. """

I hope it wasn't reverted. It did fix a critical bug.

The problem is that it only fixed a critical bug, but didn't go far enough to keep the bug fix from breaking API. I see this as two bugs being fixed. Even though the second bug was "caused" by the first fix. the first fix was still necessary. The second bug was relying on broken code. This hasn't changed my position on that patch from being backported. I would not even mark this as a regression. I would say the original code was broken too much, and fixing part of it just showed revealed another broken part.

Quoted 10 lines
Quoted 9 lines
Quoted 2 lines

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit?id=b1999fa6e8145305a6c8bda30ea20783717708e6

I would consider unlocking a mutex that one didn't lock a critical bug, so yes.

Again, things that deal with locking or buffer overflows, I would take the fix, as those are critical. But other behavior issues where it's not critical, I would leave be unless told further by someone else.

Quoted 7 lines

This too, was reverted:

"""
It causes run-time breakage in the 4.4-stable tree and more patches are needed to be applied first before this one in order to resolve the issue.
"""

It wasn't reverted in mainline. Looks like there was some subtle issues with the different stable versions. Perhaps the "fixes" was wrong.

Quoted 5 lines

This is how fun it is reviewing AUTOSEL commits :)

Even the small "trivial", "obviously correct" patches have room for errors for various reasons.

And that's fine. Any code written can have bugs in it. That's just a given. Which pushes for why we should be extremely picky about what we backport.

Quoted 7 lines

Also note that all of these patches were tagged for stable and actually ended up in at least one tree.

This is why I'm basing a lot of my decision making on the rejection rate. If the AUTOSEL process does the job well enough as the "regular" process did before, why push it back?

Because I think we are adding too many patches to stable. And automating it may just make things worse. Your examples above back my argument more than they refute it. If people can't determine what is "obviously correct" how is automation going to do any better?

-- Steve

#78 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 3 lines · Steven Rostedt

The problem is that it only fixed a critical bug, but didn't go far enough to keep the bug fix from breaking API.

An API breakage that gets noticed *is* a crtitical bug.

You can't call something else critical and then say "but it broken API".

Seriously. Why do I even have to mention this?

If you break user workflows, NOTHING ELSE MATTERS.

Even security is secondary to "people don't use the end result, because it doesn't work for them any more".

Really.

Stop with this idiotic "only API". Breaking user space is just about the only thing that really matters. The rest is "small matter of implementation".

Linus

#79 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 6 lines · On Mon, 16 Apr 2018 11:30:06 -0700 Linus Torvalds…
Quoted 3 lines · Steven Rostedt

The problem is that it only fixed a critical bug, but didn't go far enough to keep the bug fix from breaking API.

An API breakage that gets noticed *is* a crtitical bug.

I totally agree with you. You misunderstood what I wrote.

I said there were two bugs here. The first bug was a possible accessing bad memory bug. That needed to be fixed. The problem was by fixing that, it broke API. But that's because the original code was broken where it relied on broken code to get right. I never said the second bug fix should not have been backported. I even said that the first bug "didn't go far enough".

I hope the answer was not to revert the bug and put back the possible bad memory access in to keep API. But it was to backport the second bug fix that still has the first fix, but fixes the API breakage.

Yes, an API breakage is something I would label as critical to be backported.

-- Steve

#80 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 4 lines · Steven Rostedt

I never said the second
bug fix should not have been backported. I even said that the first bug "didn't go far enough".

You're still not getting it.

The "didn't go far enough" means that the bug fix is *BUGGY*. It needs to be reverted.

Quoted 2 lines

I hope the answer was not to revert the bug and put back the possible bad memory access in to keep API.

But that very must *IS* the answer. If there isn't a fix for the ABI breakage, then the first bugfix needs to be reverted.

Really. There is no such thing as "but the fix was more important than the bug it introduced".

This is why we started with the whole "actively revert things that introduce regressions". Because people always kept claiming that "but but I fixed a worse bug, and it's better to fix the worse bug even if it then introduces another problem, because the other problem is lesser".

NO.

We're better off making *no* progress, than making "unsteady progress".

Really. Seriously.

If you cannot fix a bug without introducing another one, don't do it. Don't do kernel development.

The whole mentality you show is NOT ACCEPTABLE.

So the *only* answer is: "fix the bug _and_ keep the API". There is no other choice.

The whole "I fixed one problem but introduced another" is not how we work. You should damn well know that. There are no excuses.

And yes, sometimes that means jumping through hoops. But that's what it takes to keep users happy.

Linus

#81 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 4 lines · Linus Torvalds

We're better off making *no* progress, than making "unsteady progress".

Really. Seriously.

Side note: the original impetus for this was our suspend/resume mess. It went on for *YEARS*, and it was absolutely chock-full of exactly this "I fixed the worse problem, and introduced another one".

There's a reason I'm a hardliner on the regression issue. We've been there, we've done that.

The whole "two steps forwards, one step back" mentality may work really well if you're doing line dancing.

BUT WE ARE NOT LINE DANCING. We do kernel development.

Absolutely NOTHING else is more important than the "no regressions" rule. NOTHING.

And just since everybody always tries to weasel about this: the only regressions that matter are the ones that people notice in real loads.

So if you write a test-case that tests that "system call number 345 returns -ENOSYS", and we add a new system call, and you say "hey, you regressed my system call test", that's not a regression. That's just a "change in behavior".

It becomes a regression only if there are people using tools or workflows that actually depend on it. So if it turns out (for example) that Firefox had some really odd bug, and the intent was to do system call 123, but a typo had caused it to do system call 345 instead, and another bug meant that the end result worked fine as long as system call 345 returned ENOSYS, then the addition of that system call actually does turn into a regression.

See? Even adding a system call can be a regression, because what matters is not behavior per se, but users _depending_ on some specific behavior.

Linus

#82 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 6 lines · On Mon, 16 Apr 2018 12:00:08 -0700 Linus Torvalds…
Quoted 6 lines
Quoted 4 lines · Linus Torvalds

We're better off making *no* progress, than making "unsteady progress".

Really. Seriously.

[ me inserted: ]

Quoted 10 lines · Steven Rostedt
Quoted 4 lines

I'm talking about the given example of a simple memory bug that caused a very subtle breakage of API, which had another trivial fix that should be backported. I'm not sure that's what you were talking about.

Side note: the original impetus for this was our suspend/resume mess. It went on for *YEARS*, and it was absolutely chock-full of exactly this "I fixed the worse problem, and introduced another one".

What you are talking about here isn't what I was talking about above ;-)

-- Steve

#83 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Linus Torvalds
Quoted 3 lines · Linus Torvalds

And yes, sometimes that means jumping through hoops. But that's what it takes to keep users happy.

The example of "jumping through hoops" I tend to give is the pipe "packet mode".

The kernel actually has a magic pipe mode for "packet buffers", so that if you do two small writes, the other side of the pipe can actually say "I want to read not the pipe buffers, but the individual packets".

Why would we do that? That's not how pipes work! If you want to send and receive messages, use a socket, for chrissake! A pipe is just a stream of bytes - as the elder Gods of Unix decreed!

But it turns out that we added the notion of a packetized pipe writer, and you can actually access it in user space by setting the O_DIRECT flag (so after you do the "pipe()" system call, do a fcntl(SETFL, O_DIRECT) on it).

Absolutely nobody uses it, afaik, because you'd be crazy to do it. What would be the point? sockets work, and are portable.

So why do we have it?

We have it for one single user: autofs. The way you talk to the kernel side of things is with a magic pipe that you get at mount time, and the user-space autofs daemon might be 32-bit even if the kernel is 64-bit, and we had a horrible ABI mistake which meant that sending the binary data over that pipe had different format for a 32-bit autofsd.

And systemd and automount had different workarounds (or lack there-of), for the ABI issue.

So the whole "ok, allow people to send packets, and read them as packets" came about purely because the ABI was broken, and there was no other way to fix things.

See 64f371bc3107 ("autofs: make the autofsv5 packet file descriptor use a packetized pipe") for (some) of the sad details.

That commit kind of makes it sound like it's a nice solution that just takes advantage of the packetized pipes. Nice and clean fix, right?

No. The packetized pipes exist in the first place _purely_ to make that nice solution possible. It's literally just a "this allows us to be ABI compatible with two different users that were confused about the compatibility issue we had due to a broken binary structure format acrss x86-32 and x86-64".

See commit 9883035ae7ed ("pipes: add a "packetized pipe" mode for writing") for the other side of that.

All this just because _we_ made a mistake in our ABI, and then real life users started using that mistake, including one user that literally *knew* about the mistake and worked around it and started depending on the fact t hat our compatibility mode was buggy because of it.

So it was a bug in our ABI. But since people depended on the bug, the bug was a feature, and needed to be kept around. In this case by adding a totally new and unrelated feature, and using that new feature to make those old users happy. The whole "set packetized mode on the autofs pipe" is all done transparently inside the kernel, and automount never knew or needed to care that we started to use a packetized pipe to get the data it sent us in the chunks it intended.

Linus

#84 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Linus Torvalds
Quoted 10 lines · On Mon, 16 Apr 2018 11:52:48 -0700 Linus Torvalds…
Quoted 4 lines · Steven Rostedt

I never said the second
bug fix should not have been backported. I even said that the first bug "didn't go far enough".

You're still not getting it.

The "didn't go far enough" means that the bug fix is *BUGGY*. It needs to be reverted.

It wasn't reverted. Look at the code in question.

Commit d63c7dd5bcb

+++ b/drivers/scsi/ipr.c
@@ -4003,13 +4003,12 @@ static ssize_t ipr_store_update_fw(struct device *dev,
struct ipr_sglist *sglist;
char fname[100];
char *src;
- int len, result, dnld_size;
+ int result, dnld_size;

if (!capable(CAP_SYS_ADMIN))
return -EACCES;

- len = snprintf(fname, 99, "%s", buf);
- fname[len-1] = '\0';
+ snprintf(fname, sizeof(fname), "%s", buf);

if (request_firmware(&fw_entry, fname, &ioa_cfg->pdev->dev)) {
dev_err(&ioa_cfg->pdev->dev, "Firmware file %s not found\n", fname);

The bug is that len returned by snprintf() can be much larger than 100. That fname[len-1] = '\0' can allow a user to decide where to write zeros.

That patch never got reverted in mainline. It was fixed with this:

Commit 21b81716c6bf

drivers/scsi/ipr.c +5 -0
@@ -4002,6 +4002,7 @@ static ssize_t ipr_store_update_fw(struct device *dev,
        struct ipr_sglist *sglist;
        char fname[100];
        char *src;
+       char *endline;
        int result, dnld_size;
 
        if (!capable(CAP_SYS_ADMIN))
@@ -4009,6 +4010,10 @@ static ssize_t ipr_store_update_fw(struct device *dev,
 
        snprintf(fname, sizeof(fname), "%s", buf);
 
+       endline = strchr(fname, '\n');
+       if (endline)
+               *endline = '\0';
+
        if (request_firmware(&fw_entry, fname, &ioa_cfg->pdev->dev)) {
                dev_err(&ioa_cfg->pdev->dev, "Firmware file %s not found\n", fname);
                return -EIO;
Quoted 6 lines
Quoted 3 lines

I hope the answer was not to revert the bug and put back the possible bad memory access in to keep API.

But that very must *IS* the answer. If there isn't a fix for the ABI breakage, then the first bugfix needs to be reverted.

It wasn't reverted and that was my point. It just wasn't a complete fix. And I'm saying that once the API breakage became apparent, the second fix should have been backported as well.

I'm not saying that we should allow API breakage to fix a critical bug. I'm saying that the API breakage was really a secondary bug that needed to be addressed. My point is the first fix was NOT reverted!

Quoted 3 lines

Really. There is no such thing as "but the fix was more important than the bug it introduced".

I'm not saying that.

Quoted 8 lines

This is why we started with the whole "actively revert things that introduce regressions". Because people always kept claiming that "but but I fixed a worse bug, and it's better to fix the worse bug even if it then introduces another problem, because the other problem is lesser".

NO.

Right, but the fix to the API was also trivial. I don't understand why you are arguing with me. I agree with you. I'm talking about this specific instance. Where a bug was fixed, and the API breakage was another fix that needed to be backported.

Are you saying if code could allow userspace to write zeros anywhere in memory, that we should keep it to allow API compatibility?

Quoted 7 lines

We're better off making *no* progress, than making "unsteady progress".

Really. Seriously.

If you cannot fix a bug without introducing another one, don't do it. Don't do kernel development.

Um, I think that's impossible. As the example shows. Not many people would have caught the original fix would caused another bug. That requirement would pretty much keep everyone from ever doing any kernel development.

Quoted 5 lines

The whole mentality you show is NOT ACCEPTABLE.

So the *only* answer is: "fix the bug _and_ keep the API". There is no other choice.

I agree. But that that wasn't the question.

Quoted 6 lines

The whole "I fixed one problem but introduced another" is not how we work. You should damn well know that. There are no excuses.

And yes, sometimes that means jumping through hoops. But that's what it takes to keep users happy.

I'm talking about the given example of a simple memory bug that caused a very subtle breakage of API, which had another trivial fix that should be backported. I'm not sure that's what you were talking about.

-- Steve

#85 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 5 lines · Steven Rostedt

Right, but the fix to the API was also trivial. I don't understand why you are arguing with me. I agree with you. I'm talking about this specific instance. Where a bug was fixed, and the API breakage was another fix that needed to be backported.

Fair enough. Were you there when the report of breakage came in?

Because *my* argument is that reverting something that causes problems is simply *never* the wrong answer.

If you know of the fix, fine. But clearly people DID NOT KNOW. So reverting was the right choice.

Linus

#86 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 3 lines · Linus Torvalds

If you know of the fix, fine. But clearly people DID NOT KNOW. So reverting was the right choice.

.. and this is obviously different in stable and in mainline.

For example, I start reverting very aggressively only at the end of a release. If I get a bisected bug report in the last week, I generally revert without much argument, unless the author of the patch has an immediate fix.

In contrast, during the merge window and the early rc's, I'm perfectly happy to say "ok, let's see if somebody can fix this" and not really consider a revert.

But the -stable tree?

Seriously, what do you expect them to do if they get a report that a commit they added to the stable tree regresses?

"Revert first, ask questions later" is definitely a very sane model there.

Linus

#87 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 7 lines · On Mon, 16 Apr 2018 12:31:09 -0700 Linus Torvalds…

But the -stable tree?

Seriously, what do you expect them to do if they get a report that a commit they added to the stable tree regresses?

"Revert first, ask questions later" is definitely a very sane model there.

The topic of our discussion is on what to backport, and how likely is it to cause regressions. I'm arguing that the bar for backporting should be raised, and that only "critical" fixes should be backported. Sasha pointed this bug fix as an example, and asked me if I would backport it under my conditions. I said yes. He then said "it was reverted", pointing me to the commit that fixed it. That confused me. When I looked further, I noticed that it wasn't reverted, and since he pointed me to the API fix, I said "I hope it wasn't reverted" meaning I hope they backported the obvious API fix and didn't just revert the original fix.

-- Steve

#88 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Linus Torvalds
Quoted 8 lines · On Mon, 16 Apr 2018 12:28:21 -0700 Linus Torvalds…
Quoted 5 lines · Steven Rostedt

Right, but the fix to the API was also trivial. I don't understand why you are arguing with me. I agree with you. I'm talking about this specific instance. Where a bug was fixed, and the API breakage was another fix that needed to be backported.

Fair enough. Were you there when the report of breakage came in?

No I wasn't.

Quoted 6 lines

Because *my* argument is that reverting something that causes problems is simply *never* the wrong answer.

If you know of the fix, fine. But clearly people DID NOT KNOW. So reverting was the right choice.

But I don't see in the git history that this was ever reverted. My reply saying that "I hope it wasn't reverted", was a response for it being reverted in stable, not mainline. Considering that the original bug would allow userspace to write zeros anywhere in memory, I would have definitely worked on finding why the API breakage happened and fixing it properly before putting such a large hole back into the kernel.

I'm assuming that may have been what happened because the commit was never reverted in your tree, and if I was responsible for that code, I would be up all night looking for an API fix to make sure the original fix isn't reverted.

-- Steve

#89 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 4 lines · Steven Rostedt

But I don't see in the git history that this was ever reverted. My reply saying that "I hope it wasn't reverted", was a response for it being reverted in stable, not mainline.

See my other email.

If your'e stable maintainer, and you get a report of a commit that causes problems, your first reaction probably really should just be "revert it".

You can always re-apply it later, but a patch that causes problems is absolutely very much suspect, and automatically should make any stable maintainer go "that needs much more analysis".

Sure, hopefully automation finds the fix too (ie commit 21b81716c6bf "ipr: Fix regression when loading firmware") in mainline.

It did have the proper "fixes" tag, so it should hopefully have been easy to find by the automation that stable people use.

But at the same time, I still maintain that "just revert it" is rather likely the right solution for stable. If it had a bug once, maybe it shouldn't have been applied in the first place.

The author can then get notified by the other stable automation, and at that point argue for "yeah, it was buggy, but together with this other fix it's really important".

But even when that is the case, I really don't see that the author should complain about it being reverted. Because it's *such* a no-brainer in stable.

Linus

#90 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 7 lines · On Mon, 16 Apr 2018 12:55:46 -0700 Linus Torvalds…
Quoted 4 lines · Steven Rostedt

But I don't see in the git history that this was ever reverted. My reply saying that "I hope it wasn't reverted", was a response for it being reverted in stable, not mainline.

See my other email.

Already replied.

Quoted 19 lines

If your'e stable maintainer, and you get a report of a commit that causes problems, your first reaction probably really should just be "revert it".

You can always re-apply it later, but a patch that causes problems is absolutely very much suspect, and automatically should make any stable maintainer go "that needs much more analysis".

Sure, hopefully automation finds the fix too (ie commit 21b81716c6bf "ipr: Fix regression when loading firmware") in mainline.

It did have the proper "fixes" tag, so it should hopefully have been easy to find by the automation that stable people use.

But at the same time, I still maintain that "just revert it" is rather likely the right solution for stable. If it had a bug once, maybe it shouldn't have been applied in the first place.

Quoted 7 lines

The author can then get notified by the other stable automation, and at that point argue for "yeah, it was buggy, but together with this other fix it's really important".

But even when that is the case, I really don't see that the author should complain about it being reverted. Because it's *such* a no-brainer in stable.

But this is going way off topic to what we were discussing. The discussion is about what gets backported. Is automating the process going to make stable better? Or is it likely to add more regressions.

Sasha's response has been that his automated process has the same rate of regressions as what gets tagged by authors. My argument is that perhaps authors should tag less to stable.

-- Steve

#91 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 8 lines · Steven Rostedt

But this is going way off topic to what we were discussing. The discussion is about what gets backported. Is automating the process going to make stable better? Or is it likely to add more regressions.

Sasha's response has been that his automated process has the same rate of regressions as what gets tagged by authors. My argument is that perhaps authors should tag less to stable.

The ones who should matter most for that discussion is the distros, since they are the actual users of stable (as well as the people doing the work, of course - ie Sasha and Greg and the rest of the stable gang).

And I suspect that they actually do want all the noise, and all the stuff that isn't "critical". That's often the _easy_ choice. It's the stuff that I suspect the stable maintainers go "this I don't even have to think about", because it's a new driver ID or something.

Because the bulk of stable tends to be driver updates, afaik. Which distros very much tend to want.

Will developers think that their patches matter so much that they should go to stable? Yes they will. Will they overtag as a result? Probably. But the reverse likely also happens, where people simply don't think about stable at all, and just want to fix a bug.

In many ways "Fixes" is likely a better thing to check for in stable backports, but that doesn't always exist either.

And just judging by the amount of stable email I get - and by how excited _I_ would be about stable work, I think "automated process" is simply not an option. It's a _requirement_. You'd go completely crazy if you didn't automate 99% of all the stable work.

So can you trust the "Cc: stable" as being perfect? Hell no. But what's your alternative? Manually selecting things for stable? Asking the developers separately?

Because "criticality" definitely isn't what determines it. If it was, we'd never add driver ID's etc to stable - they're clearly not "critical".

Yet it feels like that's sometimes those driver things are the _bulk_ of it, and it is usually fairly safe (not quite as obviously safe as you'd think, because a driver ID addition has occasionally meant not just "now it's supported", but instead "now the generic driver doesn't trigger for it any more", so it can actually break things).

So I think - and _hope_ - that 99% of stable should be the non-critical stuff that people don't even need to think about.

The critical stuff is hopefully a tiny tiny percentage.

Linus

#92 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 9 lines · Linus Torvalds

The ones who should matter most for that discussion is the distros, since they are the actual users of stable (as well as the people doing the work, of course - ie Sasha and Greg and the rest of the stable gang).

And I suspect that they actually do want all the noise, and all the stuff that isn't "critical". That's often the _easy_ choice. It's the stuff that I suspect the stable maintainers go "this I don't even have to think about", because it's a new driver ID or something.

So I am a maintainer of SUSE enterprise kernel, and I can tell you I personally really don't want all the noise, simply because

(a) noone asked us to distribute it (if they did, we would do so)
(b) the risk of regressions

We've always been very cautious about what is coming from stable, and actually filtering out patches we actively don't want for one reason or another.

And yes, there is also a history of regressions caused by stable updates that were painful for us ... I brought this up a multiple times at ksummit-discuss@ over past years.

So with the upcoming release, we've actually abandonded stable and are relying more on auto-processing the Fixes: tag.

That is not perfect in both ways (it doesn't cover everything, and we can miss complex semantical dependencies between patches even though they "apply"), but we didn't base our decision this time on aligning our schedule with stable, and so far we don't seem to be suffering. And we have much better overview / control over what is landing in our enterprise tree (of course this all is shepherded by machinery around processing
Fixes: tag, which then though has to be *actively* acted upon, depending on a case-by-case human assessment of how critical it actually is).

Quoted 2 lines

Because the bulk of stable tends to be driver updates, afaik. Which distros very much tend to want.

For "community" distros (like Fedora, openSUSE), perhaps, yeah.

For "enterprise" kernels, quite frankly, we much rather get the driver updates/backports from the respective HW vedndors we're cooperating with, as they have actually tested and verified the backport on the metal.

Quoted 1 line

The critical stuff is hopefully a tiny tiny percentage.

But quite frankly, that's the only thing we as distro *really* want -- to save our users from hitting the critical issues with all the consequences (data loss, unbootable systems, etc). All the rest we can easily handle on a reactive basis, which heavily depends on the userbase spectrum (and that's probably completely different for each -stable tree consumer anyway).

This is a POV of me as an distro kernel maintainer, but mileage of others definitely can / will vary of course.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
#93 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Linus Torvalds
Quoted 6 lines · On Mon, 16 Apr 2018 13:17:24 -0700 Linus Torvalds…
Quoted 5 lines · Steven Rostedt

But this is going way off topic to what we were discussing. The discussion is about what gets backported. Is automating the process going to make stable better? Or is it likely to add more regressions.

Quoted 8 lines
Quoted 3 lines

Sasha's response has been that his automated process has the same rate of regressions as what gets tagged by authors. My argument is that perhaps authors should tag less to stable.

The ones who should matter most for that discussion is the distros, since they are the actual users of stable (as well as the people doing the work, of course - ie Sasha and Greg and the rest of the stable gang).

That was actually my final conclusion before we started out discussion ;-)

http://lkml.kernel.org/r/[email protected]

Quoted 5 lines

And I suspect that they actually do want all the noise, and all the stuff that isn't "critical". That's often the _easy_ choice. It's the stuff that I suspect the stable maintainers go "this I don't even have to think about", because it's a new driver ID or something.

Although Red Hat doesn't base off of the stable kernel. At least it didn't when I was there. They may look at the stable kernel, but they make their own decisions.

If we want the distros to use stable as the base, it should be the least common factor among them. Otherwise, if stable includes commits that a distro would rather not backport, then they wont use stable.

Quoted 17 lines

Because the bulk of stable tends to be driver updates, afaik. Which distros very much tend to want.

Will developers think that their patches matter so much that they should go to stable? Yes they will. Will they overtag as a result? Probably. But the reverse likely also happens, where people simply don't think about stable at all, and just want to fix a bug.

In many ways "Fixes" is likely a better thing to check for in stable backports, but that doesn't always exist either.

And just judging by the amount of stable email I get - and by how excited _I_ would be about stable work, I think "automated process" is simply not an option. It's a _requirement_. You'd go completely crazy if you didn't automate 99% of all the stable work.

Quoted 7 lines

So can you trust the "Cc: stable" as being perfect? Hell no. But what's your alternative? Manually selecting things for stable? Asking the developers separately?

Because "criticality" definitely isn't what determines it. If it was, we'd never add driver ID's etc to stable - they're clearly not "critical".

True. But I believe the driver ID's was given the "exception".

Quoted 11 lines

Yet it feels like that's sometimes those driver things are the _bulk_ of it, and it is usually fairly safe (not quite as obviously safe as you'd think, because a driver ID addition has occasionally meant not just "now it's supported", but instead "now the generic driver doesn't trigger for it any more", so it can actually break things).

So I think - and _hope_ - that 99% of stable should be the non-critical stuff that people don't even need to think about.

The critical stuff is hopefully a tiny tiny percentage.

Well, I'm not sure that's really the case.

$ git log --oneline v4.14.33..v4.14.34 | head -20
ffebeb0d7c37 Linux 4.14.34
fdae5b620566 net/mlx4_core: Fix memory leak while delete slave's resources
9fdeb33e1913 vhost_net: add missing lock nesting notation
8c316b625705 team: move dev_mc_sync after master_upper_dev_link in team_port_add
233ba28e1862 route: check sysctl_fib_multipath_use_neigh earlier than hash
2f8aa659d4c0 vhost: validate log when IOTLB is enabled
72b880f43990 net/mlx5e: Fix traffic being dropped on VF representor
9408bceb0649 net/mlx4_en: Fix mixed PFC and Global pause user control requests
477c73abf26a strparser: Fix sign of err codes
1c71bfe84deb net/sched: fix NULL dereference on the error path of tcf_skbmod_init()
a19024a3f343 net/sched: fix NULL dereference in the error path of tunnel_key_init()
e096c8bf4fb8 net/mlx5e: Sync netdev vxlan ports at open
baab1f0c4885 net/mlx5e: Don't override vport admin link state in switchdev mode
1ec7966ab7db ipv6: sr: fix seg6 encap performances with TSO enabled
e52a45bb392f nfp: use full 40 bits of the NSP buffer address
ddf79878f1e0 net/mlx5e: Fix memory usage issues in offloading TC flows
9282181c1cc5 net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path
b9c6ddda3805 vti6: better validate user provided tunnel names
109dce20c6ed ip6_tunnel: better validate user provided tunnel names
72363c63b070 ip6_gre: better validate user provided tunnel names

The majority of those appear to be on the critical side.

-- Steve

#94 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Steven Rostedt
Quoted 5 lines · Steven Rostedt
Quoted 3 lines · On Mon, 16 Apr 2018 17:42:38 +0000 Sasha Levin <[email protected]>…

Also note that all of these patches were tagged for stable and actually ended up in at least one tree.

Quoted 8 lines
Quoted 3 lines

This is why I'm basing a lot of my decision making on the rejection rate. If the AUTOSEL process does the job well enough as the "regular" process did before, why push it back?

Because I think we are adding too many patches to stable. And automating it may just make things worse. Your examples above back my argument more than they refute it. If people can't determine what is "obviously correct" how is automation going to do any better?

I don't understand that statament, it sounds illogical to me.

If I were to tell you that I have a crack team of 10 kernel hackers who dig through all mainline commits to find commits that should be backported to stable, and they do it with less mistakes than authors/maintainers make when they tag their own commits, would I get the same level of objection?

On the correctness side, I have another effort to improve the quality of testing -stable commits get, but this is somewhat unrelated to the whole automatic selection process.

#95 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 5 lines · On Mon, 16 Apr 2018 18:35:44 +0000 Sasha Levin <[email protected]>…

If I were to tell you that I have a crack team of 10 kernel hackers who dig through all mainline commits to find commits that should be backported to stable, and they do it with less mistakes than authors/maintainers make when they tag their own commits, would I get the same level of objection?

Probably ;-)

I've been struggling with my own stable tags, and been thinking that I too suffer from tagging too much for stable, because there's code I fix, and think "hmm, this could have some unwanted side effects". I'm actually worried that my own fixes could cause an API breakage that I'm unaware of.

What I'm staying is, I think we should start looking at fixes that fix bugs we consider critical. Those being:

* off-by-one
* memory overflow
* locking mismatch
* API regressions

For my sub-system

* wrong data coming out

Which can be a critical issue. Wrong data is worse than no data. But then, there's the times a bug will produce no data, and considering what it is, and how much of an effort it takes to fix it, I may or may not label "no data" issues for stable. The cases where I enable something with a bunch of parameters, and because of some mishandling of the parameter it just screws up totally (where it's obvious that it screwed up), I only mark those for stable if it doesn't require a redesign of the code to fix it. There's been some cases where a redesign was required, and I didn't mark it for stable.

The fixes for tracing that I don't usually tag for stable is when doing complex tracing simply doesn't work and produces no data or errors incorrectly. Depending on how complex the fix is, I mark it for stable, otherwise, I think the fix is more likely to break something else that is more common, then this hardly ever used feature.

The fact that nobody noticed, or hasn't complained about it usually plays a lot in that decision. If someone complained to me about breakage, I'm more likely to label it for stable. But if I discover it myself, as I probably use the tracing system differently than others as I wrote the code, then I don't usually mark it.

-- Steve

#96 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Linus Torvalds
Quoted 10 lines · On Mon, 16 Apr 2018 08:18:09 -0700 Linus Torvalds…
Quoted 4 lines · Steven Rostedt

I wonder if the "AUTOSEL" patches should at least have an "ack-by" from someone before they are pulled in. Otherwise there may be some subtle issues that can find their way into stable releases.

I don't know about anybody else, but I get so many of the patch-bot patches for stable etc that I will *not* reply to normal cases. Only if there's some issue with a patch will I reply.

Quoted 7 lines

I probably do get more than most, but still - requiring active participation for the steady flow of normal stable patches is almost pointless.

Just look at the subject line of this thread. The numbers are so big that you almost need exponential notation for them.

I'm worried about just backporting patches that nobody actually looked at. Is someone going through and vetting that these should definitely be added to stable. I would like to have some trusted human (doesn't even need to be the author or maintainer of the patch) to look at all the patches before they are applied.

I would say anything more than a trivial patch would require author or sub maintainer ack. Look at this patch, I don't think it should go to stable, even though it does fix issues. But the fix is for systems already having issues, and this keeps printk from making things worse. The fix has side effects that other commits have addressed, and if this patch gets backported, those other ones must too.

Maybe I was too strong by saying all patches should be acked, but anything more than buffer overflows and off by one errors probably require a bit more vetting by a human than to just pull in all patches that a bot flags to be backported.

-- Steve

#97 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 21 lines · Steven Rostedt
Quoted 10 lines · On Mon, 16 Apr 2018 08:18:09 -0700 Linus Torvalds…
Quoted 4 lines · Steven Rostedt

I wonder if the "AUTOSEL" patches should at least have an "ack-by" from someone before they are pulled in. Otherwise there may be some subtle issues that can find their way into stable releases.

I don't know about anybody else, but I get so many of the patch-bot patches for stable etc that I will *not* reply to normal cases. Only if there's some issue with a patch will I reply.

Quoted 7 lines

I probably do get more than most, but still - requiring active participation for the steady flow of normal stable patches is almost pointless.

Just look at the subject line of this thread. The numbers are so big that you almost need exponential notation for them.

Quoted 5 lines

I'm worried about just backporting patches that nobody actually looked at. Is someone going through and vetting that these should definitely be added to stable. I would like to have some trusted human (doesn't even need to be the author or maintainer of the patch) to look at all the patches before they are applied.

I do go through every single commit sent this way and review it. Sometimes things slip by, but it's not a fully automatic process.

Let's look at this patch as a concrete example: the only reason, according to the stable rules, that it shouldn't go in -stable is that it's longer than 100 lines.

Otherwise, it fixes a bug, it doesn't introduce any new features, it's upstream, and so on. It had some fixes that went upstream as well? Great, let's grab those as well.

Quoted 6 lines

I would say anything more than a trivial patch would require author or sub maintainer ack. Look at this patch, I don't think it should go to stable, even though it does fix issues. But the fix is for systems already having issues, and this keeps printk from making things worse. The fix has side effects that other commits have addressed, and if this patch gets backported, those other ones must too.

Sure, let's get those patches in as well.

One of the things Greg is pushing strongly for is "bug compatibility":
we want the kernel to behave the same way between mainline and stable. If the code is broken, it should be broken in the same way.

If anything, after this discussion I'd recommend that we take this patch and it's follow-up fixes...

Quoted 4 lines

Maybe I was too strong by saying all patches should be acked, but anything more than buffer overflows and off by one errors probably require a bit more vetting by a human than to just pull in all patches that a bot flags to be backported.

If anyone wants to give me a hand with going through these I'd be more than happy to. I know that Ben Hutchings is looking at the ones that land in 4.4 carefully. It's always good to have more than 1 set of eyes!

#98 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 46 lines · Sasha Levin
Quoted 21 lines · Steven Rostedt
Quoted 10 lines · On Mon, 16 Apr 2018 08:18:09 -0700 Linus Torvalds…
Quoted 4 lines · Steven Rostedt

I wonder if the "AUTOSEL" patches should at least have an "ack-by" from someone before they are pulled in. Otherwise there may be some subtle issues that can find their way into stable releases.

I don't know about anybody else, but I get so many of the patch-bot patches for stable etc that I will *not* reply to normal cases. Only if there's some issue with a patch will I reply.

Quoted 7 lines

I probably do get more than most, but still - requiring active participation for the steady flow of normal stable patches is almost pointless.

Just look at the subject line of this thread. The numbers are so big that you almost need exponential notation for them.

Quoted 5 lines

I'm worried about just backporting patches that nobody actually looked at. Is someone going through and vetting that these should definitely be added to stable. I would like to have some trusted human (doesn't even need to be the author or maintainer of the patch) to look at all the patches before they are applied.

I do go through every single commit sent this way and review it. Sometimes things slip by, but it's not a fully automatic process.

Let's look at this patch as a concrete example: the only reason, according to the stable rules, that it shouldn't go in -stable is that it's longer than 100 lines.

Otherwise, it fixes a bug, it doesn't introduce any new features, it's upstream, and so on. It had some fixes that went upstream as well? Great, let's grab those as well.

Quoted 6 lines

I would say anything more than a trivial patch would require author or sub maintainer ack. Look at this patch, I don't think it should go to stable, even though it does fix issues. But the fix is for systems already having issues, and this keeps printk from making things worse. The fix has side effects that other commits have addressed, and if this patch gets backported, those other ones must too.

Quoted 5 lines

Sure, let's get those patches in as well.

One of the things Greg is pushing strongly for is "bug compatibility":
we want the kernel to behave the same way between mainline and stable. If the code is broken, it should be broken in the same way.

Maybe Greg should be Cced on this conversation?

Anyway, I don't think "bug compatibility" is a good goal.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#99 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Sasha Levin
Quoted 3 lines · On Mon, 16 Apr 2018 16:02:03 +0000 Sasha Levin <[email protected]>…

One of the things Greg is pushing strongly for is "bug compatibility":
we want the kernel to behave the same way between mainline and stable. If the code is broken, it should be broken in the same way.

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

-- Steve

#100 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 9 lines · Steven Rostedt
Quoted 3 lines · On Mon, 16 Apr 2018 16:02:03 +0000 Sasha Levin <[email protected]>…

One of the things Greg is pushing strongly for is "bug compatibility":
we want the kernel to behave the same way between mainline and stable. If the code is broken, it should be broken in the same way.

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

#101 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 9 lines · On Mon, 16 Apr 2018 16:19:14 +0000 Sasha Levin <[email protected]>…
Quoted 2 lines

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Honestly, I think that removes all value of the stable series. I remember when the stable series were first created. People were saying that it wouldn't even get to more than 5 versions, because the bar for backporting was suppose to be very high. Today it's just a fork of the kernel at a given version. No more features, but we will be OK with regressions. I'm struggling to see what the benefit of it is suppose to be?

-- Steve

#102 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 13 lines · Steven Rostedt
Quoted 9 lines · On Mon, 16 Apr 2018 16:19:14 +0000 Sasha Levin <[email protected]>…
Quoted 2 lines

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Quoted 7 lines

Honestly, I think that removes all value of the stable series. I remember when the stable series were first created. People were saying that it wouldn't even get to more than 5 versions, because the bar for backporting was suppose to be very high. Today it's just a fork of the kernel at a given version. No more features, but we will be OK with regressions. I'm struggling to see what the benefit of it is suppose to be?

It's not "OK with regressions".

Let's look at a hypothetical example: You have a 4.15.1 kernel that has a broken printf() behaviour so that when you:

	pr_err("%d", 5)

Would print:

"Microsoft Rulez"

Bad, right? So you went ahead and fixed it, and now it prints "5" as you might expect. But alas, with your patch, running:

	pr_err("%s", "hi!")

Would show a cat picture for 5 seconds.

Should we take your patch in -stable or not? If we don't, we're stuck with the original issue while the mainline kernel will behave differently, but if we do - we introduce a new regression.

So it's not the case that a -stable kernel will have *more* regression, it'll just have similar ones to mainline.

#103 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 36 lines · Sasha Levin
Quoted 13 lines · Steven Rostedt
Quoted 9 lines · On Mon, 16 Apr 2018 16:19:14 +0000 Sasha Levin <[email protected]>…
Quoted 2 lines

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Quoted 7 lines

Honestly, I think that removes all value of the stable series. I remember when the stable series were first created. People were saying that it wouldn't even get to more than 5 versions, because the bar for backporting was suppose to be very high. Today it's just a fork of the kernel at a given version. No more features, but we will be OK with regressions. I'm struggling to see what the benefit of it is suppose to be?

It's not "OK with regressions".

Let's look at a hypothetical example: You have a 4.15.1 kernel that has a broken printf() behaviour so that when you:

	pr_err("%d", 5)

Would print:

"Microsoft Rulez"

Bad, right? So you went ahead and fixed it, and now it prints "5" as you might expect. But alas, with your patch, running:

Quoted 7 lines
	pr_err("%s", "hi!")

Would show a cat picture for 5 seconds.

Should we take your patch in -stable or not? If we don't, we're stuck with the original issue while the mainline kernel will behave differently, but if we do - we introduce a new regression.

Of course not.

- It must be obviously correct and tested.

If it introduces new bug, it is not correct, and certainly not obviously correct.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#104 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 45 lines · Pavel Machek
Quoted 36 lines · Sasha Levin
Quoted 13 lines · Steven Rostedt
Quoted 9 lines · On Mon, 16 Apr 2018 16:19:14 +0000 Sasha Levin <[email protected]>…
Quoted 2 lines

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Quoted 7 lines

Honestly, I think that removes all value of the stable series. I remember when the stable series were first created. People were saying that it wouldn't even get to more than 5 versions, because the bar for backporting was suppose to be very high. Today it's just a fork of the kernel at a given version. No more features, but we will be OK with regressions. I'm struggling to see what the benefit of it is suppose to be?

It's not "OK with regressions".

Let's look at a hypothetical example: You have a 4.15.1 kernel that has a broken printf() behaviour so that when you:

	pr_err("%d", 5)

Would print:

"Microsoft Rulez"

Bad, right? So you went ahead and fixed it, and now it prints "5" as you might expect. But alas, with your patch, running:

Quoted 7 lines
	pr_err("%s", "hi!")

Would show a cat picture for 5 seconds.

Should we take your patch in -stable or not? If we don't, we're stuck with the original issue while the mainline kernel will behave differently, but if we do - we introduce a new regression.

Quoted 6 lines

Of course not.

- It must be obviously correct and tested.

If it introduces new bug, it is not correct, and certainly not obviously correct.

As you might have noticed, we don't strictly follow the rules.

Take a look at the whole PTI story as an example. It's way more than 100 lines, it's not obviously corrent, it fixed more than 1 thing, and so on, and yet it went in -stable!

Would you argue we shouldn't have backported PTI to -stable?

#105 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 53 lines · Sasha Levin
Quoted 45 lines · Pavel Machek
Quoted 36 lines · Sasha Levin
Quoted 13 lines · Steven Rostedt
Quoted 9 lines · On Mon, 16 Apr 2018 16:19:14 +0000 Sasha Levin <[email protected]>…
Quoted 2 lines

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Quoted 7 lines

Honestly, I think that removes all value of the stable series. I remember when the stable series were first created. People were saying that it wouldn't even get to more than 5 versions, because the bar for backporting was suppose to be very high. Today it's just a fork of the kernel at a given version. No more features, but we will be OK with regressions. I'm struggling to see what the benefit of it is suppose to be?

It's not "OK with regressions".

Let's look at a hypothetical example: You have a 4.15.1 kernel that has a broken printf() behaviour so that when you:

	pr_err("%d", 5)

Would print:

"Microsoft Rulez"

Bad, right? So you went ahead and fixed it, and now it prints "5" as you might expect. But alas, with your patch, running:

Quoted 7 lines
	pr_err("%s", "hi!")

Would show a cat picture for 5 seconds.

Should we take your patch in -stable or not? If we don't, we're stuck with the original issue while the mainline kernel will behave differently, but if we do - we introduce a new regression.

Quoted 6 lines

Of course not.

- It must be obviously correct and tested.

If it introduces new bug, it is not correct, and certainly not obviously correct.

Quoted 7 lines

As you might have noticed, we don't strictly follow the rules.

Take a look at the whole PTI story as an example. It's way more than 100 lines, it's not obviously corrent, it fixed more than 1 thing, and so on, and yet it went in -stable!

Would you argue we shouldn't have backported PTI to -stable?

So I agree with that being backported. But I think this nicely demostrates a point some people are trying to make in this thread. We do take fixes with high risk or regression if they fix serious enough issue. Also we do take fixes to non-serious stuff (such as addition of device ID) if the chances of regression are really low.

So IMHO the metric for including the fix is not solely "how annoying to user this can be" but rather something like:

score = (how annoying the bug is) * ((1 / (chance of regression due to

	including this)) - 1)^3

(constants are somewhat arbitrary subject to tuning ;). Now both 'annoying' and 'regression chance' parts are subjective and sometimes difficult to estimate so don't take the formula too seriously but it demonstrates the point. I think we all agree we want to fix annoying stuff and we don't want regressions. But you need to somehow weight this over your expected userbase - and this is where your argument "but someone might be annoyed by LEDs not working so let's include it" has problems - it should rather be "is the annoyance of non-working leds over expected user base high enough to risk a regression due to this patch for someone in the expected user base"? The answer to this second question is not clear at all to a casual reviewer and that's why we IMHO have CC stable tag as maintainer is supposed to have at least a bit better clue.

Another point I wanted to make is that if chance a patch causes a regression is about 2% as you said somewhere else in a thread, then by adding 20 patches that "may fix a bug that is annoying for someone" you've just increased a chance there's a regression in the release by 34%. And this is not just a math game, this also roughly matches a real experience with maintaining our enterprise kernels. Do 20 "maybe" fixes outweight such regression chance? And I also note that for a regression to get reported so that it gets included into your 2% estimate of a patch regression rate, someone must be bothered enough by it to triage it and send an email somewhere so that already falls into a category of "serious" stuff to me.

So these are the reasons why I think that merging tons of patches into stable isn't actually very good.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#106 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 74 lines · Jan Kara
Quoted 53 lines · Sasha Levin
Quoted 45 lines · Pavel Machek
Quoted 36 lines · Sasha Levin
Quoted 13 lines · Steven Rostedt
Quoted 9 lines · On Mon, 16 Apr 2018 16:19:14 +0000 Sasha Levin <[email protected]>…
Quoted 2 lines

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Quoted 7 lines

Honestly, I think that removes all value of the stable series. I remember when the stable series were first created. People were saying that it wouldn't even get to more than 5 versions, because the bar for backporting was suppose to be very high. Today it's just a fork of the kernel at a given version. No more features, but we will be OK with regressions. I'm struggling to see what the benefit of it is suppose to be?

It's not "OK with regressions".

Let's look at a hypothetical example: You have a 4.15.1 kernel that has a broken printf() behaviour so that when you:

	pr_err("%d", 5)

Would print:

"Microsoft Rulez"

Bad, right? So you went ahead and fixed it, and now it prints "5" as you might expect. But alas, with your patch, running:

Quoted 7 lines
	pr_err("%s", "hi!")

Would show a cat picture for 5 seconds.

Should we take your patch in -stable or not? If we don't, we're stuck with the original issue while the mainline kernel will behave differently, but if we do - we introduce a new regression.

Quoted 6 lines

Of course not.

- It must be obviously correct and tested.

If it introduces new bug, it is not correct, and certainly not obviously correct.

Quoted 7 lines

As you might have noticed, we don't strictly follow the rules.

Take a look at the whole PTI story as an example. It's way more than 100 lines, it's not obviously corrent, it fixed more than 1 thing, and so on, and yet it went in -stable!

Would you argue we shouldn't have backported PTI to -stable?

So I agree with that being backported. But I think this nicely demostrates a point some people are trying to make in this thread. We do take fixes with high risk or regression if they fix serious enough issue. Also we do take fixes to non-serious stuff (such as addition of device ID) if the chances of regression are really low.

So IMHO the metric for including the fix is not solely "how annoying to user this can be" but rather something like:

score = (how annoying the bug is) * ((1 / (chance of regression due to

	including this)) - 1)^3
Quoted 12 lines

(constants are somewhat arbitrary subject to tuning ;). Now both 'annoying' and 'regression chance' parts are subjective and sometimes difficult to estimate so don't take the formula too seriously but it demonstrates the point. I think we all agree we want to fix annoying stuff and we don't want regressions. But you need to somehow weight this over your expected userbase - and this is where your argument "but someone might be annoyed by LEDs not working so let's include it" has problems - it should rather be "is the annoyance of non-working leds over expected user base high enough to risk a regression due to this patch for someone in the expected user base"? The answer to this second question is not clear at all to a casual reviewer and that's why we IMHO have CC stable tag as maintainer is supposed to have at least a bit better clue.

We may be able to guesstimate the 'regression chance', but there's no way we can guess the 'annoyance' once. There are so many different use cases that we just can't even guess how many people would get "annoyed" by something.

Even regression chance is tricky, look at the commits I've linked earlier in the thread. Even the most trivial looking commits that end up in stable have a chance for regression.

Quoted 4 lines

Another point I wanted to make is that if chance a patch causes a regression is about 2% as you said somewhere else in a thread, then by adding 20 patches that "may fix a bug that is annoying for someone" you've just increased a chance there's a regression in the release by 34%. And

So I've said that the rejection rate is less than 2%. This includes all commits that I have proposed for -stable, but didn't end up being included in -stable.

This includes commits that the author/maintainers NACKed, commits that didn't do anything on older kernels, commits that were buggy but were caught before the kernel was released, commits that failed to build on an arch I didn't test it on originally and so on.

After thousands of merged AUTOSEL patches I can count the number of times a commit has caused a regression and had to be removed on one hand.

Quoted 6 lines

this is not just a math game, this also roughly matches a real experience with maintaining our enterprise kernels. Do 20 "maybe" fixes outweight such regression chance? And I also note that for a regression to get reported so that it gets included into your 2% estimate of a patch regression rate, someone must be bothered enough by it to triage it and send an email somewhere so that already falls into a category of "serious" stuff to me.

It is indeed a numbers game, but the regression rate isn't 2%, it's closer to 0.05%.

#107 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 88 lines · Sasha Levin
Quoted 74 lines · Jan Kara
Quoted 53 lines · Sasha Levin
Quoted 45 lines · Pavel Machek
Quoted 36 lines · Sasha Levin
Quoted 13 lines · Steven Rostedt
Quoted 9 lines · On Mon, 16 Apr 2018 16:19:14 +0000 Sasha Levin <[email protected]>…
Quoted 2 lines

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Quoted 7 lines

Honestly, I think that removes all value of the stable series. I remember when the stable series were first created. People were saying that it wouldn't even get to more than 5 versions, because the bar for backporting was suppose to be very high. Today it's just a fork of the kernel at a given version. No more features, but we will be OK with regressions. I'm struggling to see what the benefit of it is suppose to be?

It's not "OK with regressions".

Let's look at a hypothetical example: You have a 4.15.1 kernel that has a broken printf() behaviour so that when you:

	pr_err("%d", 5)

Would print:

"Microsoft Rulez"

Bad, right? So you went ahead and fixed it, and now it prints "5" as you might expect. But alas, with your patch, running:

Quoted 7 lines
	pr_err("%s", "hi!")

Would show a cat picture for 5 seconds.

Should we take your patch in -stable or not? If we don't, we're stuck with the original issue while the mainline kernel will behave differently, but if we do - we introduce a new regression.

Quoted 6 lines

Of course not.

- It must be obviously correct and tested.

If it introduces new bug, it is not correct, and certainly not obviously correct.

Quoted 7 lines

As you might have noticed, we don't strictly follow the rules.

Take a look at the whole PTI story as an example. It's way more than 100 lines, it's not obviously corrent, it fixed more than 1 thing, and so on, and yet it went in -stable!

Would you argue we shouldn't have backported PTI to -stable?

So I agree with that being backported. But I think this nicely demostrates a point some people are trying to make in this thread. We do take fixes with high risk or regression if they fix serious enough issue. Also we do take fixes to non-serious stuff (such as addition of device ID) if the chances of regression are really low.

So IMHO the metric for including the fix is not solely "how annoying to user this can be" but rather something like:

score = (how annoying the bug is) * ((1 / (chance of regression due to

	including this)) - 1)^3
Quoted 12 lines

(constants are somewhat arbitrary subject to tuning ;). Now both 'annoying' and 'regression chance' parts are subjective and sometimes difficult to estimate so don't take the formula too seriously but it demonstrates the point. I think we all agree we want to fix annoying stuff and we don't want regressions. But you need to somehow weight this over your expected userbase - and this is where your argument "but someone might be annoyed by LEDs not working so let's include it" has problems - it should rather be "is the annoyance of non-working leds over expected user base high enough to risk a regression due to this patch for someone in the expected user base"? The answer to this second question is not clear at all to a casual reviewer and that's why we IMHO have CC stable tag as maintainer is supposed to have at least a bit better clue.

Quoted 4 lines

We may be able to guesstimate the 'regression chance', but there's no way we can guess the 'annoyance' once. There are so many different use cases that we just can't even guess how many people would get "annoyed" by something.

As a maintainer, I hope I have reasonable idea what are common use cases for my subsystem. Those I cater to when estimating 'annoyance'. Sure I don't know all of the use cases so people doing unusual stuff hit more bugs and have to report them to get fixes included in -stable. But for me this is a preferable tradeoff over the risk of regression so this is the rule I use when tagging for stable. Now I'm not a -stable maintainer and I fully agree with "those who do the work decide" principle so pick whatever patches you think are appropriate, I just wanted explain why I don't think more patches in stable are necessarily good.

Quoted 3 lines

Even regression chance is tricky, look at the commits I've linked earlier in the thread. Even the most trivial looking commits that end up in stable have a chance for regression.

Sure, you can never be certain and I think people (including me) underestimate the chance of regressions for "trivial" patches. But you just estimate a chance, you may be lucky, you may not...

Quoted 25 lines
Quoted 4 lines

Another point I wanted to make is that if chance a patch causes a regression is about 2% as you said somewhere else in a thread, then by adding 20 patches that "may fix a bug that is annoying for someone" you've just increased a chance there's a regression in the release by 34%. And

So I've said that the rejection rate is less than 2%. This includes all commits that I have proposed for -stable, but didn't end up being included in -stable.

This includes commits that the author/maintainers NACKed, commits that didn't do anything on older kernels, commits that were buggy but were caught before the kernel was released, commits that failed to build on an arch I didn't test it on originally and so on.

After thousands of merged AUTOSEL patches I can count the number of times a commit has caused a regression and had to be removed on one hand.

Quoted 6 lines

this is not just a math game, this also roughly matches a real experience with maintaining our enterprise kernels. Do 20 "maybe" fixes outweight such regression chance? And I also note that for a regression to get reported so that it gets included into your 2% estimate of a patch regression rate, someone must be bothered enough by it to triage it and send an email somewhere so that already falls into a category of "serious" stuff to me.

Quoted 2 lines

It is indeed a numbers game, but the regression rate isn't 2%, it's closer to 0.05%.

Honestly, I think 0.05% is too optimististic :) Quick grepping of 4.14 stable tree suggests some 13 commits were reverted from stable due to bugs. That's some 0.4% and that doesn't count fixes that were applied to fix other regressions.

But the actual numbers don't really matter that much, in principle the more patches you add the higher is the chance of regression. You can't change that so you better have a good reason to include a patch...

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#108 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 6 lines · Jan Kara
Quoted 4 lines · Sasha Levin

We may be able to guesstimate the 'regression chance', but there's no way we can guess the 'annoyance' once. There are so many different use cases that we just can't even guess how many people would get "annoyed" by something.

Quoted 9 lines

As a maintainer, I hope I have reasonable idea what are common use cases for my subsystem. Those I cater to when estimating 'annoyance'. Sure I don't know all of the use cases so people doing unusual stuff hit more bugs and have to report them to get fixes included in -stable. But for me this is a preferable tradeoff over the risk of regression so this is the rule I use when tagging for stable. Now I'm not a -stable maintainer and I fully agree with "those who do the work decide" principle so pick whatever patches you think are appropriate, I just wanted explain why I don't think more patches in stable are necessarily good.

The AUTOSEL story is different for subsystems that don't do -stable, and subsystems that are actually doing the work (like yourself).

I'm not trying to override active maintainers, I'm trying to help them make decisions.

The AUTOSEL bot will attempt to apply any patch it deems as -stable for on all -stable branches, finding possible dependencies, build them, and run any tests that you might deem necessary.

You would be able to start your analysis without "wasting" time on doing a bunch of "manual labor".

There's a big difference between subsystems like yours and most of the rest of the kernel.

Quoted 33 lines
Quoted 3 lines

Even regression chance is tricky, look at the commits I've linked earlier in the thread. Even the most trivial looking commits that end up in stable have a chance for regression.

Sure, you can never be certain and I think people (including me) underestimate the chance of regressions for "trivial" patches. But you just estimate a chance, you may be lucky, you may not...

Quoted 25 lines
Quoted 4 lines

Another point I wanted to make is that if chance a patch causes a regression is about 2% as you said somewhere else in a thread, then by adding 20 patches that "may fix a bug that is annoying for someone" you've just increased a chance there's a regression in the release by 34%. And

So I've said that the rejection rate is less than 2%. This includes all commits that I have proposed for -stable, but didn't end up being included in -stable.

This includes commits that the author/maintainers NACKed, commits that didn't do anything on older kernels, commits that were buggy but were caught before the kernel was released, commits that failed to build on an arch I didn't test it on originally and so on.

After thousands of merged AUTOSEL patches I can count the number of times a commit has caused a regression and had to be removed on one hand.

Quoted 6 lines

this is not just a math game, this also roughly matches a real experience with maintaining our enterprise kernels. Do 20 "maybe" fixes outweight such regression chance? And I also note that for a regression to get reported so that it gets included into your 2% estimate of a patch regression rate, someone must be bothered enough by it to triage it and send an email somewhere so that already falls into a category of "serious" stuff to me.

Quoted 7 lines
Quoted 2 lines

It is indeed a numbers game, but the regression rate isn't 2%, it's closer to 0.05%.

Honestly, I think 0.05% is too optimististic :) Quick grepping of 4.14 stable tree suggests some 13 commits were reverted from stable due to bugs. That's some 0.4% and that doesn't count fixes that were applied to fix other regressions.

0.05% is for commits that were merged in stable but later fixed or reverted because they introduced a regression. By grepping for reverts you also include things such as:

- Reverts of commits that were in the corresponding mainline tree
- Reverts of commits that didn't introduce regressions

Quoted 3 lines

But the actual numbers don't really matter that much, in principle the more patches you add the higher is the chance of regression. You can't change that so you better have a good reason to include a patch...

You increase the chance of regressions, but you also increase the chance of fixing bugs that affect users.

My claim is that the chance to fix bugs increases far more significantly than the chance to introduce regressions.

#109 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 42 lines · Sasha Levin
Quoted 33 lines · Jan Kara
Quoted 3 lines

Even regression chance is tricky, look at the commits I've linked earlier in the thread. Even the most trivial looking commits that end up in stable have a chance for regression.

Sure, you can never be certain and I think people (including me) underestimate the chance of regressions for "trivial" patches. But you just estimate a chance, you may be lucky, you may not...

Quoted 25 lines
Quoted 4 lines

Another point I wanted to make is that if chance a patch causes a regression is about 2% as you said somewhere else in a thread, then by adding 20 patches that "may fix a bug that is annoying for someone" you've just increased a chance there's a regression in the release by 34%. And

So I've said that the rejection rate is less than 2%. This includes all commits that I have proposed for -stable, but didn't end up being included in -stable.

This includes commits that the author/maintainers NACKed, commits that didn't do anything on older kernels, commits that were buggy but were caught before the kernel was released, commits that failed to build on an arch I didn't test it on originally and so on.

After thousands of merged AUTOSEL patches I can count the number of times a commit has caused a regression and had to be removed on one hand.

Quoted 6 lines

this is not just a math game, this also roughly matches a real experience with maintaining our enterprise kernels. Do 20 "maybe" fixes outweight such regression chance? And I also note that for a regression to get reported so that it gets included into your 2% estimate of a patch regression rate, someone must be bothered enough by it to triage it and send an email somewhere so that already falls into a category of "serious" stuff to me.

Quoted 7 lines
Quoted 2 lines

It is indeed a numbers game, but the regression rate isn't 2%, it's closer to 0.05%.

Honestly, I think 0.05% is too optimististic :) Quick grepping of 4.14 stable tree suggests some 13 commits were reverted from stable due to bugs. That's some 0.4% and that doesn't count fixes that were applied to fix other regressions.

Quoted 6 lines

0.05% is for commits that were merged in stable but later fixed or reverted because they introduced a regression. By grepping for reverts you also include things such as:

- Reverts of commits that were in the corresponding mainline tree
- Reverts of commits that didn't introduce regressions

Actually I was careful enough to include only commits that got merged as part of the stable process into 4.14.x but got later reverted in 4.14.y. That's where the 0.4% number came from. So I believe all of those cases (13 in absolute numbers) were user visible regressions during the stable process.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#110 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 5 lines · Jan Kara

Actually I was careful enough to include only commits that got merged as part of the stable process into 4.14.x but got later reverted in 4.14.y. That's where the 0.4% number came from. So I believe all of those cases (13 in absolute numbers) were user visible regressions during the stable process.

I looked at them, and there are 2 things in play here:

- Quite a few of those reverts are because of the PTI work. I'm not sure how we treat it, but yes - it skews statistics here.
- 2 of them were reverts for device tree changes for a device that didn't exist in 4.14, and shouldn't have had any user visible changes.

#111 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Sasha Levin
Quoted 17 lines · Sasha Levin
Quoted 6 lines · Jan Kara
Quoted 4 lines · Sasha Levin

We may be able to guesstimate the 'regression chance', but there's no way we can guess the 'annoyance' once. There are so many different use cases that we just can't even guess how many people would get "annoyed" by something.

Quoted 9 lines

As a maintainer, I hope I have reasonable idea what are common use cases for my subsystem. Those I cater to when estimating 'annoyance'. Sure I don't know all of the use cases so people doing unusual stuff hit more bugs and have to report them to get fixes included in -stable. But for me this is a preferable tradeoff over the risk of regression so this is the rule I use when tagging for stable. Now I'm not a -stable maintainer and I fully agree with "those who do the work decide" principle so pick whatever patches you think are appropriate, I just wanted explain why I don't think more patches in stable are necessarily good.

Quoted 5 lines

The AUTOSEL story is different for subsystems that don't do -stable, and subsystems that are actually doing the work (like yourself).

I'm not trying to override active maintainers, I'm trying to help them make decisions.

Ok, cool. Can you exclude LED subsystem, Hibernation and Nokia N900 stuff from autosel work?

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#112 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 18 lines · Pavel Machek
Quoted 17 lines · Sasha Levin
Quoted 15 lines · Jan Kara
Quoted 4 lines · Sasha Levin

We may be able to guesstimate the 'regression chance', but there's no way we can guess the 'annoyance' once. There are so many different use cases that we just can't even guess how many people would get "annoyed" by something.

As a maintainer, I hope I have reasonable idea what are common use cases for my subsystem. Those I cater to when estimating 'annoyance'. Sure I don't know all of the use cases so people doing unusual stuff hit more bugs and have to report them to get fixes included in -stable. But for me this is a preferable tradeoff over the risk of regression so this is the rule I use when tagging for stable. Now I'm not a -stable maintainer and I fully agree with "those who do the work decide" principle so pick whatever patches you think are appropriate, I just wanted explain why I don't think more patches in stable are necessarily good.

Quoted 8 lines
Quoted 5 lines

The AUTOSEL story is different for subsystems that don't do -stable, and subsystems that are actually doing the work (like yourself).

I'm not trying to override active maintainers, I'm trying to help them make decisions.

Ok, cool. Can you exclude LED subsystem, Hibernation and Nokia N900 stuff from autosel work?

Curiousity got me, and I had to see what these subsystems do as far as stable commits:

$ git log --oneline --grep 'stable@vger' --since="01-01-2016" kernel/power drivers/leds drivers/media/i2c/et8ek8 drivers/media/i2c/ad5820.c arch/x86/kernel/acpi/ | wc -l
7

Which got me a bit surprised: maybe indeed leds is mostly fine, but hibernation is definitely tricky, I've been stung by it a few times...

So why not pick something an actual user reported, and see how that was dealt with?

Googling first showed this:

	https://bugzilla.kernel.org/show_bug.cgi?id=97201

Which was fixed by:

	https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bdbc98abb3aa323f6323b11db39c740e6f8fc5b1

But that's not in any -stable tree. Hmm.. ok..

Next one on google was:

	https://bugzilla.kernel.org/show_bug.cgi?id=117971

Which, in turn, was fixed by:

	https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5b3f249c94ce1f46bacd9814385b0ee2d1ae52f3

Oh look at that, it's not in -stable either...

So seeing how you have concerns with my selection of -stable commits, maybe you could explain to me why these commits didn't end up in -stable?

#113 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Sasha Levin

Hi!

Quoted 6 lines
Quoted 4 lines

- It must be obviously correct and tested.

If it introduces new bug, it is not correct, and certainly not obviously correct.

As you might have noticed, we don't strictly follow the rules.

Yes, I noticed. And what I'm saying is that perhaps you should follow the rules more strictly.

Quoted 5 lines

Take a look at the whole PTI story as an example. It's way more than 100 lines, it's not obviously corrent, it fixed more than 1 thing, and so on, and yet it went in -stable!

Would you argue we shouldn't have backported PTI to -stable?

Actually, I was surprised with PTI going to stable. That was clearly against the rules. Maybe the security bug was ugly enough to warrant that.

But please don't use it as an argument for applying any random patches...

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#114 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 11 lines · Pavel Machek

Hi!

Quoted 6 lines
Quoted 4 lines

- It must be obviously correct and tested.

If it introduces new bug, it is not correct, and certainly not obviously correct.

As you might have noticed, we don't strictly follow the rules.

Yes, I noticed. And what I'm saying is that perhaps you should follow the rules more strictly.

Again, this was stated many times by Greg and others, the rules are not there to be strictly followed.

Quoted 4 lines
Quoted 4 lines

Take a look at the whole PTI story as an example. It's way more than 100 lines, it's not obviously corrent, it fixed more than 1 thing, and so on, and yet it went in -stable!

Quoted 8 lines
Quoted 1 line

Would you argue we shouldn't have backported PTI to -stable?

Actually, I was surprised with PTI going to stable. That was clearly against the rules. Maybe the security bug was ugly enough to warrant that.

But please don't use it as an argument for applying any random patches...

How about this: if a -stable maintainer has concerns with how I follow the -stable rules, he's more than welcome to reject my patches. Sounds like a plan?

#115 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Sasha Levin

Den 16-04-2018 kl. 19:19, skrev Sasha Levin:

Quoted 11 lines · Steven Rostedt
Quoted 9 lines
Quoted 3 lines · On Mon, 16 Apr 2018 16:02:03 +0000 Sasha Levin <[email protected]>…

One of the things Greg is pushing strongly for is "bug compatibility":
we want the kernel to behave the same way between mainline and stable. If the code is broken, it should be broken in the same way.

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

Quoted 7 lines

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Yeah, but _intentionally_ breaking existing setups to stay "bug compatible" _is_ a _regression_ you _really_ _dont_ want in a stable supported distro. Because end-users dont care about upstream breaking
stuff... its the distro that takes the heat for that...

Something "already broken" is not a regression...

As distro maintainer that means one now have to review _every_ patch that carries "AUTOSEL", follow all the mail threads that comes up about it, then track if it landed in -stable queue, and read every response and possible objection to all patches in the -stable queue a second time around... then check if it still got included in final stable point relase and then either revert them in distro kernel or go track down all the follow-up fixes needed...

Just to avoid being "bug compatible with master"

--
Thomas

maintainer
#116 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 35 lines · Thomas Backlund

Den 16-04-2018 kl. 19:19, skrev Sasha Levin:

Quoted 11 lines · Steven Rostedt
Quoted 9 lines
Quoted 3 lines · On Mon, 16 Apr 2018 16:02:03 +0000 Sasha Levin <[email protected]>…

One of the things Greg is pushing strongly for is "bug compatibility":
we want the kernel to behave the same way between mainline and stable. If the code is broken, it should be broken in the same way.

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

Quoted 7 lines

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Yeah, but _intentionally_ breaking existing setups to stay "bug compatible" _is_ a _regression_ you _really_ _dont_ want in a stable supported distro. Because end-users dont care about upstream breaking stuff... its the distro that takes the heat for that...

Something "already broken" is not a regression...

As distro maintainer that means one now have to review _every_ patch that carries "AUTOSEL", follow all the mail threads that comes up about it, then track if it landed in -stable queue, and read every response and possible objection to all patches in the -stable queue a second time around... then check if it still got included in final stable point relase and then either revert them in distro kernel or go track down all the follow-up fixes needed...

Quoted 1 line

Just to avoid being "bug compatible with master"

I've done this "bug compatible" "breakage" more than the AUTOSEL stuff has in the past, so you had better also be reviewing all of my normal commits as well :)

Anyway, we are trying not to do this, but it does, and will, occasionally happen. Look, we just did that for one platform for 4.9.94! And the key to all of this is good testing, which we are now doing, and hopefully you are also doing as well.

thanks,

greg k-h

#117 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 36 lines · Greg KH
Quoted 35 lines · Thomas Backlund

Den 16-04-2018 kl. 19:19, skrev Sasha Levin:

Quoted 11 lines · Steven Rostedt
Quoted 9 lines
Quoted 3 lines · On Mon, 16 Apr 2018 16:02:03 +0000 Sasha Levin <[email protected]>…

One of the things Greg is pushing strongly for is "bug compatibility":
we want the kernel to behave the same way between mainline and stable. If the code is broken, it should be broken in the same way.

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

Quoted 7 lines

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Yeah, but _intentionally_ breaking existing setups to stay "bug compatible" _is_ a _regression_ you _really_ _dont_ want in a stable supported distro. Because end-users dont care about upstream breaking stuff... its the distro that takes the heat for that...

Something "already broken" is not a regression...

As distro maintainer that means one now have to review _every_ patch that carries "AUTOSEL", follow all the mail threads that comes up about it, then track if it landed in -stable queue, and read every response and possible objection to all patches in the -stable queue a second time around... then check if it still got included in final stable point relase and then either revert them in distro kernel or go track down all the follow-up fixes needed...

Quoted 8 lines
Quoted 1 line

Just to avoid being "bug compatible with master"

I've done this "bug compatible" "breakage" more than the AUTOSEL stuff has in the past, so you had better also be reviewing all of my normal commits as well :)

Anyway, we are trying not to do this, but it does, and will, occasionally happen.

Sure, that's understood. So this was just misunderstanding. Sasha's original comment really sounded like "bug compatibility" with current master is desirable and that made me go "Are you serious?" as well...

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer
#118 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 43 lines · Jan Kara
Quoted 42 lines · Greg KH
Quoted 35 lines · Thomas Backlund

Den 16-04-2018 kl. 19:19, skrev Sasha Levin:

Quoted 11 lines · Steven Rostedt
Quoted 9 lines
Quoted 3 lines · On Mon, 16 Apr 2018 16:02:03 +0000 Sasha Levin <[email protected]>…

One of the things Greg is pushing strongly for is "bug compatibility":
we want the kernel to behave the same way between mainline and stable. If the code is broken, it should be broken in the same way.

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

Quoted 7 lines

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Yeah, but _intentionally_ breaking existing setups to stay "bug compatible" _is_ a _regression_ you _really_ _dont_ want in a stable supported distro. Because end-users dont care about upstream breaking stuff... its the distro that takes the heat for that...

Something "already broken" is not a regression...

As distro maintainer that means one now have to review _every_ patch that carries "AUTOSEL", follow all the mail threads that comes up about it, then track if it landed in -stable queue, and read every response and possible objection to all patches in the -stable queue a second time around... then check if it still got included in final stable point relase and then either revert them in distro kernel or go track down all the follow-up fixes needed...

Quoted 1 line

Just to avoid being "bug compatible with master"

I've done this "bug compatible" "breakage" more than the AUTOSEL stuff has in the past, so you had better also be reviewing all of my normal commits as well :)

Quoted 6 lines
Quoted 2 lines

Anyway, we are trying not to do this, but it does, and will, occasionally happen.

Sure, that's understood. So this was just misunderstanding. Sasha's original comment really sounded like "bug compatibility" with current master is desirable and that made me go "Are you serious?" as well...

As I said before in this thread, yes, sometimes I do this on purpose.

As an specific example, see a recent bluetooth patch that caused a regression on some chromebook devices. The chromeos developers rightfully complainied, and I left the commit in there to provide the needed "leverage" on the upstream developers to fix this properly. Otherwise if I had reverted the stable patch, when people move to a newer kernel version, things break, and no one remembers why.

I also wrote a long response as to _why_ I do this, and even though it does happen, why it still is worth taking the stable updates. Please see the archives for the full details. I don't want to duplicate this again here.

thanks,

greg k-h

#119 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Den 19.04.2018 kl. 17:22, skrev Greg KH:

Quoted 44 lines · Jan Kara
Quoted 43 lines · Greg KH
Quoted 42 lines · Thomas Backlund
Quoted 35 lines

Den 16-04-2018 kl. 19:19, skrev Sasha Levin:

Quoted 11 lines · Steven Rostedt
Quoted 9 lines
Quoted 3 lines · On Mon, 16 Apr 2018 16:02:03 +0000 Sasha Levin <[email protected]>…

One of the things Greg is pushing strongly for is "bug compatibility":
we want the kernel to behave the same way between mainline and stable. If the code is broken, it should be broken in the same way.

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

Quoted 7 lines

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Yeah, but _intentionally_ breaking existing setups to stay "bug compatible" _is_ a _regression_ you _really_ _dont_ want in a stable supported distro. Because end-users dont care about upstream breaking stuff... its the distro that takes the heat for that...

Something "already broken" is not a regression...

As distro maintainer that means one now have to review _every_ patch that carries "AUTOSEL", follow all the mail threads that comes up about it, then track if it landed in -stable queue, and read every response and possible objection to all patches in the -stable queue a second time around... then check if it still got included in final stable point relase and then either revert them in distro kernel or go track down all the follow-up fixes needed...

Quoted 1 line

Just to avoid being "bug compatible with master"

I've done this "bug compatible" "breakage" more than the AUTOSEL stuff has in the past, so you had better also be reviewing all of my normal commits as well :)

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

Anyway, we are trying not to do this, but it does, and will, occasionally happen.

Sure, that's understood. So this was just misunderstanding. Sasha's original comment really sounded like "bug compatibility" with current master is desirable and that made me go "Are you serious?" as well...

As I said before in this thread, yes, sometimes I do this on purpose.

And I guess this is the one that gets people the feeling that "stable is not as stable as it used to be" ...

Quoted 6 lines

As an specific example, see a recent bluetooth patch that caused a regression on some chromebook devices. The chromeos developers rightfully complainied, and I left the commit in there to provide the needed "leverage" on the upstream developers to fix this properly. Otherwise if I had reverted the stable patch, when people move to a newer kernel version, things break, and no one remembers why.

I do understand what you are trying to do...

But from my distro hat on I have to treat things differently (and I dont think I'm alone doing it this way...)

Known breakages gets reverted even before it hits QA, so endusers wont see the issue at all...

So the only ones to see the issue are those building with latest upstream without own patches applied...

Quoted 5 lines

I also wrote a long response as to _why_ I do this, and even though it does happen, why it still is worth taking the stable updates. Please see the archives for the full details. I don't want to duplicate this again here.

And we do use latest stable (with some delay as I dont want to overload QA & endusers with a new kernel every week :))

We just revert known broken (or add known fixes) before releasing them to our users

--
Thomas

maintainer
#120 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 52 lines · Thomas Backlund

Den 19.04.2018 kl. 17:22, skrev Greg KH:

Quoted 51 lines · Jan Kara
Quoted 49 lines · Greg KH
Quoted 36 lines · Thomas Backlund
Quoted 35 lines

Den 16-04-2018 kl. 19:19, skrev Sasha Levin:

Quoted 11 lines · Steven Rostedt
Quoted 9 lines
Quoted 3 lines · On Mon, 16 Apr 2018 16:02:03 +0000 Sasha Levin <[email protected]>…

One of the things Greg is pushing strongly for is "bug compatibility":
we want the kernel to behave the same way between mainline and stable. If the code is broken, it should be broken in the same way.

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

Quoted 7 lines

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Yeah, but _intentionally_ breaking existing setups to stay "bug compatible" _is_ a _regression_ you _really_ _dont_ want in a stable supported distro. Because end-users dont care about upstream breaking stuff... its the distro that takes the heat for that...

Something "already broken" is not a regression...

As distro maintainer that means one now have to review _every_ patch that carries "AUTOSEL", follow all the mail threads that comes up about it, then track if it landed in -stable queue, and read every response and possible objection to all patches in the -stable queue a second time around... then check if it still got included in final stable point relase and then either revert them in distro kernel or go track down all the follow-up fixes needed...

Quoted 8 lines
Quoted 1 line

Just to avoid being "bug compatible with master"

I've done this "bug compatible" "breakage" more than the AUTOSEL stuff has in the past, so you had better also be reviewing all of my normal commits as well :)

Anyway, we are trying not to do this, but it does, and will, occasionally happen.

Sure, that's understood. So this was just misunderstanding. Sasha's original comment really sounded like "bug compatibility" with current master is desirable and that made me go "Are you serious?" as well...

Quoted 5 lines
Quoted 2 lines

As I said before in this thread, yes, sometimes I do this on purpose.

And I guess this is the one that gets people the feeling that "stable is not as stable as it used to be" ...

It's always been this way, it's just that no one noticed :)

Quoted 19 lines
Quoted 6 lines

As an specific example, see a recent bluetooth patch that caused a regression on some chromebook devices. The chromeos developers rightfully complainied, and I left the commit in there to provide the needed "leverage" on the upstream developers to fix this properly. Otherwise if I had reverted the stable patch, when people move to a newer kernel version, things break, and no one remembers why.

I do understand what you are trying to do...

But from my distro hat on I have to treat things differently (and I dont think I'm alone doing it this way...)

Known breakages gets reverted even before it hits QA, so endusers wont see the issue at all...

So the only ones to see the issue are those building with latest upstream without own patches applied...

Quoted 1 line
Quoted 7 lines
Quoted 4 lines

I also wrote a long response as to _why_ I do this, and even though it does happen, why it still is worth taking the stable updates. Please see the archives for the full details. I don't want to duplicate this again here.

And we do use latest stable (with some delay as I dont want to overload QA & endusers with a new kernel every week :))

You need to automate your QA :)

Quoted 2 lines

We just revert known broken (or add known fixes) before releasing them to our users

That's great, and is what you should be doing, nothing wrong there.

thanks,

greg k-h

#121 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Den 19.04.2018 kl. 18:57, skrev Greg KH:

Quoted 53 lines · Thomas Backlund
Quoted 52 lines

Den 19.04.2018 kl. 17:22, skrev Greg KH:

Quoted 51 lines · Jan Kara
Quoted 49 lines · Greg KH
Quoted 36 lines · Thomas Backlund
Quoted 35 lines

Den 16-04-2018 kl. 19:19, skrev Sasha Levin:

Quoted 11 lines · Steven Rostedt
Quoted 9 lines
Quoted 3 lines · On Mon, 16 Apr 2018 16:02:03 +0000 Sasha Levin <[email protected]>…

One of the things Greg is pushing strongly for is "bug compatibility":
we want the kernel to behave the same way between mainline and stable. If the code is broken, it should be broken in the same way.

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

Quoted 7 lines

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Yeah, but _intentionally_ breaking existing setups to stay "bug compatible" _is_ a _regression_ you _really_ _dont_ want in a stable supported distro. Because end-users dont care about upstream breaking stuff... its the distro that takes the heat for that...

Something "already broken" is not a regression...

As distro maintainer that means one now have to review _every_ patch that carries "AUTOSEL", follow all the mail threads that comes up about it, then track if it landed in -stable queue, and read every response and possible objection to all patches in the -stable queue a second time around... then check if it still got included in final stable point relase and then either revert them in distro kernel or go track down all the follow-up fixes needed...

Quoted 8 lines
Quoted 1 line

Just to avoid being "bug compatible with master"

I've done this "bug compatible" "breakage" more than the AUTOSEL stuff has in the past, so you had better also be reviewing all of my normal commits as well :)

Anyway, we are trying not to do this, but it does, and will, occasionally happen.

Sure, that's understood. So this was just misunderstanding. Sasha's original comment really sounded like "bug compatibility" with current master is desirable and that made me go "Are you serious?" as well...

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

As I said before in this thread, yes, sometimes I do this on purpose.

And I guess this is the one that gets people the feeling that "stable is not as stable as it used to be" ...

It's always been this way, it's just that no one noticed :)

:)

Quoted 24 lines
Quoted 24 lines
Quoted 6 lines

As an specific example, see a recent bluetooth patch that caused a regression on some chromebook devices. The chromeos developers rightfully complainied, and I left the commit in there to provide the needed "leverage" on the upstream developers to fix this properly. Otherwise if I had reverted the stable patch, when people move to a newer kernel version, things break, and no one remembers why.

I do understand what you are trying to do...

But from my distro hat on I have to treat things differently (and I dont think I'm alone doing it this way...)

Known breakages gets reverted even before it hits QA, so endusers wont see the issue at all...

So the only ones to see the issue are those building with latest upstream without own patches applied...

Quoted 5 lines

I also wrote a long response as to _why_ I do this, and even though it does happen, why it still is worth taking the stable updates. Please see the archives for the full details. I don't want to duplicate this again here.

Quoted 5 lines
Quoted 2 lines

And we do use latest stable (with some delay as I dont want to overload QA & endusers with a new kernel every week :))

You need to automate your QA :)

Yeah, some can be automated... but that means having a lot of different hw to test on... emulators/vms can only test so much...

users part of QA test on a variety of hw with various installs/setups that exposes fun things with some hw :)

Quoted 9 lines
Quoted 2 lines

We just revert known broken (or add known fixes) before releasing them to our users

That's great, and is what you should be doing, nothing wrong there.

thanks,

greg k-h

--
Thomas

maintainer
#122 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Greg KH
Quoted 60 lines · Greg KH
Quoted 43 lines · Jan Kara
Quoted 42 lines · Greg KH
Quoted 35 lines · Thomas Backlund

Den 16-04-2018 kl. 19:19, skrev Sasha Levin:

Quoted 11 lines · Steven Rostedt
Quoted 9 lines
Quoted 3 lines · On Mon, 16 Apr 2018 16:02:03 +0000 Sasha Levin <[email protected]>…

One of the things Greg is pushing strongly for is "bug compatibility":
we want the kernel to behave the same way between mainline and stable. If the code is broken, it should be broken in the same way.

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

Quoted 7 lines

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Yeah, but _intentionally_ breaking existing setups to stay "bug compatible" _is_ a _regression_ you _really_ _dont_ want in a stable supported distro. Because end-users dont care about upstream breaking stuff... its the distro that takes the heat for that...

Something "already broken" is not a regression...

As distro maintainer that means one now have to review _every_ patch that carries "AUTOSEL", follow all the mail threads that comes up about it, then track if it landed in -stable queue, and read every response and possible objection to all patches in the -stable queue a second time around... then check if it still got included in final stable point relase and then either revert them in distro kernel or go track down all the follow-up fixes needed...

Quoted 1 line

Just to avoid being "bug compatible with master"

I've done this "bug compatible" "breakage" more than the AUTOSEL stuff has in the past, so you had better also be reviewing all of my normal commits as well :)

Quoted 6 lines
Quoted 2 lines

Anyway, we are trying not to do this, but it does, and will, occasionally happen.

Sure, that's understood. So this was just misunderstanding. Sasha's original comment really sounded like "bug compatibility" with current master is desirable and that made me go "Are you serious?" as well...

As I said before in this thread, yes, sometimes I do this on purpose.

As an specific example, see a recent bluetooth patch that caused a regression on some chromebook devices. The chromeos developers rightfully complainied, and I left the commit in there to provide the needed "leverage" on the upstream developers to fix this properly. Otherwise if I had reverted the stable patch, when people move to a newer kernel version, things break, and no one remembers why.

Quoted 4 lines

I also wrote a long response as to _why_ I do this, and even though it does happen, why it still is worth taking the stable updates. Please see the archives for the full details. I don't want to duplicate this again here.

And to be more specific, let's always take this as a case-by-case basis. The last time this happened was the bluetooth bug and it was a fix for a reported problem, but then the fix caused a regression so upstream reverted it and I reverted it in the stable trees. No matter what I chose to do, someone would be upset so I followed what upstream did.

thanks,

greg k-h

#123 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Greg KH

Den 19.04.2018 kl. 16:59, skrev Greg KH:

Quoted 36 lines · Thomas Backlund
Quoted 35 lines

Den 16-04-2018 kl. 19:19, skrev Sasha Levin:

Quoted 11 lines · Steven Rostedt
Quoted 9 lines
Quoted 3 lines · On Mon, 16 Apr 2018 16:02:03 +0000 Sasha Levin <[email protected]>…

One of the things Greg is pushing strongly for is "bug compatibility":
we want the kernel to behave the same way between mainline and stable. If the code is broken, it should be broken in the same way.

Wait! What does that mean? What's the purpose of stable if it is as broken as mainline?

Quoted 7 lines

This just means that if there is a fix that went in mainline, and the fix is broken somehow, we'd rather take the broken fix than not.

In this scenario, *something* will be broken, it's just a matter of what. We'd rather have the same thing broken between mainline and stable.

Yeah, but _intentionally_ breaking existing setups to stay "bug compatible" _is_ a _regression_ you _really_ _dont_ want in a stable supported distro. Because end-users dont care about upstream breaking stuff... its the distro that takes the heat for that...

Something "already broken" is not a regression...

As distro maintainer that means one now have to review _every_ patch that carries "AUTOSEL", follow all the mail threads that comes up about it, then track if it landed in -stable queue, and read every response and possible objection to all patches in the -stable queue a second time around... then check if it still got included in final stable point relase and then either revert them in distro kernel or go track down all the follow-up fixes needed...

Quoted 6 lines
Quoted 1 line

Just to avoid being "bug compatible with master"

I've done this "bug compatible" "breakage" more than the AUTOSEL stuff has in the past, so you had better also be reviewing all of my normal commits as well :)

Yeah, I do... and same goes there ... if there is a known issue, then same procedure... Either revert, or try to track down fixes...

Quoted 4 lines

Anyway, we are trying not to do this, but it does, and will, occasionally happen. Look, we just did that for one platform for 4.9.94! And the key to all of this is good testing, which we are now doing, and hopefully you are also doing as well.

Yeah, but having to test stuff with known breakages is no fun, so we try to avoid that

--
Thomas

#124 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Quoted 8 lines · Thomas Backlund

Den 19.04.2018 kl. 16:59, skrev Greg KH:

Quoted 4 lines

Anyway, we are trying not to do this, but it does, and will, occasionally happen. Look, we just did that for one platform for 4.9.94! And the key to all of this is good testing, which we are now doing, and hopefully you are also doing as well.

Yeah, but having to test stuff with known breakages is no fun, so we try to avoid that

Known breakages are easier to deal with than unknown ones :)

I think that that "bug compatability" is basically a policy on *which* regressions you'll see vs *if* you'll see a regression.

We'll never pull in a commit that introduces a bug but doesn't fix another one, right? So if you have to deal with a regression anyway, might as well deal with a regression that is also seen on mainline, so that when you upgrade your stable kernel you'll keep the same set of regressions to deal with.

#125 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

Den 19.04.2018 kl. 18:09, skrev Sasha Levin:

Quoted 11 lines · Thomas Backlund
Quoted 8 lines

Den 19.04.2018 kl. 16:59, skrev Greg KH:

Quoted 4 lines

Anyway, we are trying not to do this, but it does, and will, occasionally happen. Look, we just did that for one platform for 4.9.94! And the key to all of this is good testing, which we are now doing, and hopefully you are also doing as well.

Yeah, but having to test stuff with known breakages is no fun, so we try to avoid that

Known breakages are easier to deal with than unknown ones :)

well, if a system worked before the update, but not after... Guess wich one we want...

Quoted 4 lines

I think that that "bug compatability" is basically a policy on *which* regressions you'll see vs *if* you'll see a regression.

No. Intentionally breaking known working code in a stable branch is never ok.

As I said before... something that never worked is not a regression, but breaking a previously working setup is...

That goes for security fixes too... there is not much point in a security fix, if it basically turns into a local DOS when the system stops working...

People will just boot older code and there you have it...

Quoted 6 lines

We'll never pull in a commit that introduces a bug but doesn't fix another one, right? So if you have to deal with a regression anyway, might as well deal with a regression that is also seen on mainline, so that when you upgrade your stable kernel you'll keep the same set of regressions to deal with.

Here I actually like the comment Linus posted about API breakage earlier in this thread...

<quote>
If you break user workflows, NOTHING ELSE MATTERS.

Even security is secondary to "people don't use the end result, because it doesn't work for them any more".
</quote>

_This_ same statement should be aknowledged / enforced in stable trees too IMHO...

Because this is what will happend...

simple logic... if it does not work, the enduser will boot an earlier kernel... missing "all the good fixes" (including security ones) just because one fix is bad.

For example in this AUTOSEL round there is 161 fixes of wich the enduser never gets the 160 "supposedly good ones" when one is "bad"...

How is that a "good thing" ?

And trying to tell those that get hit "this will force upstream to fix it faster, so you get a working setup in some days/weeks/months..." is not going to work...

Heh, This even reminds me that this is just as annoying as when MS started to "bundle monthly security updates" and you get 95% installed just to realize that the last 5% does not work (or install at all) and you have to rollback to something working thus missing the needed security fixes...

Same flawed logic...

Thnakfully we as distro maintainers can avoid some of the breakage for our enduses...

--
Thomas

#126 lore raw

Re: [PATCH AUTOSEL for 4.14 015/161] printk: Add console owner and waiter logic to load balance console writes

In reply to Linus Torvalds
Quoted 10 lines · Linus Torvalds
Quoted 4 lines · Steven Rostedt

I wonder if the "AUTOSEL" patches should at least have an "ack-by" from someone before they are pulled in. Otherwise there may be some subtle issues that can find their way into stable releases.

I don't know about anybody else, but I get so many of the patch-bot patches for stable etc that I will *not* reply to normal cases. Only if there's some issue with a patch will I reply.

Quoted 8 lines

I probably do get more than most, but still - requiring active participation for the steady flow of normal stable patches is almost pointless.

Just look at the subject line of this thread. The numbers are so big that you almost need exponential notation for them.

Linus

I would be more than happy to make this an opt-in process on my end, but given the responses I've been seeing from folks so far I doubt it'll work for many people. Humans don't scale :)

There are a few statistics that suggest that the current workflow is "good enough":

1. The rejection rate (commits fixed or reverted) for AUTOSEL commits is similar (actually smaller) than commits tagged for -stable.

2. Human response rate on review requests is higher than the rate Greg is getting with his review mails. This is somewhat expected, but it shows that people do what Linus does and reply just when they see something wrong.

I also think that using mailing lists for these is bringing up the limitations of mailing lists. It's hard to go through the amount of patches AUTOSEL is generating this way, but right now we don't have a better alternative.

#127 lore raw

PATCH 16/161 selftest: ftrace: Fix to pick text symbols for kprobes

In reply to Sasha Levin

From: Masami Hiramatsu <[email protected]>

[ Upstream commit 5e46664703b364434a2cbda3e6988fc24ae0ced5 ]

Fix to pick text symbols for multiple kprobe testcase. kallsyms shows text symbols with " t " or " T " but current testcase picks all symbols including "t", so it picks data symbols if it includes 't' (e.g. "str").

This fixes it to find symbol lines with " t " or " T " (including spaces).

---
 tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc +2 -2
index bb16cf91f1b5..e297bd7a2e79 100644
@@ -12,8 +12,8 @@ case `uname -m` in
   *) OFFS=0;;
 esac
 
-echo "Setup up to 256 kprobes"
-grep t /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
+echo "Setup up kprobes on first 256 text symbols"
+grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
 head -n 256 | while read i; do echo p ${i}+${OFFS} ; done > kprobe_events ||:
 
 echo 1 > events/kprobes/enable
Signature · 1 line
2.15.1
#128 lore raw

PATCH 17/161 PCI: Add function 1 DMA alias quirk for Marvell 9128

In reply to Sasha Levin

From: Alex Williamson <[email protected]>

[ Upstream commit aa008206634363ef800fbd5f0262016c9ff81dea ]

The Marvell 9128 is the original device generating bug 42679, from which many other Marvell DMA alias quirks have been sourced, but we didn't have positive confirmation of the fix on 9128 until now.

---
 drivers/pci/quirks.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/pci/quirks.c +2 -0
index 05fadcc4f9d2..75f57aa954f2 100644
@@ -3879,6 +3879,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9120,
 			 quirk_dma_func1_alias);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123,
 			 quirk_dma_func1_alias);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9128,
+			 quirk_dma_func1_alias);
 /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9130,
 			 quirk_dma_func1_alias);
Signature · 1 line
2.15.1
#129 lore raw

PATCH 18/161 Input: psmouse - fix Synaptics detection when protocol is disabled

In reply to Sasha Levin

From: Dmitry Torokhov <[email protected]>

[ Upstream commit 2bc4298f59d2f15175bb568e2d356b5912d0cdd9 ]

When Synaptics protocol is disabled, we still need to try and detect the hardware, so we can switch to SMBus device if SMbus is detected, or we know that it is Synaptics device and reset it properly for the bare PS/2 protocol.

Fixes c378b5119eb0 ("Input: psmouse - factor out common protocol probing code")
---
 drivers/input/mouse/psmouse-base.c | 34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/input/mouse/psmouse-base.c +21 -13
index 6a5649e52eed..8ac9e03c05b4 100644
@@ -975,6 +975,21 @@ static void psmouse_apply_defaults(struct psmouse *psmouse)
 	psmouse->pt_deactivate = NULL;
 }
 
+static bool psmouse_do_detect(int (*detect)(struct psmouse *, bool),
+			      struct psmouse *psmouse, bool allow_passthrough,
+			      bool set_properties)
+{
+	if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU &&
+	    !allow_passthrough) {
+		return false;
+	}
+
+	if (set_properties)
+		psmouse_apply_defaults(psmouse);
+
+	return detect(psmouse, set_properties) == 0;
+}
+
 static bool psmouse_try_protocol(struct psmouse *psmouse,
 				 enum psmouse_type type,
 				 unsigned int *max_proto,
@@ -986,15 +1001,8 @@ static bool psmouse_try_protocol(struct psmouse *psmouse,
 	if (!proto)
 		return false;
 
-	if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU &&
-	    !proto->try_passthru) {
-		return false;
-	}
-
-	if (set_properties)
-		psmouse_apply_defaults(psmouse);
-
-	if (proto->detect(psmouse, set_properties) != 0)
+	if (!psmouse_do_detect(proto->detect, psmouse, proto->try_passthru,
+			       set_properties))
 		return false;
 
 	if (set_properties && proto->init && init_allowed) {
@@ -1027,8 +1035,8 @@ static int psmouse_extensions(struct psmouse *psmouse,
 	 * Always check for focaltech, this is safe as it uses pnp-id
 	 * matching.
 	 */
-	if (psmouse_try_protocol(psmouse, PSMOUSE_FOCALTECH,
-				 &max_proto, set_properties, false)) {
+	if (psmouse_do_detect(focaltech_detect,
+			      psmouse, false, set_properties)) {
 		if (max_proto > PSMOUSE_IMEX &&
 		    IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH) &&
 		    (!set_properties || focaltech_init(psmouse) == 0)) {
@@ -1074,8 +1082,8 @@ static int psmouse_extensions(struct psmouse *psmouse,
 	 * probing for IntelliMouse.
 	 */
 	if (max_proto > PSMOUSE_PS2 &&
-	    psmouse_try_protocol(psmouse, PSMOUSE_SYNAPTICS, &max_proto,
-				 set_properties, false)) {
+	    psmouse_do_detect(synaptics_detect,
+			      psmouse, false, set_properties)) {
 		synaptics_hardware = true;
 
 		if (max_proto > PSMOUSE_IMEX) {
Signature · 1 line
2.15.1
#130 lore raw

PATCH 19/161 libbpf: Makefile set specified permission mode

In reply to Sasha Levin

From: Jesper Dangaard Brouer <[email protected]>

[ Upstream commit 7110d80d53f472956420cd05a6297f49b558b674 ]

The third parameter to do_install was not used by $(INSTALL) command. Fix this by only setting the -m option when the third parameter is supplied.

The use of a third parameter was introduced in commit eb54e522a000 ("bpf:
install libbpf headers on 'make install'").

Without this change, the header files are install as executables files (755).

Fixes eb54e522a000 ("bpf: install libbpf headers on 'make install'")
---
 tools/lib/bpf/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/Makefile +1 -1
index 4555304dc18e..f02448e86d38 100644
@@ -183,7 +183,7 @@ define do_install
 	if [ ! -d '$(DESTDIR_SQ)$2' ]; then		\
 		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2';	\
 	fi;						\
-	$(INSTALL) $1 '$(DESTDIR_SQ)$2'
+	$(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2'
 endef
 
 install_lib: all_cmd
Signature · 1 line
2.15.1
#131 lore raw

PATCH 20/161 Input: synaptics - reset the ABS_X/Y fuzz after initializing MT axes

In reply to Sasha Levin

From: Peter Hutterer <[email protected]>

[ Upstream commit 19eb4ed1141bd1096b9bc84ba9c4d03d5830c143 ]

input_mt_init_slots() resets the ABS_X/Y fuzz to 0 and expects the driver to call input_mt_report_pointer_emulation(). That is based on the MT position bits which are already defuzzed - hence a fuzz of 0.

In the case of synaptics semi-mt devices, we report the ABS_X/Y axes manually. This results in the MT position being defuzzed but the single-touch emulation missing that defuzzing.

Work around this by re-initializing the ABS_X/Y axes after the MT axis to get the same fuzz value back.

https://bugs.freedesktop.org/show_bug.cgi?id=104533

---
 drivers/input/mouse/synaptics.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/input/mouse/synaptics.c +10 -0
index ee5466a374bf..a246fc686bb7 100644
@@ -1280,6 +1280,16 @@ static void set_input_params(struct psmouse *psmouse,
 				    INPUT_MT_POINTER |
 				    (cr48_profile_sensor ?
 					INPUT_MT_TRACK : INPUT_MT_SEMI_MT));
+
+		/*
+		 * For semi-mt devices we send ABS_X/Y ourselves instead of
+		 * input_mt_report_pointer_emulation. But
+		 * input_mt_init_slots() resets the fuzz to 0, leading to a
+		 * filtered ABS_MT_POSITION_X but an unfiltered ABS_X
+		 * position. Let's re-initialize ABS_X/Y here.
+		 */
+		if (!cr48_profile_sensor)
+			set_abs_position_params(dev, &priv->info, ABS_X, ABS_Y);
 	}
 
 	if (SYN_CAP_PALMDETECT(info->capabilities))
Signature · 1 line
2.15.1
#132 lore raw

PATCH 21/161 i40iw: Free IEQ resources

In reply to Sasha Levin

From: Mustafa Ismail <[email protected]>

[ Upstream commit f20d429511affab6a2a9129f46042f43e6ffe396 ]

The iWARP Exception Queue (IEQ) resources are not freed when a QP is destroyed. Fix this by freeing IEQ resources when freeing QP resources.

Fixes d37498417947 ("i40iw: add files for iwarp interface")
---
 drivers/infiniband/hw/i40iw/i40iw_puda.c  | 3 +--
 drivers/infiniband/hw/i40iw/i40iw_puda.h  | 1 +
 drivers/infiniband/hw/i40iw/i40iw_verbs.c | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_puda.c +1 -2
index 59f70676f0e0..74c7f6879084 100644
@@ -48,7 +48,6 @@ static void i40iw_ieq_tx_compl(struct i40iw_sc_vsi *vsi, void *sqwrid);
 static void i40iw_ilq_putback_rcvbuf(struct i40iw_sc_qp *qp, u32 wqe_idx);
 static enum i40iw_status_code i40iw_puda_replenish_rq(struct i40iw_puda_rsrc
 						      *rsrc, bool initial);
-static void i40iw_ieq_cleanup_qp(struct i40iw_puda_rsrc *ieq, struct i40iw_sc_qp *qp);
 /**
  * i40iw_puda_get_listbuf - get buffer from puda list
  * @list: list to use for buffers (ILQ or IEQ)
@@ -1480,7 +1479,7 @@ static void i40iw_ieq_tx_compl(struct i40iw_sc_vsi *vsi, void *sqwrid)
  * @ieq: ieq resource
  * @qp: all pending fpdu buffers
  */
-static void i40iw_ieq_cleanup_qp(struct i40iw_puda_rsrc *ieq, struct i40iw_sc_qp *qp)
+void i40iw_ieq_cleanup_qp(struct i40iw_puda_rsrc *ieq, struct i40iw_sc_qp *qp)
 {
 	struct i40iw_puda_buf *buf;
 	struct i40iw_pfpdu *pfpdu = &qp->pfpdu;
drivers/infiniband/hw/i40iw/i40iw_puda.h +1 -0
index dba05ce7d392..ebe37f157d90 100644
@@ -186,4 +186,5 @@ enum i40iw_status_code i40iw_cqp_qp_create_cmd(struct i40iw_sc_dev *dev, struct
 enum i40iw_status_code i40iw_cqp_cq_create_cmd(struct i40iw_sc_dev *dev, struct i40iw_sc_cq *cq);
 void i40iw_cqp_qp_destroy_cmd(struct i40iw_sc_dev *dev, struct i40iw_sc_qp *qp);
 void i40iw_cqp_cq_destroy_cmd(struct i40iw_sc_dev *dev, struct i40iw_sc_cq *cq);
+void i40iw_ieq_cleanup_qp(struct i40iw_puda_rsrc *ieq, struct i40iw_sc_qp *qp);
 #endif
drivers/infiniband/hw/i40iw/i40iw_verbs.c +1 -0
index 62be0a41ad0b..9e7ae7161d2f 100644
@@ -428,6 +428,7 @@ void i40iw_free_qp_resources(struct i40iw_device *iwdev,
 {
 	struct i40iw_pbl *iwpbl = &iwqp->iwpbl;
 
+	i40iw_ieq_cleanup_qp(iwdev->vsi.ieq, &iwqp->sc_qp);
 	i40iw_dealloc_push_page(iwdev, &iwqp->sc_qp);
 	if (qp_num)
 		i40iw_free_resource(iwdev, iwdev->allocated_qps, qp_num);
Signature · 1 line
2.15.1
#133 lore raw

PATCH 22/161 i40iw: Zero-out consumer key on allocate stag for FMR

In reply to Sasha Levin

From: Shiraz Saleem <[email protected]>

[ Upstream commit 6376e926af1a8661dd1b2e6d0896e07f84a35844 ]

If the application invalidates the MR before the FMR WR, HW parses the consumer key portion of the stag and returns an invalid stag key Asynchronous Event (AE) that tears down the QP.

Fix this by zeroing-out the consumer key portion of the allocated stag returned to application for FMR.

Fixes ee855d3b93f3 ("RDMA/i40iw: Add base memory management extensions")
---
 drivers/infiniband/hw/i40iw/i40iw_verbs.c | 1 +
 1 file changed, 1 insertion(+)
drivers/infiniband/hw/i40iw/i40iw_verbs.c +1 -0
index 9e7ae7161d2f..b7961f21b555 100644
@@ -1656,6 +1656,7 @@ static struct ib_mr *i40iw_alloc_mr(struct ib_pd *pd,
 		err_code = -EOVERFLOW;
 		goto err;
 	}
+	stag &= ~I40IW_CQPSQ_STAG_KEY_MASK;
 	iwmr->stag = stag;
 	iwmr->ibmr.rkey = stag;
 	iwmr->ibmr.lkey = stag;
Signature · 1 line
2.15.1
#134 lore raw

PATCH 23/161 scsi: qla2xxx: Fix warning in qla2x00_async_iocb_timeout()

In reply to Sasha Levin

From: "[email protected]" <[email protected]>

[ Upstream commit 7ac0c332f96bb9688560726f5e80c097ed8de59a ]

This patch fixes following Smatch warning:

drivers/scsi/qla2xxx/qla_init.c:130 qla2x00_async_iocb_timeout() error: we previously assumed 'fcport' could be null (see line 107)

Fixes 5c25d451163c ("scsi: qla2xxx: Fix NULL pointer access for fcport structure")

Reported by: Dan Carpenter <[email protected]>

---
 drivers/scsi/qla2xxx/qla_init.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/scsi/qla2xxx/qla_init.c +4 -0
index 2300c02ab5e6..e24f57946a17 100644
@@ -115,6 +115,8 @@ qla2x00_async_iocb_timeout(void *data)
 
 	switch (sp->type) {
 	case SRB_LOGIN_CMD:
+		if (!fcport)
+			break;
 		/* Retry as needed. */
 		lio->u.logio.data[0] = MBS_COMMAND_ERROR;
 		lio->u.logio.data[1] = lio->u.logio.flags & SRB_LOGIN_RETRIED ?
@@ -128,6 +130,8 @@ qla2x00_async_iocb_timeout(void *data)
 		qla24xx_handle_plogi_done_event(fcport->vha, &ea);
 		break;
 	case SRB_LOGOUT_CMD:
+		if (!fcport)
+			break;
 		qlt_logo_completion_handler(fcport, QLA_FUNCTION_TIMEOUT);
 		break;
 	case SRB_CT_PTHRU_CMD:
Signature · 1 line
2.15.1
#135 lore raw

PATCH 24/161 perf unwind: Do not look just at the global callchain_param.record_mode

In reply to Sasha Levin

From: Arnaldo Carvalho de Melo <[email protected]>

[ Upstream commit eabad8c6856f185f876b54c426c2cc69fe0f0a7d ]

When setting up DWARF callchains on specific events, without using 'record' or 'trace' --call-graph, but instead doing it like:

perf trace -e cycles/call-graph=dwarf/

The unwind__prepare_access() call in thread__insert_map() when we process PERF_RECORD_MMAP(2) metadata events were not being performed, precluding us from using per-event DWARF callchains, handling them just when we asked for all events to be DWARF, using "--call-graph dwarf".

We do it in the PERF_RECORD_MMAP because we have to look at one of the executable maps to figure out the executable type (64-bit, 32-bit) of the DSO laid out in that mmap. Also to look at the architecture where the perf.data file was recorded.

All this probably should be deferred to when we process a sample for some thread that has callchains, so that we do this processing only for the threads with samples, not for all of them.

For now, fix using DWARF on specific events.

Before:

  # perf trace --no-syscalls -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
  PING ::1(::1) 56 data bytes
  64 bytes from ::1: icmp_seq=1 ttl=64 time=0.048 ms

--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.048/0.048/0.048/0.000 ms

     0.000 probe_libc:inet_pton:(7fe9597bb350))

Problem processing probe_libc:inet_pton callchain, skipping... #

After:

  # perf trace --no-syscalls -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
  PING ::1(::1) 56 data bytes
  64 bytes from ::1: icmp_seq=1 ttl=64 time=0.060 ms

--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.060/0.060/0.060/0.000 ms

       0.000 probe_libc:inet_pton:(7fd4aa930350))
                                         __inet_pton (inlined)
                                         gaih_inet.constprop.7 (/usr/lib64/libc-2.26.so)
                                         __GI_getaddrinfo (inlined)
                                         [0xffffaa804e51af3f] (/usr/bin/ping)
                                         __libc_start_main (/usr/lib64/libc-2.26.so)
                                         [0xffffaa804e51b379] (/usr/bin/ping)
  #
  # perf trace --call-graph=dwarf --no-syscalls -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
  PING ::1(::1) 56 data bytes
  64 bytes from ::1: icmp_seq=1 ttl=64 time=0.057 ms

--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.057/0.057/0.057/0.000 ms

       0.000 probe_libc:inet_pton:(7f9363b9e350))
                                         __inet_pton (inlined)
                                         gaih_inet.constprop.7 (/usr/lib64/libc-2.26.so)
                                         __GI_getaddrinfo (inlined)
                                         [0xffffa9e8a14e0f3f] (/usr/bin/ping)
                                         __libc_start_main (/usr/lib64/libc-2.26.so)
                                         [0xffffa9e8a14e1379] (/usr/bin/ping)
  #
  # perf trace --call-graph=fp --no-syscalls -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
  PING ::1(::1) 56 data bytes
  64 bytes from ::1: icmp_seq=1 ttl=64 time=0.077 ms

--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.077/0.077/0.077/0.000 ms

       0.000 probe_libc:inet_pton:(7f4947e1c350))
                                         __inet_pton (inlined)
                                         gaih_inet.constprop.7 (/usr/lib64/libc-2.26.so)
                                         __GI_getaddrinfo (inlined)
                                         [0xffffaa716d88ef3f] (/usr/bin/ping)
                                         __libc_start_main (/usr/lib64/libc-2.26.so)
                                         [0xffffaa716d88f379] (/usr/bin/ping)
  #
  # perf trace --no-syscalls -e probe_libc:inet_pton/call-graph=fp/ ping -6 -c 1 ::1
  PING ::1(::1) 56 data bytes
  64 bytes from ::1: icmp_seq=1 ttl=64 time=0.078 ms

--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.078/0.078/0.078/0.000 ms

       0.000 probe_libc:inet_pton:(7fa157696350))
                                         __GI___inet_pton (/usr/lib64/libc-2.26.so)
                                         getaddrinfo (/usr/lib64/libc-2.26.so)
                                         [0xffffa9ba39c74f40] (/usr/bin/ping)

#

---
 tools/perf/builtin-c2c.c                 |  5 +++--
 tools/perf/builtin-report.c              |  5 +++--
 tools/perf/builtin-script.c              |  5 +++--
 tools/perf/tests/dwarf-unwind.c          |  1 +
 tools/perf/util/callchain.c              | 10 ++++++++++
 tools/perf/util/callchain.h              |  2 ++
 tools/perf/util/unwind-libunwind-local.c |  9 +++------
 7 files changed, 25 insertions(+), 12 deletions(-)
tools/perf/builtin-c2c.c +3 -2
index d00aac51130d..3479a1bc7caa 100644
@@ -2393,9 +2393,10 @@ static int setup_callchain(struct perf_evlist *evlist)
 	enum perf_call_graph_mode mode = CALLCHAIN_NONE;
 
 	if ((sample_type & PERF_SAMPLE_REGS_USER) &&
-	    (sample_type & PERF_SAMPLE_STACK_USER))
+	    (sample_type & PERF_SAMPLE_STACK_USER)) {
 		mode = CALLCHAIN_DWARF;
-	else if (sample_type & PERF_SAMPLE_BRANCH_STACK)
+		dwarf_callchain_users = true;
+	} else if (sample_type & PERF_SAMPLE_BRANCH_STACK)
 		mode = CALLCHAIN_LBR;
 	else if (sample_type & PERF_SAMPLE_CALLCHAIN)
 		mode = CALLCHAIN_FP;
tools/perf/builtin-report.c +3 -2
index fae4b0340750..78f048f6a2c2 100644
@@ -312,9 +312,10 @@ static int report__setup_sample_type(struct report *rep)
 
 	if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) {
 		if ((sample_type & PERF_SAMPLE_REGS_USER) &&
-		    (sample_type & PERF_SAMPLE_STACK_USER))
+		    (sample_type & PERF_SAMPLE_STACK_USER)) {
 			callchain_param.record_mode = CALLCHAIN_DWARF;
-		else if (sample_type & PERF_SAMPLE_BRANCH_STACK)
+			dwarf_callchain_users = true;
+		} else if (sample_type & PERF_SAMPLE_BRANCH_STACK)
 			callchain_param.record_mode = CALLCHAIN_LBR;
 		else
 			callchain_param.record_mode = CALLCHAIN_FP;
tools/perf/builtin-script.c +3 -2
index 0fe02758de7d..615fdc63452e 100644
@@ -2574,9 +2574,10 @@ static void script__setup_sample_type(struct perf_script *script)
 
 	if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) {
 		if ((sample_type & PERF_SAMPLE_REGS_USER) &&
-		    (sample_type & PERF_SAMPLE_STACK_USER))
+		    (sample_type & PERF_SAMPLE_STACK_USER)) {
 			callchain_param.record_mode = CALLCHAIN_DWARF;
-		else if (sample_type & PERF_SAMPLE_BRANCH_STACK)
+			dwarf_callchain_users = true;
+		} else if (sample_type & PERF_SAMPLE_BRANCH_STACK)
 			callchain_param.record_mode = CALLCHAIN_LBR;
 		else
 			callchain_param.record_mode = CALLCHAIN_FP;
tools/perf/tests/dwarf-unwind.c +1 -0
index ac40e05bcab4..260418969120 100644
@@ -173,6 +173,7 @@ int test__dwarf_unwind(struct test *test __maybe_unused, int subtest __maybe_unu
 	}
 
 	callchain_param.record_mode = CALLCHAIN_DWARF;
+	dwarf_callchain_users = true;
 
 	if (init_live_machine(machine)) {
 		pr_err("Could not init machine\n");
tools/perf/util/callchain.c +10 -0
index 6031933d811c..146683b1c28d 100644
@@ -37,6 +37,15 @@ struct callchain_param callchain_param = {
 	CALLCHAIN_PARAM_DEFAULT
 };
 
+/*
+ * Are there any events usind DWARF callchains?
+ *
+ * I.e.
+ *
+ * -e cycles/call-graph=dwarf/
+ */
+bool dwarf_callchain_users;
+
 struct callchain_param callchain_param_default = {
 	CALLCHAIN_PARAM_DEFAULT
 };
@@ -265,6 +274,7 @@ int parse_callchain_record(const char *arg, struct callchain_param *param)
 			ret = 0;
 			param->record_mode = CALLCHAIN_DWARF;
 			param->dump_size = default_stack_dump_size;
+			dwarf_callchain_users = true;
 
 			tok = strtok_r(NULL, ",", &saveptr);
 			if (tok) {
tools/perf/util/callchain.h +2 -0
index f967aa47d0a1..9ba5903c8d3e 100644
@@ -89,6 +89,8 @@ enum chain_value {
 	CCVAL_COUNT,
 };
 
+extern bool dwarf_callchain_users;
+
 struct callchain_param {
 	bool			enabled;
 	enum perf_call_graph_mode record_mode;
tools/perf/util/unwind-libunwind-local.c +3 -6
index 7a42f703e858..af873044d33a 100644
@@ -631,9 +631,8 @@ static unw_accessors_t accessors = {
 
 static int _unwind__prepare_access(struct thread *thread)
 {
-	if (callchain_param.record_mode != CALLCHAIN_DWARF)
+	if (!dwarf_callchain_users)
 		return 0;
-
 	thread->addr_space = unw_create_addr_space(&accessors, 0);
 	if (!thread->addr_space) {
 		pr_err("unwind: Can't create unwind address space.\n");
@@ -646,17 +645,15 @@ static int _unwind__prepare_access(struct thread *thread)
 
 static void _unwind__flush_access(struct thread *thread)
 {
-	if (callchain_param.record_mode != CALLCHAIN_DWARF)
+	if (!dwarf_callchain_users)
 		return;
-
 	unw_flush_cache(thread->addr_space, 0, 0);
 }
 
 static void _unwind__finish_access(struct thread *thread)
 {
-	if (callchain_param.record_mode != CALLCHAIN_DWARF)
+	if (!dwarf_callchain_users)
 		return;
-
 	unw_destroy_addr_space(thread->addr_space);
 }
 
Signature · 1 line
2.15.1
#136 lore raw

PATCH 25/161 tools lib traceevent: Simplify pointer print logic and fix %pF

In reply to Sasha Levin

From: "Steven Rostedt (VMware)" <[email protected]>

[ Upstream commit 38d70b7ca1769f26c0b79f3c08ff2cc949712b59 ]

When processing %pX in pretty_print(), simplify the logic slightly by incrementing the ptr to the format string if isalnum(ptr[1]) is true. This follows the logic a bit more closely to what is in the kernel.

Also, this fixes a small bug where %pF was not giving the offset of the function.

---
 tools/lib/traceevent/event-parse.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
tools/lib/traceevent/event-parse.c +9 -8
index 7ce724fc0544..9a17bc27296e 100644
@@ -4949,21 +4949,22 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
 				else
 					ls = 2;
 
-				if (*(ptr+1) == 'F' || *(ptr+1) == 'f' ||
-				    *(ptr+1) == 'S' || *(ptr+1) == 's') {
+				if (isalnum(ptr[1]))
 					ptr++;
+
+				if (*ptr == 'F' || *ptr == 'f' ||
+				    *ptr == 'S' || *ptr == 's') {
 					show_func = *ptr;
-				} else if (*(ptr+1) == 'M' || *(ptr+1) == 'm') {
-					print_mac_arg(s, *(ptr+1), data, size, event, arg);
-					ptr++;
+				} else if (*ptr == 'M' || *ptr == 'm') {
+					print_mac_arg(s, *ptr, data, size, event, arg);
 					arg = arg->next;
 					break;
-				} else if (*(ptr+1) == 'I' || *(ptr+1) == 'i') {
+				} else if (*ptr == 'I' || *ptr == 'i') {
 					int n;
 
-					n = print_ip_arg(s, ptr+1, data, size, event, arg);
+					n = print_ip_arg(s, ptr, data, size, event, arg);
 					if (n > 0) {
-						ptr += n;
+						ptr += n - 1;
 						arg = arg->next;
 						break;
 					}
Signature · 1 line
2.15.1
#137 lore raw

PATCH 26/161 perf callchain: Fix attr.sample_max_stack setting

In reply to Sasha Levin

From: Arnaldo Carvalho de Melo <[email protected]>

[ Upstream commit 249d98e567e25dd03e015e2d31e1b7b9648f34df ]

When setting the "dwarf" unwinder for a specific event and not specifying the max-stack, the attr.sample_max_stack ended up using an uninitialized callchain_param.max_stack, fix it by using designated initializers for that callchain_param variable, zeroing all non explicitely initialized struct members.

Here is what happened:

  # perf trace -vv --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
  callchain: type DWARF
  callchain: stack dump size 8192
  perf_event_attr:
    type                             2
    size                             112
    config                           0x730
    { sample_period, sample_freq }   1
    sample_type                      IP|TID|TIME|ADDR|CALLCHAIN|CPU|PERIOD|RAW|REGS_USER|STACK_USER|DATA_SRC
    exclude_callchain_user           1
    { wakeup_events, wakeup_watermark } 1
    sample_regs_user                 0xff0fff
    sample_stack_user                8192
    sample_max_stack                 50656
  sys_perf_event_open failed, error -75
  Value too large for defined data type
  # perf trace -vv --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
  callchain: type DWARF
  callchain: stack dump size 8192
  perf_event_attr:
    type                             2
    size                             112
    config                           0x730
    sample_type                      IP|TID|TIME|ADDR|CALLCHAIN|CPU|PERIOD|RAW|REGS_USER|STACK_USER|DATA_SRC
    exclude_callchain_user           1
    sample_regs_user                 0xff0fff
    sample_stack_user                8192
    sample_max_stack                 30448
  sys_perf_event_open failed, error -75
  Value too large for defined data type
  #

Now the attr.sample_max_stack is set to zero and the above works as expected:

  # perf trace --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
  PING ::1(::1) 56 data bytes
  64 bytes from ::1: icmp_seq=1 ttl=64 time=0.072 ms

--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.072/0.072/0.072/0.000 ms

       0.000 probe_libc:inet_pton:(7feb7a998350))
                                         __inet_pton (inlined)
                                         gaih_inet.constprop.7 (/usr/lib64/libc-2.26.so)
                                         __GI_getaddrinfo (inlined)
                                         [0xffffaa39b6108f3f] (/usr/bin/ping)

#

---
 tools/perf/util/evsel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/util/evsel.c +4 -4
index 1f6beb3d0c68..4c31a22bbaa0 100644
@@ -722,14 +722,14 @@ static void apply_config_terms(struct perf_evsel *evsel,
 	struct perf_evsel_config_term *term;
 	struct list_head *config_terms = &evsel->config_terms;
 	struct perf_event_attr *attr = &evsel->attr;
-	struct callchain_param param;
+	/* callgraph default */
+	struct callchain_param param = {
+		.record_mode = callchain_param.record_mode,
+	};
 	u32 dump_size = 0;
 	int max_stack = 0;
 	const char *callgraph_buf = NULL;
 
-	/* callgraph default */
-	param.record_mode = callchain_param.record_mode;
-
 	list_for_each_entry(term, config_terms, list) {
 		switch (term->type) {
 		case PERF_EVSEL__CONFIG_TERM_PERIOD:
Signature · 1 line
2.15.1
#138 lore raw

PATCH 27/161 tools lib traceevent: Fix get_field_str() for dynamic strings

In reply to Sasha Levin

From: "Steven Rostedt (VMware)" <[email protected]>

[ Upstream commit d777f8de99b05d399c0e4e51cdce016f26bd971b ]

If a field is a dynamic string, get_field_str() returned just the offset/size value and not the string. Have it parse the offset/size correctly to return the actual string. Otherwise filtering fails when trying to filter fields that are dynamic strings.

---
 tools/lib/traceevent/parse-filter.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
tools/lib/traceevent/parse-filter.c +9 -1
index 7c214ceb9386..5e10ba796a6f 100644
@@ -1879,17 +1879,25 @@ static const char *get_field_str(struct filter_arg *arg, struct pevent_record *r
 	struct pevent *pevent;
 	unsigned long long addr;
 	const char *val = NULL;
+	unsigned int size;
 	char hex[64];
 
 	/* If the field is not a string convert it */
 	if (arg->str.field->flags & FIELD_IS_STRING) {
 		val = record->data + arg->str.field->offset;
+		size = arg->str.field->size;
+
+		if (arg->str.field->flags & FIELD_IS_DYNAMIC) {
+			addr = *(unsigned int *)val;
+			val = record->data + (addr & 0xffff);
+			size = addr >> 16;
+		}
 
 		/*
 		 * We need to copy the data since we can't be sure the field
 		 * is null terminated.
 		 */
-		if (*(val + arg->str.field->size - 1)) {
+		if (*(val + size - 1)) {
 			/* copy it */
 			memcpy(arg->str.buffer, val, arg->str.field->size);
 			/* the buffer is already NULL terminated */
Signature · 1 line
2.15.1
#139 lore raw

PATCH 28/161 perf record: Fix failed memory allocation for get_cpuid_str

In reply to Sasha Levin

From: Thomas Richter <[email protected]>

[ Upstream commit 81fccd6ca507d3b2012eaf1edeb9b1dbf4bd22db ]

In x86 architecture dependend part function get_cpuid_str() mallocs a 128 byte buffer, but does not check if the memory allocation succeeded or not.

When the memory allocation fails, function __get_cpuid() is called with first parameter being a NULL pointer. However this function references its first parameter and operates on a NULL pointer which might cause core dumps.

---
 tools/perf/arch/x86/util/header.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/x86/util/header.c +1 -1
index 33027c5e6f92..c6b5204e0280 100644
@@ -70,7 +70,7 @@ get_cpuid_str(void)
 {
 	char *buf = malloc(128);
 
-	if (__get_cpuid(buf, 128, "%s-%u-%X$") < 0) {
+	if (buf && __get_cpuid(buf, 128, "%s-%u-%X$") < 0) {
 		free(buf);
 		return NULL;
 	}
Signature · 1 line
2.15.1
#140 lore raw

PATCH 29/161 iommu/exynos: Don't unconditionally steal bus ops

In reply to Sasha Levin

From: Robin Murphy <[email protected]>

[ Upstream commit dc98b8480d8a68c2ce9aa28b9f0d714fd258bc0b ]

Removing the early device registration hook overlooked the fact that it only ran conditionally on a compatible device being present in the DT. With exynos_iommu_init() now running as an unconditional initcall, problems arise on non-Exynos systems when other IOMMU drivers find themselves unable to install their ops on the platform bus, or at worst the Exynos ops get called with someone else's domain and all hell breaks loose.

The global ops/cache setup could probably all now be triggered from the first IOMMU probe, as with dma_dev assigment, but for the time being the simplest fix is to resurrect the logic from commit a7b67cd5d9af ("iommu/exynos: Play nice in multi-platform builds") to explicitly check the DT for the presence of an Exynos IOMMU before trying anything.

Fixes 928055a01b3f ("iommu/exynos: Remove custom platform device registration code")
---
 drivers/iommu/exynos-iommu.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/iommu/exynos-iommu.c +7 -0
index 25c2c75f5332..13485a40dd46 100644
@@ -1344,8 +1344,15 @@ static const struct iommu_ops exynos_iommu_ops = {
 
 static int __init exynos_iommu_init(void)
 {
+	struct device_node *np;
 	int ret;
 
+	np = of_find_matching_node(NULL, sysmmu_of_match);
+	if (!np)
+		return 0;
+
+	of_node_put(np);
+
 	lv2table_kmem_cache = kmem_cache_create("exynos-iommu-lv2table",
 				LV2TABLE_SIZE, LV2TABLE_SIZE, 0, NULL);
 	if (!lv2table_kmem_cache) {
Signature · 1 line
2.15.1
#141 lore raw

PATCH 30/161 powerpc: System reset avoid interleaving oops using die synchronisation

In reply to Sasha Levin

From: Nicholas Piggin <[email protected]>

[ Upstream commit 4552d128c26e0f0f27a5bd2fadc24092b8f6c1d7 ]

The die() oops path contains a serializing lock to prevent oops messages from being interleaved. In the case of a system reset initiated oops (e.g., qemu nmi command), __die was being called which lacks that synchronisation and oops reports could be interleaved across CPUs.

A recent patch 4388c9b3a6ee7 ("powerpc: Do not send system reset request through the oops path") changed this to __die to avoid the debugger() call, but there is no real harm to calling it twice if the first time fell through. So go back to using die() here. This was observed to fix the problem.

Fixes 4388c9b3a6ee7 ("powerpc: Do not send system reset request through the oops path")
---
 arch/powerpc/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/traps.c +1 -1
index 13c9dcdcba69..d17007451f62 100644
@@ -336,7 +336,7 @@ void system_reset_exception(struct pt_regs *regs)
 	 * No debugger or crash dump registered, print logs then
 	 * panic.
 	 */
-	__die("System Reset", regs, SIGABRT);
+	die("System Reset", regs, SIGABRT);
 
 	mdelay(2*MSEC_PER_SEC); /* Wait a little while for others to print */
 	add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
Signature · 1 line
2.15.1
#142 lore raw

PATCH 31/161 iommu/vt-d: Use domain instead of cache fetching

In reply to Sasha Levin

From: Peter Xu <[email protected]>

[ Upstream commit 9d2e6505f6d6934e681aed502f566198cb25c74a ]

after commit a1ddcbe93010 ("iommu/vt-d: Pass dmar_domain directly into iommu_flush_iotlb_psi", 2015-08-12), we have domain pointer as parameter to iommu_flush_iotlb_psi(), so no need to fetch it from cache again.

More importantly, a NULL reference pointer bug is reported on RHEL7 (and it can be reproduced on some old upstream kernels too, e.g., v4.13) by unplugging an 40g nic from a VM (hard to test unplug on real host, but it should be the same):

https://bugzilla.redhat.com/show_bug.cgi?id=1531367

[   24.391863] pciehp 0000:00:03.0:pcie004: Slot(0): Attention button pressed
[   24.393442] pciehp 0000:00:03.0:pcie004: Slot(0): Powering off due to button press
[   29.721068] i40evf 0000:01:00.0: Unable to send opcode 2 to PF, err I40E_ERR_QUEUE_EMPTY, aq_err OK
[   29.783557] iommu: Removing device 0000:01:00.0 from group 3
[   29.784662] BUG: unable to handle kernel NULL pointer dereference at 0000000000000304
[   29.785817] IP: iommu_flush_iotlb_psi+0xcf/0x120
[   29.786486] PGD 0
[   29.786487] P4D 0
[   29.786812]
[   29.787390] Oops: 0000 [#1] SMP
[   29.787876] Modules linked in: ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_ng
[   29.795371] CPU: 0 PID: 156 Comm: kworker/0:2 Not tainted 4.13.0 #14
[   29.796366] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.11.0-1.el7 04/01/2014
[   29.797593] Workqueue: pciehp-0 pciehp_power_thread
[   29.798328] task: ffff94f5745b4a00 task.stack: ffffb326805ac000
[   29.799178] RIP: 0010:iommu_flush_iotlb_psi+0xcf/0x120
[   29.799919] RSP: 0018:ffffb326805afbd0 EFLAGS: 00010086
[   29.800666] RAX: ffff94f5bc56e800 RBX: 0000000000000000 RCX: 0000000200000025
[   29.801667] RDX: ffff94f5bc56e000 RSI: 0000000000000082 RDI: 0000000000000000
[   29.802755] RBP: ffffb326805afbf8 R08: 0000000000000000 R09: ffff94f5bc86bbf0
[   29.803772] R10: ffffb326805afba8 R11: 00000000000ffdc4 R12: ffff94f5bc86a400
[   29.804789] R13: 0000000000000000 R14: 00000000ffdc4000 R15: 0000000000000000
[   29.805792] FS:  0000000000000000(0000) GS:ffff94f5bfc00000(0000) knlGS:0000000000000000
[   29.806923] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   29.807736] CR2: 0000000000000304 CR3: 000000003499d000 CR4: 00000000000006f0
[   29.808747] Call Trace:
[   29.809156]  flush_unmaps_timeout+0x126/0x1c0
[   29.809800]  domain_exit+0xd6/0x100
[   29.810322]  device_notifier+0x6b/0x70
[   29.810902]  notifier_call_chain+0x4a/0x70
[   29.812822]  __blocking_notifier_call_chain+0x47/0x60
[   29.814499]  blocking_notifier_call_chain+0x16/0x20
[   29.816137]  device_del+0x233/0x320
[   29.817588]  pci_remove_bus_device+0x6f/0x110
[   29.819133]  pci_stop_and_remove_bus_device+0x1a/0x20
[   29.820817]  pciehp_unconfigure_device+0x7a/0x1d0
[   29.822434]  pciehp_disable_slot+0x52/0xe0
[   29.823931]  pciehp_power_thread+0x8a/0xa0
[   29.825411]  process_one_work+0x18c/0x3a0
[   29.826875]  worker_thread+0x4e/0x3b0
[   29.828263]  kthread+0x109/0x140
[   29.829564]  ? process_one_work+0x3a0/0x3a0
[   29.831081]  ? kthread_park+0x60/0x60
[   29.832464]  ret_from_fork+0x25/0x30
[   29.833794] Code: 85 ed 74 0b 5b 41 5c 41 5d 41 5e 41 5f 5d c3 49 8b 54 24 60 44 89 f8 0f b6 c4 48 8b 04 c2 48 85 c0 74 49 45 0f b6 ff 4a 8b 3c f8 <80> bf
[   29.838514] RIP: iommu_flush_iotlb_psi+0xcf/0x120 RSP: ffffb326805afbd0
[   29.840362] CR2: 0000000000000304
[   29.841716] ---[ end trace b10ec0d6900868d3 ]---

This patch fixes that problem if applied to v4.13 kernel.

The bug does not exist on latest upstream kernel since it's fixed as a side effect of commit 13cf01744608 ("iommu/vt-d: Make use of iova deferred flushing", 2017-08-15). But IMHO it's still good to have this patch upstream.

CC Alex Williamson <[email protected]>
Fixes a1ddcbe93010 ("iommu/vt-d: Pass dmar_domain directly into iommu_flush_iotlb_psi")
---
 drivers/iommu/intel-iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iommu/intel-iommu.c +1 -2
index 83f3d4831f94..e8414bcf8390 100644
@@ -1603,8 +1603,7 @@ static void iommu_flush_iotlb_psi(struct intel_iommu *iommu,
 	 * flush. However, device IOTLB doesn't need to be flushed in this case.
 	 */
 	if (!cap_caching_mode(iommu->cap) || !map)
-		iommu_flush_dev_iotlb(get_iommu_domain(iommu, did),
-				      addr, mask);
+		iommu_flush_dev_iotlb(domain, addr, mask);
 }
 
 static void iommu_flush_iova(struct iova_domain *iovad)
Signature · 1 line
2.15.1
#143 lore raw

PATCH 32/161 dm thin: fix documentation relative to low water mark threshold

In reply to Sasha Levin

From: mulhern <[email protected]>

[ Upstream commit 9b28a1102efc75d81298198166ead87d643a29ce ]

Fixes:
1. The use of "exceeds" when the opposite of exceeds, falls below, was meant.
2. Properly speaking, a table can not exceed a threshold.

It emphasizes the important point, which is that it is the userspace daemon's responsibility to check for low free space when a device is resumed, since it won't get a special event indicating low free space in that situation.

---
 Documentation/device-mapper/thin-provisioning.txt | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Documentation/device-mapper/thin-provisioning.txt +5 -3
index 1699a55b7b70..ef639960b272 100644
@@ -112,9 +112,11 @@ $low_water_mark is expressed in blocks of size $data_block_size.  If
 free space on the data device drops below this level then a dm event
 will be triggered which a userspace daemon should catch allowing it to
 extend the pool device.  Only one such event will be sent.
-Resuming a device with a new table itself triggers an event so the
-userspace daemon can use this to detect a situation where a new table
-already exceeds the threshold.
+
+No special event is triggered if a just resumed device's free space is below
+the low water mark. However, resuming a device always triggers an
+event; a userspace daemon should verify that free space exceeds the low
+water mark when handling this event.
 
 A low water mark for the metadata device is maintained in the kernel and
 will trigger a dm event if free space on the metadata device drops below
Signature · 1 line
2.15.1
#144 lore raw

PATCH 33/161 dm mpath: return DM_MAPIO_REQUEUE on blk-mq rq allocation failure

In reply to Sasha Levin

From: Ming Lei <[email protected]>

[ Upstream commit 050af08ffb1b62af69196d61c22a0755f9a3cdbd ]

blk-mq will rerun queue via RESTART or dispatch wake after one request is completed, so not necessary to wait random time for requeuing, we should trust blk-mq to do it.

More importantly, we need to return BLK_STS_RESOURCE to blk-mq so that dequeuing from the I/O scheduler can be stopped, this results in improved I/O merging.

---
 drivers/md/dm-mpath.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/md/dm-mpath.c +13 -1
index 2704a55f8b6e..8b7328666eaa 100644
@@ -502,8 +502,20 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,
 		if (queue_dying) {
 			atomic_inc(&m->pg_init_in_progress);
 			activate_or_offline_path(pgpath);
+			return DM_MAPIO_DELAY_REQUEUE;
 		}
-		return DM_MAPIO_DELAY_REQUEUE;
+
+		/*
+		 * blk-mq's SCHED_RESTART can cover this requeue, so we
+		 * needn't deal with it by DELAY_REQUEUE. More importantly,
+		 * we have to return DM_MAPIO_REQUEUE so that blk-mq can
+		 * get the queue busy feedback (via BLK_STS_RESOURCE),
+		 * otherwise I/O merging can suffer.
+		 */
+		if (q->mq_ops)
+			return DM_MAPIO_REQUEUE;
+		else
+			return DM_MAPIO_DELAY_REQUEUE;
 	}
 	clone->bio = clone->biotail = NULL;
 	clone->rq_disk = bdev->bd_disk;
Signature · 1 line
2.15.1
#145 lore raw

PATCH 35/161 ubifs: Fix uninitialized variable in search_dh_cookie()

In reply to Sasha Levin

From: Geert Uytterhoeven <[email protected]>

[ Upstream commit c877154d307f4a91e0b5b85b75535713dab945ae ]

fs/ubifs/tnc.c: In function ‘search_dh_cookie’:
fs/ubifs/tnc.c:1893: warning: ‘err’ is used uninitialized in this function

Indeed, err is always used uninitialized.

According to an original review comment from Hyunchul, acknowledged by Richard, err should be initialized to -ENOENT to avoid the first call to tnc_next(). But we can achieve the same by reordering the code.

Fixes 781f675e2d7e ("ubifs: Fix unlink code wrt. double hash lookups")
---
 fs/ubifs/tnc.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)
fs/ubifs/tnc.c +7 -14
index 0a213dcba2a1..ba3d0e0f8615 100644
@@ -1890,35 +1890,28 @@ static int search_dh_cookie(struct ubifs_info *c, const union ubifs_key *key,
 	union ubifs_key *dkey;
 
 	for (;;) {
-		if (!err) {
-			err = tnc_next(c, &znode, n);
-			if (err)
-				goto out;
-		}
-
 		zbr = &znode->zbranch[*n];
 		dkey = &zbr->key;
 
 		if (key_inum(c, dkey) != key_inum(c, key) ||
 		    key_type(c, dkey) != key_type(c, key)) {
-			err = -ENOENT;
-			goto out;
+			return -ENOENT;
 		}
 
 		err = tnc_read_hashed_node(c, zbr, dent);
 		if (err)
-			goto out;
+			return err;
 
 		if (key_hash(c, key) == key_hash(c, dkey) &&
 		    le32_to_cpu(dent->cookie) == cookie) {
 			*zn = znode;
-			goto out;
+			return 0;
 		}
-	}
-
-out:
 
-	return err;
+		err = tnc_next(c, &znode, n);
+		if (err)
+			return err;
+	}
 }
 
 static int do_lookup_dh(struct ubifs_info *c, const union ubifs_key *key,
Signature · 1 line
2.15.1
#146 lore raw

PATCH 36/161 net: stmmac: dwmac-meson8b: fix setting the RGMII TX clock on Meson8b

In reply to Sasha Levin

From: Martin Blumenstingl <[email protected]>

[ Upstream commit 433c6cab9d298687c097f6ee82e49157044dc7c6 ]

Meson8b only supports MPLL2 as clock input. The rate of the MPLL2 clock set by Odroid-C1's u-boot is close to (but not exactly) 500MHz. The exact rate is 500002394Hz, which is calculated in drivers/clk/meson/clk-mpll.c using the following formula:
DIV_ROUND_UP_ULL((u64)parent_rate * SDM_DEN, (SDM_DEN * n2) + sdm) Odroid-C1's u-boot configures MPLL2 with the following values:
- SDM_DEN = 16384
- SDM = 1638
- N2 = 5

The 250MHz clock (m250_div) inside dwmac-meson8b driver is derived from the MPLL2 clock. Due to MPLL2 running slightly faster than 500MHz the common clock framework chooses a divider which is too big to generate the 250MHz clock (a divider of 2 would be needed, but this is rounded up to a divider of 3). This breaks the RTL8211F RGMII PHY on Odroid-C1 because it requires a (close to) 125MHz RGMII TX clock (on Gbit speeds, the IP block internally divides that down to 25MHz on 100Mbit/s connections and 2.5MHz on 10Mbit/s connections - we don't need any special configuration for that).

Round the divider to the closest value to prevent this issue on Meson8b. This means we'll now end up with a clock rate for the RGMII TX clock of 125001197Hz (= 125MHz plus 1197Hz), which is close-enough to 125MHz. This has no effect on the Meson GX SoCs since there fclk_div2 is used as input clock, which has a rate of 1000MHz (and thus is divisible cleanly to 250MHz and 125MHz).

Fixes 566e8251625304 ("net: stmmac: add a glue driver for the Amlogic Meson 8b / GXBB DWMAC")
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +3 -1
index 4404650b32c5..157e12e15f28 100644
@@ -144,7 +144,9 @@ static int meson8b_init_clk(struct meson8b_dwmac *dwmac)
 	dwmac->m250_div.shift = PRG_ETH0_CLK_M250_DIV_SHIFT;
 	dwmac->m250_div.width = PRG_ETH0_CLK_M250_DIV_WIDTH;
 	dwmac->m250_div.hw.init = &init;
-	dwmac->m250_div.flags = CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO;
+	dwmac->m250_div.flags = CLK_DIVIDER_ONE_BASED |
+				CLK_DIVIDER_ALLOW_ZERO |
+				CLK_DIVIDER_ROUND_CLOSEST;
 
 	dwmac->m250_div_clk = devm_clk_register(dev, &dwmac->m250_div.hw);
 	if (WARN_ON(IS_ERR(dwmac->m250_div_clk)))
Signature · 1 line
2.15.1
#147 lore raw

PATCH 37/161 net: stmmac: dwmac-meson8b: propagate rate changes to the parent clock

In reply to Sasha Levin

From: Martin Blumenstingl <[email protected]>

[ Upstream commit fb7d38a70e1d8ffd54f7a7464dcc4889d7e490ad ]

On Meson8b the only valid input clock is MPLL2. The bootloader configures that to run at 500002394Hz which cannot be divided evenly down to 125MHz using the m250_div clock. Currently the common clock framework chooses a m250_div of 2 - with the internal fixed "divide by 10" this results in a RGMII TX clock of 125001197Hz (120Hz above the requested 125MHz).

Letting the common clock framework propagate the rate changes up to the parent of m250_mux allows us to get the best possible clock rate. With this patch the common clock framework calculates a rate of very-close-to-250MHz (249999701Hz to be exact) for the MPLL2 clock (which is the mux input). Dividing that by 2 (which is an internal, fixed divider for the RGMII TX clock) gives us an RGMII TX clock of 124999850Hz (which is only 150Hz off the requested 125MHz, compared to 1197Hz based on the MPLL2 rate set by u-boot and the Amlogic GPL kernel sources).

SoCs from the Meson GX series are not affected by this change because the input clock is FCLK_DIV2 whose rate cannot be changed (which is fine since it's running at 1GHz, so it's already a multiple of 250MHz and 125MHz).

Fixes 566e8251625304 ("net: stmmac: add a glue driver for the Amlogic Meson 8b / GXBB DWMAC")
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +1 -1
index 157e12e15f28..8be4b32544ef 100644
@@ -116,7 +116,7 @@ static int meson8b_init_clk(struct meson8b_dwmac *dwmac)
 	snprintf(clk_name, sizeof(clk_name), "%s#m250_sel", dev_name(dev));
 	init.name = clk_name;
 	init.ops = &clk_mux_ops;
-	init.flags = 0;
+	init.flags = CLK_SET_RATE_PARENT;
 	init.parent_names = mux_parent_names;
 	init.num_parents = MUX_CLK_NUM_PARENTS;
 
Signature · 1 line
2.15.1
#148 lore raw

PATCH 38/161 spi: a3700: Clear DATA_OUT when performing a read

In reply to Sasha Levin

From: Maxime Chevallier <[email protected]>

[ Upstream commit 44a5f423e70374e5b42cecd85e78f2d79334e0f2 ]

When performing a read using FIFO mode, the spi controller shifts out the last 2 bytes that were written in a previous transfer on MOSI.

This undocumented behaviour can cause devices to misinterpret the transfer, so we explicitly clear the WFIFO before each read.

This behaviour was noticed on EspressoBin.

---
 drivers/spi/spi-armada-3700.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/spi/spi-armada-3700.c +5 -0
index fe3fa1e8517a..4903f15177cf 100644
@@ -624,6 +624,11 @@ static int a3700_spi_transfer_one(struct spi_master *master,
 	a3700_spi_header_set(a3700_spi);
 
 	if (xfer->rx_buf) {
+		/* Clear WFIFO, since it's last 2 bytes are shifted out during
+		 * a read operation
+		 */
+		spireg_write(a3700_spi, A3700_SPI_DATA_OUT_REG, 0);
+
 		/* Set read data length */
 		spireg_write(a3700_spi, A3700_SPI_IF_DIN_CNT_REG,
 			     a3700_spi->buf_len);
Signature · 1 line
2.15.1
#149 lore raw

PATCH 39/161 IB/cq: Don't force IB_POLL_DIRECT poll context for ib_process_cq_direct

In reply to Sasha Levin

From: Sagi Grimberg <[email protected]>

[ Upstream commit 246d8b184c100e8eb6b4e8c88f232c2ed2a4e672 ]

polling the completion queue directly does not interfere with the existing polling logic, hence drop the requirement. Be aware that running ib_process_cq_direct with non IB_POLL_DIRECT CQ may trigger concurrent CQ processing.

This can be used for polling mode ULPs.

Cc Bart Van Assche <[email protected]>
[maxg: added wcs array argument to __ib_process_cq]
---
 drivers/infiniband/core/cq.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/infiniband/core/cq.c +13 -10
index f2ae75fa3128..c8c5a5a7f433 100644
@@ -25,9 +25,10 @@
 #define IB_POLL_FLAGS \
 	(IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS)
 
-static int __ib_process_cq(struct ib_cq *cq, int budget)
+static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc)
 {
 	int i, n, completed = 0;
+	struct ib_wc *wcs = poll_wc ? : cq->wc;
 
 	/*
 	 * budget might be (-1) if the caller does not
@@ -35,9 +36,9 @@ static int __ib_process_cq(struct ib_cq *cq, int budget)
 	 * minimum here.
 	 */
 	while ((n = ib_poll_cq(cq, min_t(u32, IB_POLL_BATCH,
-			budget - completed), cq->wc)) > 0) {
+			budget - completed), wcs)) > 0) {
 		for (i = 0; i < n; i++) {
-			struct ib_wc *wc = &cq->wc[i];
+			struct ib_wc *wc = &wcs[i];
 
 			if (wc->wr_cqe)
 				wc->wr_cqe->done(cq, wc);
@@ -60,18 +61,20 @@ static int __ib_process_cq(struct ib_cq *cq, int budget)
  * @cq:		CQ to process
  * @budget:	number of CQEs to poll for
  *
- * This function is used to process all outstanding CQ entries on a
- * %IB_POLL_DIRECT CQ.  It does not offload CQ processing to a different
- * context and does not ask for completion interrupts from the HCA.
+ * This function is used to process all outstanding CQ entries.
+ * It does not offload CQ processing to a different context and does
+ * not ask for completion interrupts from the HCA.
+ * Using direct processing on CQ with non IB_POLL_DIRECT type may trigger
+ * concurrent processing.
  *
  * Note: do not pass -1 as %budget unless it is guaranteed that the number
  * of completions that will be processed is small.
  */
 int ib_process_cq_direct(struct ib_cq *cq, int budget)
 {
-	WARN_ON_ONCE(cq->poll_ctx != IB_POLL_DIRECT);
+	struct ib_wc wcs[IB_POLL_BATCH];
 
-	return __ib_process_cq(cq, budget);
+	return __ib_process_cq(cq, budget, wcs);
 }
 EXPORT_SYMBOL(ib_process_cq_direct);
 
@@ -85,7 +88,7 @@ static int ib_poll_handler(struct irq_poll *iop, int budget)
 	struct ib_cq *cq = container_of(iop, struct ib_cq, iop);
 	int completed;
 
-	completed = __ib_process_cq(cq, budget);
+	completed = __ib_process_cq(cq, budget, NULL);
 	if (completed < budget) {
 		irq_poll_complete(&cq->iop);
 		if (ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
@@ -105,7 +108,7 @@ static void ib_cq_poll_work(struct work_struct *work)
 	struct ib_cq *cq = container_of(work, struct ib_cq, work);
 	int completed;
 
-	completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE);
+	completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE, NULL);
 	if (completed >= IB_POLL_BUDGET_WORKQUEUE ||
 	    ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
 		queue_work(ib_comp_wq, &cq->work);
Signature · 1 line
2.15.1
Reviewed-by Sergey Gorenko Reviewed-by Bart Van Assche Acked-by Arnd Bergmann on v1 39/161
#150 lore raw

Re: [PATCH AUTOSEL for 4.14 039/161] IB/cq: Don't force IB_POLL_DIRECT poll context for ib_process_cq_direct

Hi Sasha,
please consider taking a small fix for this one (also useful for 4.15):

commit d3b9e8ad425cfd5b9116732e057f1b48e4d3bcb8

Author: Max Gurtovoy <[email protected]>
Date:   Mon Mar 5 20:09:48 2018 +0200

RDMA/core: Reduce poll batch for direct cq polling

Fix warning limit for kernel stack consumption:

drivers/infiniband/core/cq.c: In function 'ib_process_cq_direct':
drivers/infiniband/core/cq.c:78:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

Using smaller ib_wc array on the stack brings us comfortably below that limit again.

Fixes 246d8b184c10 ("IB/cq: Don't force IB_POLL_DIRECT poll

context for ib_process_cq_direct")

-Max.

Quoted 95 lines · Sasha Levin

From: Sagi Grimberg <[email protected]>

[ Upstream commit 246d8b184c100e8eb6b4e8c88f232c2ed2a4e672 ]

polling the completion queue directly does not interfere with the existing polling logic, hence drop the requirement. Be aware that running ib_process_cq_direct with non IB_POLL_DIRECT CQ may trigger concurrent CQ processing.

This can be used for polling mode ULPs.

Cc Bart Van Assche <[email protected]>
[maxg: added wcs array argument to __ib_process_cq]
---
  drivers/infiniband/core/cq.c | 23 +++++++++++++----------
  1 file changed, 13 insertions(+), 10 deletions(-)
drivers/infiniband/core/cq.c +13 -10
index f2ae75fa3128..c8c5a5a7f433 100644
@@ -25,9 +25,10 @@
  #define IB_POLL_FLAGS \
  	(IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS)
 
-static int __ib_process_cq(struct ib_cq *cq, int budget)
+static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc)
  {
  	int i, n, completed = 0;
+	struct ib_wc *wcs = poll_wc ? : cq->wc;
 
  	/*
  	 * budget might be (-1) if the caller does not
@@ -35,9 +36,9 @@ static int __ib_process_cq(struct ib_cq *cq, int budget)
  	 * minimum here.
  	 */
  	while ((n = ib_poll_cq(cq, min_t(u32, IB_POLL_BATCH,
-			budget - completed), cq->wc)) > 0) {
+			budget - completed), wcs)) > 0) {
  		for (i = 0; i < n; i++) {
-			struct ib_wc *wc = &cq->wc[i];
+			struct ib_wc *wc = &wcs[i];
 
  			if (wc->wr_cqe)
  				wc->wr_cqe->done(cq, wc);
@@ -60,18 +61,20 @@ static int __ib_process_cq(struct ib_cq *cq, int budget)
   * @cq:		CQ to process
   * @budget:	number of CQEs to poll for
   *
- * This function is used to process all outstanding CQ entries on a
- * %IB_POLL_DIRECT CQ.  It does not offload CQ processing to a different
- * context and does not ask for completion interrupts from the HCA.
+ * This function is used to process all outstanding CQ entries.
+ * It does not offload CQ processing to a different context and does
+ * not ask for completion interrupts from the HCA.
+ * Using direct processing on CQ with non IB_POLL_DIRECT type may trigger
+ * concurrent processing.
   *
   * Note: do not pass -1 as %budget unless it is guaranteed that the number
   * of completions that will be processed is small.
   */
  int ib_process_cq_direct(struct ib_cq *cq, int budget)
  {
-	WARN_ON_ONCE(cq->poll_ctx != IB_POLL_DIRECT);
+	struct ib_wc wcs[IB_POLL_BATCH];
 
-	return __ib_process_cq(cq, budget);
+	return __ib_process_cq(cq, budget, wcs);
  }
  EXPORT_SYMBOL(ib_process_cq_direct);
 
@@ -85,7 +88,7 @@ static int ib_poll_handler(struct irq_poll *iop, int budget)
  	struct ib_cq *cq = container_of(iop, struct ib_cq, iop);
  	int completed;
 
-	completed = __ib_process_cq(cq, budget);
+	completed = __ib_process_cq(cq, budget, NULL);
  	if (completed < budget) {
  		irq_poll_complete(&cq->iop);
  		if (ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
@@ -105,7 +108,7 @@ static void ib_cq_poll_work(struct work_struct *work)
  	struct ib_cq *cq = container_of(work, struct ib_cq, work);
  	int completed;
 
-	completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE);
+	completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE, NULL);
  	if (completed >= IB_POLL_BUDGET_WORKQUEUE ||
  	    ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
  		queue_work(ib_comp_wq, &cq->work);
#151 lore raw

Re: [PATCH AUTOSEL for 4.14 039/161] IB/cq: Don't force IB_POLL_DIRECT poll context for ib_process_cq_direct

Grabbed it for both 4.14 and 4.15, thanks Max!

Quoted 121 lines · Max Gurtovoy

Hi Sasha,
please consider taking a small fix for this one (also useful for 4.15):

commit d3b9e8ad425cfd5b9116732e057f1b48e4d3bcb8

Author: Max Gurtovoy <[email protected]>
Date:   Mon Mar 5 20:09:48 2018 +0200

RDMA/core: Reduce poll batch for direct cq polling

Fix warning limit for kernel stack consumption:

drivers/infiniband/core/cq.c: In function 'ib_process_cq_direct':
drivers/infiniband/core/cq.c:78:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

Using smaller ib_wc array on the stack brings us comfortably below that limit again.

   Fixes: 246d8b184c10 ("IB/cq: Don't force IB_POLL_DIRECT poll 

context for ib_process_cq_direct")

-Max.

Quoted 88 lines · Sasha Levin

From: Sagi Grimberg <[email protected]>

[ Upstream commit 246d8b184c100e8eb6b4e8c88f232c2ed2a4e672 ]

polling the completion queue directly does not interfere with the existing polling logic, hence drop the requirement. Be aware that running ib_process_cq_direct with non IB_POLL_DIRECT CQ may trigger concurrent CQ processing.

This can be used for polling mode ULPs.

Cc Bart Van Assche <[email protected]>
[maxg: added wcs array argument to __ib_process_cq]
---
 drivers/infiniband/core/cq.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/infiniband/core/cq.c +13 -10
index f2ae75fa3128..c8c5a5a7f433 100644
@@ -25,9 +25,10 @@
 #define IB_POLL_FLAGS \
 	(IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS)
-static int __ib_process_cq(struct ib_cq *cq, int budget)
+static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc)
 {
 	int i, n, completed = 0;
+	struct ib_wc *wcs = poll_wc ? : cq->wc;
 	/*
 	 * budget might be (-1) if the caller does not
@@ -35,9 +36,9 @@ static int __ib_process_cq(struct ib_cq *cq, int budget)
 	 * minimum here.
 	 */
 	while ((n = ib_poll_cq(cq, min_t(u32, IB_POLL_BATCH,
-			budget - completed), cq->wc)) > 0) {
+			budget - completed), wcs)) > 0) {
 		for (i = 0; i < n; i++) {
-			struct ib_wc *wc = &cq->wc[i];
+			struct ib_wc *wc = &wcs[i];
 			if (wc->wr_cqe)
 				wc->wr_cqe->done(cq, wc);
@@ -60,18 +61,20 @@ static int __ib_process_cq(struct ib_cq *cq, int budget)
  * @cq:		CQ to process
  * @budget:	number of CQEs to poll for
  *
- * This function is used to process all outstanding CQ entries on a
- * %IB_POLL_DIRECT CQ.  It does not offload CQ processing to a different
- * context and does not ask for completion interrupts from the HCA.
+ * This function is used to process all outstanding CQ entries.
+ * It does not offload CQ processing to a different context and does
+ * not ask for completion interrupts from the HCA.
+ * Using direct processing on CQ with non IB_POLL_DIRECT type may trigger
+ * concurrent processing.
  *
  * Note: do not pass -1 as %budget unless it is guaranteed that the number
  * of completions that will be processed is small.
  */
 int ib_process_cq_direct(struct ib_cq *cq, int budget)
 {
-	WARN_ON_ONCE(cq->poll_ctx != IB_POLL_DIRECT);
+	struct ib_wc wcs[IB_POLL_BATCH];
-	return __ib_process_cq(cq, budget);
+	return __ib_process_cq(cq, budget, wcs);
 }
 EXPORT_SYMBOL(ib_process_cq_direct);
@@ -85,7 +88,7 @@ static int ib_poll_handler(struct irq_poll *iop, int budget)
 	struct ib_cq *cq = container_of(iop, struct ib_cq, iop);
 	int completed;
-	completed = __ib_process_cq(cq, budget);
+	completed = __ib_process_cq(cq, budget, NULL);
 	if (completed < budget) {
 		irq_poll_complete(&cq->iop);
 		if (ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
@@ -105,7 +108,7 @@ static void ib_cq_poll_work(struct work_struct *work)
 	struct ib_cq *cq = container_of(work, struct ib_cq, work);
 	int completed;
-	completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE);
+	completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE, NULL);
 	if (completed >= IB_POLL_BUDGET_WORKQUEUE ||
 	    ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
 		queue_work(ib_comp_wq, &cq->work);
 
#152 lore raw

PATCH 40/161 nfs: Do not convert nfs_idmap_cache_timeout to jiffies

In reply to Sasha Levin

From: Jan Chochol <[email protected]>

[ Upstream commit cbebc6ef4fc830f4040d4140bf53484812d5d5d9 ]

Since commit 57e62324e469 ("NFS: Store the legacy idmapper result in the keyring") nfs_idmap_cache_timeout changed units from jiffies to seconds. Unfortunately sysctl interface was not updated accordingly.

As a effect updating /proc/sys/fs/nfs/idmap_cache_timeout with some value will incorrectly multiply this value by HZ.
Also reading /proc/sys/fs/nfs/idmap_cache_timeout will show real value divided by HZ.

Fixes 57e62324e469 ("NFS: Store the legacy idmapper result in the keyring")
---
 fs/nfs/nfs4sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/nfs4sysctl.c +1 -1
index 0d91d84e5822..c394e4447100 100644
@@ -32,7 +32,7 @@ static struct ctl_table nfs4_cb_sysctls[] = {
 		.data = &nfs_idmap_cache_timeout,
 		.maxlen = sizeof(int),
 		.mode = 0644,
-		.proc_handler = proc_dointvec_jiffies,
+		.proc_handler = proc_dointvec,
 	},
 	{ }
 };
Signature · 1 line
2.15.1
#153 lore raw

PATCH 41/161 MIPS: Fix clean of vmlinuz.{32,ecoff,bin,srec}

In reply to Sasha Levin

From: James Hogan <[email protected]>

[ Upstream commit 5f2483eb2423152445b39f2db59d372f523e664e ]

Make doesn't expand shell style "vmlinuz.{32,ecoff,bin,srec}" to the 4 separate files, so none of these files get cleaned up by make clean. List the files separately instead.

Fixes ec3352925b74 ("MIPS: Remove all generated vmlinuz* files on "make clean"")
Cc Ralf Baechle <[email protected]>

Patchwork: https://patchwork.linux-mips.org/patch/18491/

---
 arch/mips/boot/compressed/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/mips/boot/compressed/Makefile +5 -1
index c675eece389a..adce180f3ee4 100644
@@ -133,4 +133,8 @@ vmlinuz.srec: vmlinuz
 uzImage.bin: vmlinuz.bin FORCE
 	$(call if_changed,uimage,none)
 
-clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec}
+clean-files += $(objtree)/vmlinuz
+clean-files += $(objtree)/vmlinuz.32
+clean-files += $(objtree)/vmlinuz.ecoff
+clean-files += $(objtree)/vmlinuz.bin
+clean-files += $(objtree)/vmlinuz.srec
Signature · 1 line
2.15.1
#154 lore raw

Re: [PATCH AUTOSEL for 4.14 041/161] MIPS: Fix clean of vmlinuz.{32,ecoff,bin,srec}

Hi Sasha,

Quoted 8 lines · Sasha Levin

From: James Hogan <[email protected]>

[ Upstream commit 5f2483eb2423152445b39f2db59d372f523e664e ]

Make doesn't expand shell style "vmlinuz.{32,ecoff,bin,srec}" to the 4 separate files, so none of these files get cleaned up by make clean. List the files separately instead.

Quoted 6 lines
Fixes ec3352925b74 ("MIPS: Remove all generated vmlinuz* files on "make clean"")
Cc Ralf Baechle <[email protected]>

Patchwork: https://patchwork.linux-mips.org/patch/18491/

Perhaps you're already on top of it, but this would appear to be equally relevant to the older stable branches too?

Thanks
James

#155 lore raw

PATCH 42/161 clk: ingenic: Fix recalc_rate for clocks with fixed divider

In reply to Sasha Levin

From: Paul Cercueil <[email protected]>

[ Upstream commit e6cfa64375d34a6c8c1861868a381013b2d3b921 ]

Previously, the clocks with a fixed divider would report their rate as being the same as the one of their parent, independently of the divider in use. This commit fixes this behaviour.

This went unnoticed as neither the jz4740 nor the jz4780 CGU code have clocks with fixed dividers yet.

Patchwork: https://patchwork.linux-mips.org/patch/18477/

---
 drivers/clk/ingenic/cgu.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/clk/ingenic/cgu.c +2 -0
index ab393637f7b0..a2e73a6d60fd 100644
@@ -328,6 +328,8 @@ ingenic_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
 		div *= clk_info->div.div;
 
 		rate /= div;
+	} else if (clk_info->type & CGU_CLK_FIXDIV) {
+		rate /= clk_info->fixdiv.div;
 	}
 
 	return rate;
Signature · 1 line
2.15.1
#156 lore raw

PATCH 43/161 MIPS: JZ4770: Work around config2 misreporting associativity

In reply to Sasha Levin

From: Maarten ter Huurne <[email protected]>

[ Upstream commit 1f7412e0e2f327fe7dc5a0c2fc36d7b319d05d47 ]

According to config2, the associativity would be 5-ways, but the documentation states 4-ways, which also matches the documented L2 cache size of 256 kB.

Patchwork: https://patchwork.linux-mips.org/patch/18488/

---
 arch/mips/mm/sc-mips.c | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/mips/mm/sc-mips.c +9 -0
index 548acb7f8557..394673991bab 100644
@@ -16,6 +16,7 @@
 #include <asm/mmu_context.h>
 #include <asm/r4kcache.h>
 #include <asm/mips-cps.h>
+#include <asm/bootinfo.h>
 
 /*
  * MIPS32/MIPS64 L2 cache handling
@@ -220,6 +221,14 @@ static inline int __init mips_sc_probe(void)
 	else
 		return 0;
 
+	/*
+	 * According to config2 it would be 5-ways, but that is contradicted
+	 * by all documentation.
+	 */
+	if (current_cpu_type() == CPU_JZRISC &&
+				mips_machtype == MACH_INGENIC_JZ4770)
+		c->scache.ways = 4;
+
 	c->scache.waysize = c->scache.sets * c->scache.linesz;
 	c->scache.waybit = __ffs(c->scache.waysize);
 
Signature · 1 line
2.15.1
#157 lore raw

Re: [PATCH AUTOSEL for 4.14 043/161] MIPS: JZ4770: Work around config2 misreporting associativity

Quoted 7 lines · Sasha Levin

From: Maarten ter Huurne <[email protected]>

[ Upstream commit 1f7412e0e2f327fe7dc5a0c2fc36d7b319d05d47 ]

According to config2, the associativity would be 5-ways, but the documentation states 4-ways, which also matches the documented L2 cache size of 256 kB.

JZ4770 support is new in 4.16, so no need for this to be backported. More likely it'll just break the build due to references to MACH_INGENIC_JZ4770.

Cheers
James

#158 lore raw

Re: [PATCH AUTOSEL for 4.14 043/161] MIPS: JZ4770: Work around config2 misreporting associativity

Quoted 9 lines · James Hogan
Quoted 7 lines · Sasha Levin

From: Maarten ter Huurne <[email protected]>

[ Upstream commit 1f7412e0e2f327fe7dc5a0c2fc36d7b319d05d47 ]

According to config2, the associativity would be 5-ways, but the documentation states 4-ways, which also matches the documented L2 cache size of 256 kB.

Quoted 6 lines

JZ4770 support is new in 4.16, so no need for this to be backported. More likely it'll just break the build due to references to MACH_INGENIC_JZ4770.

Cheers
James

Now removed, thanks James!

#159 lore raw

PATCH 44/161 PCI: Add dummy pci_irqd_intx_xlate() for CONFIG_PCI=n build

In reply to Sasha Levin

From: Niklas Cassel <[email protected]>

[ Upstream commit 80db6f08b7af93eddc9487535e6150b220262637 ]

Some hardware can operate in either "host" or "endpoint" mode, which means there can be both a host bridge driver and an endpoint driver for the same device. Those drivers share a lot of code, so sometimes they live in the same source file.

The host bridge driver requires CONFIG_PCI=y because it enumerates PCI devices below the bridge using the PCI core. The endpoint driver does not require CONFIG_PCI=y because it runs in an embedded kernel on the other side of the device, e.g., on an adapter card.

pci-dra7xx.c contains both host and endpoint drivers. If we select only the endpoint driver (CONFIG_PCI=n and CONFIG_PCI_DRA7XX_EP=y), the unneeded host driver is still compiled. It references pci_irqd_intx_xlate(), which is not present when CONFIG_PCI=n, which causes this error:

drivers/pci/dwc/pci-dra7xx.c:229:11: error: 'pci_irqd_intx_xlate' undeclared here (not in a function)

Add a dummy pci_irqd_intx_xlate() for the CONFIG_PCI=n case.

---
 include/linux/pci.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/linux/pci.h +7 -0
index d16a7c037ec0..727e309baa5e 100644
@@ -1688,6 +1688,13 @@ static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
 #define dev_is_pf(d) (false)
 static inline bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags)
 { return false; }
+static inline int pci_irqd_intx_xlate(struct irq_domain *d,
+				      struct device_node *node,
+				      const u32 *intspec,
+				      unsigned int intsize,
+				      unsigned long *out_hwirq,
+				      unsigned int *out_type)
+{ return -EINVAL; }
 #endif /* CONFIG_PCI */
 
 /* Include architecture-dependent settings and functions */
Signature · 1 line
2.15.1
#160 lore raw

PATCH 45/161 watchdog: sp5100_tco: Fix watchdog disable bit

In reply to Sasha Levin

From: Guenter Roeck <[email protected]>

[ Upstream commit f541c09ebfc61697b586b38c9ebaf4b70defb278 ]

According to all published information, the watchdog disable bit for SB800 compatible controllers is bit 1 of PM register 0x48, not bit 2. For the most part that doesn't matter in practice, since the bit has to be cleared to enable watchdog address decoding, which is the default setting, but it still needs to be fixed.

---
 drivers/watchdog/sp5100_tco.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/sp5100_tco.h +1 -1
index 1af4dee71337..0e242d1110ce 100644
@@ -55,7 +55,7 @@
 #define SB800_PM_WATCHDOG_CONFIG	0x4C
 
 #define SB800_PCI_WATCHDOG_DECODE_EN	(1 << 0)
-#define SB800_PM_WATCHDOG_DISABLE	(1 << 2)
+#define SB800_PM_WATCHDOG_DISABLE	(1 << 1)
 #define SB800_PM_WATCHDOG_SECOND_RES	(3 << 0)
 #define SB800_ACPI_MMIO_DECODE_EN	(1 << 0)
 #define SB800_ACPI_MMIO_SEL		(1 << 1)
Signature · 1 line
2.15.1
#161 lore raw

PATCH 46/161 kconfig: Don't leak main menus during parsing

In reply to Sasha Levin

From: Ulf Magnusson <[email protected]>

[ Upstream commit 0724a7c32a54e3e50d28e19e30c59014f61d4e2c ]

If a 'mainmenu' entry appeared in the Kconfig files, two things would leak:

- The 'struct property' allocated for the default "Linux Kernel Configuration" prompt.

- The string for the T_WORD/T_WORD_QUOTE prompt after the T_MAINMENU token, allocated on the heap in zconf.l.

To fix it, introduce a new 'no_mainmenu_stmt' nonterminal that matches if there's no 'mainmenu' and adds the default prompt. That means the prompt only gets allocated once regardless of whether there's a 'mainmenu' statement or not, and managing it becomes simple.

Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:

	LEAK SUMMARY:
	   definitely lost: 344,568 bytes in 14,352 blocks
	   ...

Summary after the fix:

	LEAK SUMMARY:
	   definitely lost: 344,440 bytes in 14,350 blocks
	   ...
---
 scripts/kconfig/zconf.y | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)
scripts/kconfig/zconf.y +24 -9
index c8f396c3b190..20d9caa4be99 100644
@@ -108,7 +108,27 @@ static struct menu *current_menu, *current_entry;
 %%
 input: nl start | start;
 
-start: mainmenu_stmt stmt_list | stmt_list;
+start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list;
+
+/* mainmenu entry */
+
+mainmenu_stmt: T_MAINMENU prompt nl
+{
+	menu_add_prompt(P_MENU, $2, NULL);
+};
+
+/* Default main menu, if there's no mainmenu entry */
+
+no_mainmenu_stmt: /* empty */
+{
+	/*
+	 * Hack: Keep the main menu title on the heap so we can safely free it
+	 * later regardless of whether it comes from the 'prompt' in
+	 * mainmenu_stmt or here
+	 */
+	menu_add_prompt(P_MENU, strdup("Linux Kernel Configuration"), NULL);
+};
+
 
 stmt_list:
 	  /* empty */
@@ -351,13 +371,6 @@ if_block:
 	| if_block choice_stmt
 ;
 
-/* mainmenu entry */
-
-mainmenu_stmt: T_MAINMENU prompt nl
-{
-	menu_add_prompt(P_MENU, $2, NULL);
-};
-
 /* menu entry */
 
 menu: T_MENU prompt T_EOL
@@ -502,6 +515,7 @@ word_opt: /* empty */			{ $$ = NULL; }
 
 void conf_parse(const char *name)
 {
+	const char *tmp;
 	struct symbol *sym;
 	int i;
 
@@ -509,7 +523,6 @@ void conf_parse(const char *name)
 
 	sym_init();
 	_menu_init();
-	rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
 
 	if (getenv("ZCONF_DEBUG"))
 		zconfdebug = 1;
@@ -519,8 +532,10 @@ void conf_parse(const char *name)
 	if (!modules_sym)
 		modules_sym = sym_find( "n" );
 
+	tmp = rootmenu.prompt->text;
 	rootmenu.prompt->text = _(rootmenu.prompt->text);
 	rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
+	free((char*)tmp);
 
 	menu_finalize(&rootmenu);
 	for_all_symbols(i, sym) {
Signature · 1 line
2.15.1
#162 lore raw

PATCH 47/161 kconfig: Fix automatic menu creation mem leak

In reply to Sasha Levin

From: Ulf Magnusson <[email protected]>

[ Upstream commit ae7440ef0c8013d68c00dad6900e7cce5311bb1c ]

expr_trans_compare() always allocates and returns a new expression, giving the following leak outline:

	...
	*Allocate*
	basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no);
	...
	for (menu = parent->next; menu; menu = menu->next) {
		...
		*Copy*
		dep2 = expr_copy(basedep);
		...
		*Free copy*
		expr_free(dep2);
	}
	*basedep lost!*

Fix by freeing 'basedep' after the loop.

Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:

	LEAK SUMMARY:
	   definitely lost: 344,376 bytes in 14,349 blocks
	   ...

Summary after the fix:

	LEAK SUMMARY:
	   definitely lost: 44,448 bytes in 1,852 blocks
	   ...
---
 scripts/kconfig/menu.c | 1 +
 1 file changed, 1 insertion(+)
scripts/kconfig/menu.c +1 -0
index e9357931b47d..749c2bd5fc51 100644
@@ -372,6 +372,7 @@ void menu_finalize(struct menu *parent)
 			menu->parent = parent;
 			last_menu = menu;
 		}
+		expr_free(basedep);
 		if (last_menu) {
 			parent->list = parent->next;
 			parent->next = last_menu->next;
Signature · 1 line
2.15.1
#163 lore raw

PATCH 48/161 kconfig: Fix expr_free() E_NOT leak

In reply to Sasha Levin

From: Ulf Magnusson <[email protected]>

[ Upstream commit 5b1374b3b3c2fc4f63a398adfa446fb8eff791a4 ]

Only the E_NOT operand and not the E_NOT node itself was freed, due to accidentally returning too early in expr_free(). Outline of leak:

	switch (e->type) {
	...
	case E_NOT:
		expr_free(e->left.expr);
		return;
	...
	}
	*Never reached, 'e' leaked*
	free(e);

Fix by changing the 'return' to a 'break'.

Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:

	LEAK SUMMARY:
	   definitely lost: 44,448 bytes in 1,852 blocks
	   ...

Summary after the fix:

	LEAK SUMMARY:
	   definitely lost: 1,608 bytes in 67 blocks
	   ...
---
 scripts/kconfig/expr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/expr.c +1 -1
index cbf4996dd9c1..ed29bad1f03a 100644
@@ -113,7 +113,7 @@ void expr_free(struct expr *e)
 		break;
 	case E_NOT:
 		expr_free(e->left.expr);
-		return;
+		break;
 	case E_EQUAL:
 	case E_GEQ:
 	case E_GTH:
Signature · 1 line
2.15.1
#164 lore raw

PATCH 49/161 mac80211_hwsim: fix possible memory leak in hwsim_new_radio_nl()

In reply to Sasha Levin

From: "weiyongjun (A)" <[email protected]>

[ Upstream commit 0ddcff49b672239dda94d70d0fcf50317a9f4b51 ]

'hwname' is malloced in hwsim_new_radio_nl() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak.

Fixes ff4dd73dd2b4 ("mac80211_hwsim: check HWSIM_ATTR_RADIO_NAME length")
---
 drivers/net/wireless/mac80211_hwsim.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mac80211_hwsim.c +3 -1
index d148dbf3beeb..977fd7aa2082 100644
@@ -3153,8 +3153,10 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
 	if (info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]) {
 		u32 idx = nla_get_u32(info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]);
 
-		if (idx >= ARRAY_SIZE(hwsim_world_regdom_custom))
+		if (idx >= ARRAY_SIZE(hwsim_world_regdom_custom)) {
+			kfree(hwname);
 			return -EINVAL;
+		}
 		param.regd = hwsim_world_regdom_custom[idx];
 	}
 
Signature · 1 line
2.15.1
#165 lore raw

PATCH 50/161 ipmi/powernv: Fix error return code in ipmi_powernv_probe()

In reply to Sasha Levin

From: Wei Yongjun <[email protected]>

[ Upstream commit e749d328b0b450aa78d562fa26a0cd8872325dd9 ]

Fix to return a negative error code from the request_irq() error handling case instead of 0, as done elsewhere in this function.

Fixes dce143c3381c ("ipmi/powernv: Convert to irq event interface")
---
 drivers/char/ipmi/ipmi_powernv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_powernv.c +3 -2
index b338a4becbf8..845efa0f724f 100644
@@ -251,8 +251,9 @@ static int ipmi_powernv_probe(struct platform_device *pdev)
 		ipmi->irq = opal_event_request(prop);
 	}
 
-	if (request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH,
-				"opal-ipmi", ipmi)) {
+	rc = request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH,
+			 "opal-ipmi", ipmi);
+	if (rc) {
 		dev_warn(dev, "Unable to request irq\n");
 		goto err_dispose;
 	}
Signature · 1 line
2.15.1
#166 lore raw

PATCH 51/161 Btrfs: set plug for fsync

In reply to Sasha Levin

From: Liu Bo <[email protected]>

[ Upstream commit 343e4fc1c60971b0734de26dbbd475d433950982 ]

Setting plug can merge adjacent IOs before dispatching IOs to the disk driver.

Without plug, it'd not be a problem for single disk usecases, but for multiple disks using raid profile, a large IO can be split to several IOs of stripe length, and plug can be helpful to bring them together for each disk so that we can save several disk access.

Moreover, fsync issues synchronous writes, so plug can really take effect.

---
 fs/btrfs/file.c | 9 +++++++++
 1 file changed, 9 insertions(+)
fs/btrfs/file.c +9 -0
index d564a7049d7f..5690feded0de 100644
@@ -2018,10 +2018,19 @@ int btrfs_release_file(struct inode *inode, struct file *filp)
 static int start_ordered_ops(struct inode *inode, loff_t start, loff_t end)
 {
 	int ret;
+	struct blk_plug plug;
 
+	/*
+	 * This is only called in fsync, which would do synchronous writes, so
+	 * a plug can merge adjacent IOs as much as possible.  Esp. in case of
+	 * multiple disks using raid profile, a large IO can be split to
+	 * several segments of stripe length (currently 64K).
+	 */
+	blk_start_plug(&plug);
 	atomic_inc(&BTRFS_I(inode)->sync_writers);
 	ret = btrfs_fdatawrite_range(inode, start, end);
 	atomic_dec(&BTRFS_I(inode)->sync_writers);
+	blk_finish_plug(&plug);
 
 	return ret;
 }
Signature · 1 line
2.15.1
#167 lore raw

PATCH 52/161 btrfs: Fix out of bounds access in btrfs_search_slot

In reply to Sasha Levin

From: Nikolay Borisov <[email protected]>

[ Upstream commit 9ea2c7c9da13c9073e371c046cbbc45481ecb459 ]

When modifying a tree where the root is at BTRFS_MAX_LEVEL - 1 then the level variable is going to be 7 (this is the max height of the tree). On the other hand btrfs_cow_block is always called with "level + 1" as an index into the nodes and slots arrays. This leads to an out of bounds access. Admittdely this will be benign since an OOB access of the nodes array will likely read the 0th element from the slots array, which in this case is going to be 0 (since we start CoW at the top of the tree). The OOB access into the slots array in turn will read the 0th and 1st values of the locks array, which would both be 0 at the time. However, this benign behavior relies on the fact that the path being passed hasn't been initialised, if it has already been used to query a btree then it could potentially have populated the nodes/slots arrays.

Fix it by explicitly checking if we are at level 7 (the maximum allowed index in nodes/slots arrays) and explicitly call the CoW routine with NULL for parent's node/slot.

Fixes-coverity-id: 711515

---
 fs/btrfs/ctree.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
fs/btrfs/ctree.c +9 -3
index e2bb2a065741..21cc27509993 100644
@@ -2774,6 +2774,8 @@ again:
 		 * contention with the cow code
 		 */
 		if (cow) {
+			bool last_level = (level == (BTRFS_MAX_LEVEL - 1));
+
 			/*
 			 * if we don't really need to cow this block
 			 * then we don't want to set the path blocking,
@@ -2798,9 +2800,13 @@ again:
 			}
 
 			btrfs_set_path_blocking(p);
-			err = btrfs_cow_block(trans, root, b,
-					      p->nodes[level + 1],
-					      p->slots[level + 1], &b);
+			if (last_level)
+				err = btrfs_cow_block(trans, root, b, NULL, 0,
+						      &b);
+			else
+				err = btrfs_cow_block(trans, root, b,
+						      p->nodes[level + 1],
+						      p->slots[level + 1], &b);
 			if (err) {
 				ret = err;
 				goto done;
Signature · 1 line
2.15.1
#168 lore raw

PATCH 53/161 Btrfs: fix scrub to repair raid6 corruption

In reply to Sasha Levin

From: Liu Bo <[email protected]>

[ Upstream commit 762221f095e3932669093466aaf4b85ed9ad2ac1 ]

The raid6 corruption is that,
suppose that all disks can be read without problems and if the content that was read out doesn't match its checksum, currently for raid6 btrfs at most retries twice,

- the 1st retry is to rebuild with all other stripes, it'll eventually be a raid5 xor rebuild,
- if the 1st fails, the 2nd retry will deliberately fail parity p so that it will do raid6 style rebuild,

however, the chances are that another non-parity stripe content also has something corrupted, so that the above retries are not able to return correct content.

We've fixed normal reads to rebuild raid6 correctly with more retries in Patch "Btrfs: make raid6 rebuild retry more"[1], this is to fix scrub to do the exactly same rebuild process.

[1]: https://patchwork.kernel.org/patch/10091755/

---
 fs/btrfs/raid56.c  | 18 ++++++++++++++----
 fs/btrfs/volumes.c |  9 ++++++++-
 2 files changed, 22 insertions(+), 5 deletions(-)
fs/btrfs/raid56.c +14 -4
index 32b186c5694c..dcab41157899 100644
@@ -2159,11 +2159,21 @@ int raid56_parity_recover(struct btrfs_fs_info *fs_info, struct bio *bio,
 	}
 
 	/*
-	 * reconstruct from the q stripe if they are
-	 * asking for mirror 3
+	 * Loop retry:
+	 * for 'mirror == 2', reconstruct from all other stripes.
+	 * for 'mirror_num > 2', select a stripe to fail on every retry.
 	 */
-	if (mirror_num == 3)
-		rbio->failb = rbio->real_stripes - 2;
+	if (mirror_num > 2) {
+		/*
+		 * 'mirror == 3' is to fail the p stripe and
+		 * reconstruct from the q stripe.  'mirror > 3' is to
+		 * fail a data stripe and reconstruct from p+q stripe.
+		 */
+		rbio->failb = rbio->real_stripes - (mirror_num - 1);
+		ASSERT(rbio->failb > 0);
+		if (rbio->failb <= rbio->faila)
+			rbio->failb--;
+	}
 
 	ret = lock_stripe_add(rbio);
 
fs/btrfs/volumes.c +8 -1
index 71b3cd634436..5c72b9d2a885 100644
@@ -5101,7 +5101,14 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len)
 	else if (map->type & BTRFS_BLOCK_GROUP_RAID5)
 		ret = 2;
 	else if (map->type & BTRFS_BLOCK_GROUP_RAID6)
-		ret = 3;
+		/*
+		 * There could be two corrupted data stripes, we need
+		 * to loop retry in order to rebuild the correct data.
+		 * 
+		 * Fail a stripe at a time on every retry except the
+		 * stripe under reconstruction.
+		 */
+		ret = map->num_stripes;
 	else
 		ret = 1;
 	free_extent_map(em);
Signature · 1 line
2.15.1
#169 lore raw

PATCH 54/161 btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP

In reply to Sasha Levin

From: Anand Jain <[email protected]>

[ Upstream commit 6f794e3c5c8f8fdd3b5bb20d9ded894e685b5bbe ]

It appears from the original commit [1] that there isn't any design specific reason not to fail the mount instead of just warning. This patch will change it to fail.

[1]
commit 319e4d0661e5323c9f9945f0f8fb5905e5fe74c3
btrfs: Enhance super validation check

Fixes 319e4d0661e5323 ("btrfs: Enhance super validation check")
---
 fs/btrfs/disk-io.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/btrfs/disk-io.c +4 -2
index 167ce43cabe8..79f0f282a0ef 100644
@@ -4063,9 +4063,11 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info)
 		btrfs_err(fs_info, "no valid FS found");
 		ret = -EINVAL;
 	}
-	if (btrfs_super_flags(sb) & ~BTRFS_SUPER_FLAG_SUPP)
-		btrfs_warn(fs_info, "unrecognized super flag: %llu",
+	if (btrfs_super_flags(sb) & ~BTRFS_SUPER_FLAG_SUPP) {
+		btrfs_err(fs_info, "unrecognized or unsupported super flag: %llu",
 				btrfs_super_flags(sb) & ~BTRFS_SUPER_FLAG_SUPP);
+		ret = -EINVAL;
+	}
 	if (btrfs_super_root_level(sb) >= BTRFS_MAX_LEVEL) {
 		btrfs_err(fs_info, "tree_root level too big: %d >= %d",
 				btrfs_super_root_level(sb), BTRFS_MAX_LEVEL);
Signature · 1 line
2.15.1
#170 lore raw

PATCH 55/161 Btrfs: fix unexpected EEXIST from btrfs_get_extent

In reply to Sasha Levin

From: Liu Bo <[email protected]>

[ Upstream commit 18e83ac75bfe67009c4ddcdd581bba8eb16f4030 ]

This fixes a corner case that is caused by a race of dio write vs dio read/write.

Here is how the race could happen.

Suppose that no extent map has been loaded into memory yet. There is a file extent [0, 32K), two jobs are running concurrently against it, t1 is doing dio write to [8K, 32K) and t2 is doing dio read from [0, 4K) or [4K, 8K).

t1 goes ahead of t2 and splits em [0, 32K) to em [0K, 8K) and [8K 32K).

------------------------------------------------------

             t1                                t2
      btrfs_get_blocks_direct()         btrfs_get_blocks_direct()
       -> btrfs_get_extent()              -> btrfs_get_extent()
           -> lookup_extent_mapping()
           -> add_extent_mapping()            -> lookup_extent_mapping()
              # load [0, 32K)
       -> btrfs_new_extent_direct()
           -> btrfs_drop_extent_cache()
              # split [0, 32K) and
	      # drop [8K, 32K)
           -> add_extent_mapping()
              # add [8K, 32K)
                                              -> add_extent_mapping()
                                                 # handle -EEXIST when adding
                                                 # [0, 32K)

------------------------------------------------------
About how t2(dio read/write) runs into -EEXIST:

a) add_extent_mapping() gets -EEXIST for adding em [0, 32k),

b) search_extent_mapping() then returns [0, 8k) as the existing em, even though start == existing->start, em is [0, 32k) so that extent_map_end(em) > extent_map_end(existing), i.e. 32k > 8k,

c) then it goes thru merge_extent_mapping() which tries to add a [8k, 8k) (with a length 0) and returns -EEXIST as [8k, 32k) is already in tree,

d) so btrfs_get_extent() ends up returning -EEXIST to dio read/write, which is confusing applications.

Here I conclude all the possible situations,
1) start < existing->start

            +-----------+em+-----------+
+--prev---+ |     +-------------+      |
|         | |     |             |      |
+---------+ +     +---+existing++      ++
                +
                |
                +
             start

2) start == existing->start

      +------------em------------+
      |     +-------------+      |
      |     |             |      |
      +     +----existing-+      +
            |
            |
            +
         start

3) start > existing->start && start < (existing->start + existing->len)

      +------------em------------+
      |     +-------------+      |
      |     |             |      |
      +     +----existing-+      +
               |
               |
               +
             start

4) start >= (existing->start + existing->len)

+-----------+em+-----------+
|     +-------------+      | +--next---+
|     |             |      | |         |
+     +---+existing++      + +---------+
                      +
                      |
                      +
                   start

As we can see, it turns out that if start is within existing em (front inclusive), then the existing em should be returned as is, otherwise, we try our best to merge candidate em with sibling ems to form a larger em (in order to reduce the total number of em).

---
 fs/btrfs/inode.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
fs/btrfs/inode.c +3 -14
index 59a01a0844c9..bdff397fe9ea 100644
@@ -7234,19 +7234,12 @@ insert:
 		 * existing will always be non-NULL, since there must be
 		 * extent causing the -EEXIST.
 		 */
-		if (existing->start == em->start &&
-		    extent_map_end(existing) >= extent_map_end(em) &&
-		    em->block_start == existing->block_start) {
-			/*
-			 * The existing extent map already encompasses the
-			 * entire extent map we tried to add.
-			 */
+		if (start >= existing->start &&
+		    start < extent_map_end(existing)) {
 			free_extent_map(em);
 			em = existing;
 			err = 0;
-
-		} else if (start >= extent_map_end(existing) ||
-		    start <= existing->start) {
+		} else {
 			/*
 			 * The existing extent map is the one nearest to
 			 * the [start, start + len) range which overlaps
@@ -7258,10 +7251,6 @@ insert:
 				free_extent_map(em);
 				em = NULL;
 			}
-		} else {
-			free_extent_map(em);
-			em = existing;
-			err = 0;
 		}
 	}
 	write_unlock(&em_tree->lock);
Signature · 1 line
2.15.1
#171 lore raw

PATCH 56/161 Btrfs: raid56: fix race between merge_bio and rbio_orig_end_io

In reply to Sasha Levin

From: Liu Bo <[email protected]>

[ Upstream commit 7583d8d088ff2c323b1d4f15b191ca2c23d32558 ]

Before rbio_orig_end_io() goes to free rbio, rbio may get merged with more bios from other rbios and rbio->bio_list becomes non-empty, in that case, these newly merged bios don't end properly.

Once unlock_stripe() is done, rbio->bio_list will not be updated any more and we can call bio_endio() on all queued bios.

It should only happen in error-out cases, the normal path of recover and full stripe write have already set RBIO_RMW_LOCKED_BIT to disable merge before doing IO, so rbio_orig_end_io() called by them doesn't have the above issue.

---
 fs/btrfs/raid56.c | 37 +++++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 12 deletions(-)
fs/btrfs/raid56.c +25 -12
index dcab41157899..2e995e565633 100644
@@ -858,10 +858,17 @@ static void __free_raid_bio(struct btrfs_raid_bio *rbio)
 	kfree(rbio);
 }
 
-static void free_raid_bio(struct btrfs_raid_bio *rbio)
+static void rbio_endio_bio_list(struct bio *cur, blk_status_t err)
 {
-	unlock_stripe(rbio);
-	__free_raid_bio(rbio);
+	struct bio *next;
+
+	while (cur) {
+		next = cur->bi_next;
+		cur->bi_next = NULL;
+		cur->bi_status = err;
+		bio_endio(cur);
+		cur = next;
+	}
 }
 
 /*
@@ -871,20 +878,26 @@ static void free_raid_bio(struct btrfs_raid_bio *rbio)
 static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t err)
 {
 	struct bio *cur = bio_list_get(&rbio->bio_list);
-	struct bio *next;
+	struct bio *extra;
 
 	if (rbio->generic_bio_cnt)
 		btrfs_bio_counter_sub(rbio->fs_info, rbio->generic_bio_cnt);
 
-	free_raid_bio(rbio);
+	/*
+	 * At this moment, rbio->bio_list is empty, however since rbio does not
+	 * always have RBIO_RMW_LOCKED_BIT set and rbio is still linked on the
+	 * hash list, rbio may be merged with others so that rbio->bio_list
+	 * becomes non-empty.
+	 * Once unlock_stripe() is done, rbio->bio_list will not be updated any
+	 * more and we can call bio_endio() on all queued bios.
+	 */
+	unlock_stripe(rbio);
+	extra = bio_list_get(&rbio->bio_list);
+	__free_raid_bio(rbio);
 
-	while (cur) {
-		next = cur->bi_next;
-		cur->bi_next = NULL;
-		cur->bi_status = err;
-		bio_endio(cur);
-		cur = next;
-	}
+	rbio_endio_bio_list(cur, err);
+	if (extra)
+		rbio_endio_bio_list(extra, err);
 }
 
 /*
Signature · 1 line
2.15.1
#172 lore raw

PATCH 57/161 RDMA/cma: Check existence of netdevice during port validation

In reply to Sasha Levin

From: Parav Pandit <[email protected]>

[ Upstream commit 00db63c128dd3daf38f481371976c24d32678142 ]

If valid netdevice is not found for RoCE, GID table should not be searched with NULL netdevice.

Doing so causes the search routines to ignore the netdev argument and may match the wrong GID table entry if the netdev is deleted.

Fixes abae1b71dd37 ("IB/cma: cma_validate_port should verify the port and netdevice")
---
 drivers/infiniband/core/cma.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/infiniband/core/cma.c +5 -3
index 6cae00ecc905..2cd9671366b0 100644
@@ -624,11 +624,13 @@ static inline int cma_validate_port(struct ib_device *device, u8 port,
 	if ((dev_type != ARPHRD_INFINIBAND) && rdma_protocol_ib(device, port))
 		return ret;
 
-	if (dev_type == ARPHRD_ETHER && rdma_protocol_roce(device, port))
+	if (dev_type == ARPHRD_ETHER && rdma_protocol_roce(device, port)) {
 		ndev = dev_get_by_index(&init_net, bound_if_index);
-	else
+		if (!ndev)
+			return ret;
+	} else {
 		gid_type = IB_GID_TYPE_IB;
-
+	}
 
 	ret = ib_find_cached_gid_by_port(device, gid, gid_type, port,
 					 ndev, NULL);
Signature · 1 line
2.15.1
#173 lore raw

PATCH 58/161 f2fs: avoid hungtask when GC encrypted block if io_bits is set

In reply to Sasha Levin

From: Sheng Yong <[email protected]>

[ Upstream commit a9d572c7550044d5b217b5287d99a2e6d34b97b0 ]

When io_bits is set, GCing encrypted block may hit the following hungtask. Since io_bits requires aligned block address, f2fs_submit_page_write may return -EAGAIN if new_blkaddr does not satisify io_bits alignment. As a result, the encrypted page will never be writtenback.

This patch makes move_data_block aware the EAGAIN error and cancel the writeback.

[  246.751371] INFO: task kworker/u4:4:797 blocked for more than 90 seconds.
[  246.752423]       Not tainted 4.15.0-rc4+ #11
[  246.754176] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  246.755336] kworker/u4:4    D25448   797      2 0x80000000
[  246.755597] Workqueue: writeback wb_workfn (flush-7:0)
[  246.755616] Call Trace:
[  246.755695]  ? __schedule+0x322/0xa90
[  246.755761]  ? blk_init_request_from_bio+0x120/0x120
[  246.755773]  ? pci_mmcfg_check_reserved+0xb0/0xb0
[  246.755801]  ? __radix_tree_create+0x19e/0x200
[  246.755813]  ? delete_node+0x136/0x370
[  246.755838]  schedule+0x43/0xc0
[  246.755904]  io_schedule+0x17/0x40
[  246.755939]  wait_on_page_bit_common+0x17b/0x240
[  246.755950]  ? wake_page_function+0xa0/0xa0
[  246.755961]  ? add_to_page_cache_lru+0x160/0x160
[  246.755972]  ? page_cache_tree_insert+0x170/0x170
[  246.755983]  ? __lru_cache_add+0x96/0xb0
[  246.756086]  __filemap_fdatawait_range+0x14f/0x1c0
[  246.756097]  ? wait_on_page_bit_common+0x240/0x240
[  246.756120]  ? __wake_up_locked_key_bookmark+0x20/0x20
[  246.756167]  ? wait_on_all_pages_writeback+0xc9/0x100
[  246.756179]  ? __remove_ino_entry+0x120/0x120
[  246.756192]  ? wait_woken+0x100/0x100
[  246.756204]  filemap_fdatawait_range+0x9/0x20
[  246.756216]  write_checkpoint+0x18a1/0x1f00
[  246.756254]  ? blk_get_request+0x10/0x10
[  246.756265]  ? cpumask_next_and+0x43/0x60
[  246.756279]  ? f2fs_sync_inode_meta+0x160/0x160
[  246.756289]  ? remove_element.isra.4+0xa0/0xa0
[  246.756300]  ? __put_compound_page+0x40/0x40
[  246.756310]  ? f2fs_sync_fs+0xec/0x1c0
[  246.756320]  ? f2fs_sync_fs+0x120/0x1c0
[  246.756329]  f2fs_sync_fs+0x120/0x1c0
[  246.756357]  ? trace_event_raw_event_f2fs__page+0x260/0x260
[  246.756393]  ? ata_build_rw_tf+0x173/0x410
[  246.756397]  f2fs_balance_fs_bg+0x198/0x390
[  246.756405]  ? drop_inmem_page+0x230/0x230
[  246.756415]  ? ahci_qc_prep+0x1bb/0x2e0
[  246.756418]  ? ahci_qc_issue+0x1df/0x290
[  246.756422]  ? __accumulate_pelt_segments+0x42/0xd0
[  246.756426]  ? f2fs_write_node_pages+0xd1/0x380
[  246.756429]  f2fs_write_node_pages+0xd1/0x380
[  246.756437]  ? sync_node_pages+0x8f0/0x8f0
[  246.756440]  ? update_curr+0x53/0x220
[  246.756444]  ? __accumulate_pelt_segments+0xa2/0xd0
[  246.756448]  ? __update_load_avg_se.isra.39+0x349/0x360
[  246.756452]  ? do_writepages+0x2a/0xa0
[  246.756456]  do_writepages+0x2a/0xa0
[  246.756460]  __writeback_single_inode+0x70/0x490
[  246.756463]  ? check_preempt_wakeup+0x199/0x310
[  246.756467]  writeback_sb_inodes+0x2a2/0x660
[  246.756471]  ? is_empty_dir_inode+0x40/0x40
[  246.756474]  ? __writeback_single_inode+0x490/0x490
[  246.756477]  ? string+0xbf/0xf0
[  246.756480]  ? down_read_trylock+0x35/0x60
[  246.756484]  __writeback_inodes_wb+0x9f/0xf0
[  246.756488]  wb_writeback+0x41d/0x4b0
[  246.756492]  ? writeback_inodes_wb.constprop.55+0x150/0x150
[  246.756498]  ? set_worker_desc+0xf7/0x130
[  246.756502]  ? current_is_workqueue_rescuer+0x60/0x60
[  246.756511]  ? _find_next_bit+0x2c/0xa0
[  246.756514]  ? wb_workfn+0x400/0x5d0
[  246.756518]  wb_workfn+0x400/0x5d0
[  246.756521]  ? finish_task_switch+0xdf/0x2a0
[  246.756525]  ? inode_wait_for_writeback+0x30/0x30
[  246.756529]  process_one_work+0x3a7/0x6f0
[  246.756533]  worker_thread+0x82/0x750
[  246.756537]  kthread+0x16f/0x1c0
[  246.756541]  ? trace_event_raw_event_workqueue_work+0x110/0x110
[  246.756544]  ? kthread_create_worker_on_cpu+0xb0/0xb0
[  246.756548]  ret_from_fork+0x1f/0x30
---
 fs/f2fs/gc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +6 -1
index bfe6a8ccc3a0..7fb2729d8ee0 100644
@@ -695,7 +695,12 @@ static void move_data_block(struct inode *inode, block_t bidx,
 	fio.op = REQ_OP_WRITE;
 	fio.op_flags = REQ_SYNC;
 	fio.new_blkaddr = newaddr;
-	f2fs_submit_page_write(&fio);
+	err = f2fs_submit_page_write(&fio);
+	if (err) {
+		if (PageWriteback(fio.encrypted_page))
+			end_page_writeback(fio.encrypted_page);
+		goto put_page_out;
+	}
 
 	f2fs_update_iostat(fio.sbi, FS_GC_DATA_IO, F2FS_BLKSIZE);
 
Signature · 1 line
2.15.1
#174 lore raw

PATCH 59/161 scsi: devinfo: fix format of the device list

In reply to Sasha Levin

From: Xose Vazquez Perez <[email protected]>

[ Upstream commit 3f884a0a8bdf28cfd1e9987d54d83350096cdd46 ]

Replace "" with NULL for product revision level, and merge TEXEL duplicate entries.

Cc Hannes Reinecke <[email protected]>
Cc Martin K. Petersen <[email protected]>
Cc James E.J. Bottomley <[email protected]>
Cc SCSI ML <[email protected]>
---
 drivers/scsi/scsi_devinfo.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/scsi_devinfo.c +3 -4
index cfc095f45e26..ea947a7c2596 100644
@@ -109,8 +109,8 @@ static struct {
 	 * seagate controller, which causes SCSI code to reset bus.
 	 */
 	{"HP", "C1750A", "3226", BLIST_NOLUN},		/* scanjet iic */
-	{"HP", "C1790A", "", BLIST_NOLUN},		/* scanjet iip */
-	{"HP", "C2500A", "", BLIST_NOLUN},		/* scanjet iicx */
+	{"HP", "C1790A", NULL, BLIST_NOLUN},		/* scanjet iip */
+	{"HP", "C2500A", NULL, BLIST_NOLUN},		/* scanjet iicx */
 	{"MEDIAVIS", "CDR-H93MV", "1.31", BLIST_NOLUN},	/* locks up */
 	{"MICROTEK", "ScanMaker II", "5.61", BLIST_NOLUN},	/* responds to all lun */
 	{"MITSUMI", "CD-R CR-2201CS", "6119", BLIST_NOLUN},	/* locks up */
@@ -120,7 +120,7 @@ static struct {
 	{"QUANTUM", "FIREBALL ST4.3S", "0F0C", BLIST_NOLUN},	/* locks up */
 	{"RELISYS", "Scorpio", NULL, BLIST_NOLUN},	/* responds to all lun */
 	{"SANKYO", "CP525", "6.64", BLIST_NOLUN},	/* causes failed REQ SENSE, extra reset */
-	{"TEXEL", "CD-ROM", "1.06", BLIST_NOLUN},
+	{"TEXEL", "CD-ROM", "1.06", BLIST_NOLUN | BLIST_BORKEN},
 	{"transtec", "T5008", "0001", BLIST_NOREPORTLUN },
 	{"YAMAHA", "CDR100", "1.00", BLIST_NOLUN},	/* locks up */
 	{"YAMAHA", "CDR102", "1.00", BLIST_NOLUN},	/* locks up */
@@ -255,7 +255,6 @@ static struct {
 	{"ST650211", "CF", NULL, BLIST_RETRY_HWERROR},
 	{"SUN", "T300", "*", BLIST_SPARSELUN},
 	{"SUN", "T4", "*", BLIST_SPARSELUN},
-	{"TEXEL", "CD-ROM", "1.06", BLIST_BORKEN},
 	{"Tornado-", "F4", "*", BLIST_NOREPORTLUN},
 	{"TOSHIBA", "CDROM", NULL, BLIST_ISROM},
 	{"TOSHIBA", "CD-ROM", NULL, BLIST_ISROM},
Signature · 1 line
2.15.1
#175 lore raw

PATCH 60/161 scsi: fas216: fix sense buffer initialization

In reply to Sasha Levin

From: Arnd Bergmann <[email protected]>

[ Upstream commit 96d5eaa9bb74d299508d811d865c2c41b38b0301 ]

While testing with the ARM specific memset() macro removed, I ran into a compiler warning that shows an old bug:

drivers/scsi/arm/fas216.c: In function 'fas216_rq_sns_done':
drivers/scsi/arm/fas216.c:2014:40: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess]

It turns out that the definition of the scsi_cmd structure changed back in linux-2.6.25, so now we clear only four bytes (sizeof(pointer)) instead of 96 (SCSI_SENSE_BUFFERSIZE). I did not check whether we actually need to initialize the buffer here, but it's clear that if we do it, we should use the correct size.

Fixes de25deb18016 ("[SCSI] use dynamically allocated sense buffer")
---
 drivers/scsi/arm/fas216.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/arm/fas216.c +1 -1
index 24388795ee9a..936e8c735656 100644
@@ -2011,7 +2011,7 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt,
 		 * have valid data in the sense buffer that could
 		 * confuse the higher levels.
 		 */
-		memset(SCpnt->sense_buffer, 0, sizeof(SCpnt->sense_buffer));
+		memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
 //printk("scsi%d.%c: sense buffer: ", info->host->host_no, '0' + SCpnt->device->id);
 //{ int i; for (i = 0; i < 32; i++) printk("%02x ", SCpnt->sense_buffer[i]); printk("\n"); }
 	/*
Signature · 1 line
2.15.1
#176 lore raw

PATCH 61/161 Input: stmfts - set IRQ_NOAUTOEN to the irq flag

In reply to Sasha Levin

From: Andi Shyti <[email protected]>

[ Upstream commit cba04cdf437d745fac85220d1d692a9ae23d7004 ]

The interrupt is requested before the device is powered on and it's value in some cases cannot be reliable. It happens on some devices that an interrupt is generated as soon as requested before having the chance to disable the irq.

Set the irq flag as IRQ_NOAUTOEN before requesting it.

This patch mutes the error:

stmfts 2-0049: failed to read events: -11

received sometimes during boot time.

---
 drivers/input/touchscreen/stmfts.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/input/touchscreen/stmfts.c +8 -3
index 8c6c6178ec12..025bae3853cc 100644
@@ -687,6 +687,14 @@ static int stmfts_probe(struct i2c_client *client,
 
 	input_set_drvdata(sdata->input, sdata);
 
+	/*
+	 * stmfts_power_on expects interrupt to be disabled, but
+	 * at this point the device is still off and I do not trust
+	 * the status of the irq line that can generate some spurious
+	 * interrupts. To be on the safe side it's better to not enable
+	 * the interrupts during their request.
+	 */
+	irq_set_status_flags(client->irq, IRQ_NOAUTOEN);
 	err = devm_request_threaded_irq(&client->dev, client->irq,
 					NULL, stmfts_irq_handler,
 					IRQF_ONESHOT,
@@ -694,9 +702,6 @@ static int stmfts_probe(struct i2c_client *client,
 	if (err)
 		return err;
 
-	/* stmfts_power_on expects interrupt to be disabled */
-	disable_irq(client->irq);
-
 	dev_dbg(&client->dev, "initializing ST-Microelectronics FTS...\n");
 
 	err = stmfts_power_on(sdata);
Signature · 1 line
2.15.1
#177 lore raw

PATCH 62/161 HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()

In reply to Sasha Levin

From: Dan Carpenter <[email protected]>

[ Upstream commit 7ad81482cad67cbe1ec808490d1ddfc420c42008 ]

We get the "new_profile_index" value from the mouse device when we're handling raw events. Smatch taints it as untrusted data and complains that we need a bounds check. This seems like a reasonable warning otherwise there is a small read beyond the end of the array.

Fixes 0e70f97f257e ("HID: roccat: Add support for Kova[+] mouse")
---
 drivers/hid/hid-roccat-kovaplus.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/hid/hid-roccat-kovaplus.c +2 -0
index 43617fb28b87..317c9c2c0a7c 100644
@@ -37,6 +37,8 @@ static uint kovaplus_convert_event_cpi(uint value)
 static void kovaplus_profile_activated(struct kovaplus_device *kovaplus,
 		uint new_profile_index)
 {
+	if (new_profile_index >= ARRAY_SIZE(kovaplus->profile_settings))
+		return;
 	kovaplus->actual_profile = new_profile_index;
 	kovaplus->actual_cpi = kovaplus->profile_settings[new_profile_index].cpi_startup_level;
 	kovaplus->actual_x_sensitivity = kovaplus->profile_settings[new_profile_index].sensitivity_x;
Signature · 1 line
2.15.1
#178 lore raw

PATCH 63/161 nfp: fix error return code in nfp_pci_probe()

In reply to Sasha Levin

From: Wei Yongjun <[email protected]>

[ Upstream commit e58decc9c51eb61697aba35ba8eda33f4b80552d ]

Fix to return error code -EINVAL instead of 0 when num_vfs above limit_vfs, as done elsewhere in this function.

Fixes 0dc786219186 ("nfp: handle SR-IOV already enabled when driver is probing")
---
 drivers/net/ethernet/netronome/nfp/nfp_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/netronome/nfp/nfp_main.c +1 -0
index f8fa63b66739..a1a15e0c2245 100644
@@ -492,6 +492,7 @@ static int nfp_pci_probe(struct pci_dev *pdev,
 		dev_err(&pdev->dev,
 			"Error: %d VFs already enabled, but loaded FW can only support %d\n",
 			pf->num_vfs, pf->limit_vfs);
+		err = -EINVAL;
 		goto err_fw_unload;
 	}
 
Signature · 1 line
2.15.1
#179 lore raw

PATCH 64/161 block: Set BIO_TRACE_COMPLETION on new bio during split

In reply to Sasha Levin

From: Goldwyn Rodrigues <[email protected]>

[ Upstream commit 20d59023c5ec4426284af492808bcea1f39787ef ]

We inadvertently set it again on the source bio, but we need to set it on the new split bio instead.

Fixes fbbaf700e7b1 ("block: trace completion of all bios.")
---
 block/bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/bio.c +1 -1
index 7f978eac9a7a..6efb23370956 100644
@@ -1893,7 +1893,7 @@ struct bio *bio_split(struct bio *bio, int sectors,
 	bio_advance(bio, split->bi_iter.bi_size);
 
 	if (bio_flagged(bio, BIO_TRACE_COMPLETION))
-		bio_set_flag(bio, BIO_TRACE_COMPLETION);
+		bio_set_flag(split, BIO_TRACE_COMPLETION);
 
 	return split;
 }
Signature · 1 line
2.15.1
#180 lore raw

PATCH 65/161 bpf: test_maps: cleanup sockmaps when test ends

In reply to Sasha Levin

From: Prashant Bhole <[email protected]>

[ Upstream commit 783687810e986a15ffbf86c516a1a48ff37f38f7 ]

Bug: BPF programs and maps related to sockmaps test exist in memory even after test_maps ends.

This patch fixes it as a short term workaround (sockmap kernel side needs real fixing) by empyting sockmaps when test ends.

Fixes 6f6d33f3b3d0f ("bpf: selftests add sockmap tests")
[ daniel: Note on workaround. ]
---
 tools/testing/selftests/bpf/test_maps.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/test_maps.c +12 -4
index 50ce52d2013d..8b9470b5af6d 100644
@@ -463,7 +463,7 @@ static void test_devmap(int task, void *data)
 #define SOCKMAP_VERDICT_PROG "./sockmap_verdict_prog.o"
 static void test_sockmap(int tasks, void *data)
 {
-	int one = 1, map_fd_rx, map_fd_tx, map_fd_break, s, sc, rc;
+	int one = 1, map_fd_rx = 0, map_fd_tx = 0, map_fd_break, s, sc, rc;
 	struct bpf_map *bpf_map_rx, *bpf_map_tx, *bpf_map_break;
 	int ports[] = {50200, 50201, 50202, 50204};
 	int err, i, fd, udp, sfd[6] = {0xdeadbeef};
@@ -868,9 +868,12 @@ static void test_sockmap(int tasks, void *data)
 		goto out_sockmap;
 	}
 
-	/* Test map close sockets */
-	for (i = 0; i < 6; i++)
+	/* Test map close sockets and empty maps */
+	for (i = 0; i < 6; i++) {
+		bpf_map_delete_elem(map_fd_tx, &i);
+		bpf_map_delete_elem(map_fd_rx, &i);
 		close(sfd[i]);
+	}
 	close(fd);
 	close(map_fd_rx);
 	bpf_object__close(obj);
@@ -881,8 +884,13 @@ out:
 	printf("Failed to create sockmap '%i:%s'!\n", i, strerror(errno));
 	exit(1);
 out_sockmap:
-	for (i = 0; i < 6; i++)
+	for (i = 0; i < 6; i++) {
+		if (map_fd_tx)
+			bpf_map_delete_elem(map_fd_tx, &i);
+		if (map_fd_rx)
+			bpf_map_delete_elem(map_fd_rx, &i);
 		close(sfd[i]);
+	}
 	close(fd);
 	exit(1);
 }
Signature · 1 line
2.15.1
#181 lore raw

PATCH 66/161 i40evf: Don't schedule reset_task when device is being removed

In reply to Sasha Levin

From: Avinash Dayanand <[email protected]>

[ Upstream commit 06aa040f039404a0039a5158cd12f41187487a1f ]

When a host disables and enables a PF device, all the associated VFs are removed and added back in. It also generates a PFR which in turn resets all the connected VFs. This behaviour is different from that of Linux guest on Linux host. Hence we end up in a situation where there's a PFR and device removal at the same time. And watchdog doesn't have a clue about this and schedules a reset_task. This patch adds code to send signal to reset_task that the device is currently being removed.

---
 drivers/net/ethernet/intel/i40evf/i40evf.h      | 1 +
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +1 -0
index 82f69031e5cd..2ef32ab1dfae 100644
@@ -186,6 +186,7 @@ enum i40evf_state_t {
 enum i40evf_critical_section_t {
 	__I40EVF_IN_CRITICAL_TASK,	/* cannot be interrupted */
 	__I40EVF_IN_CLIENT_TASK,
+	__I40EVF_IN_REMOVE_TASK,	/* device being removed */
 };
 
 /* board specific private data structure */
drivers/net/ethernet/intel/i40evf/i40evf_main.c +8 -1
index 1ccad6f30ebf..048c92a1436a 100644
@@ -1834,6 +1834,12 @@ static void i40evf_reset_task(struct work_struct *work)
 	u32 reg_val;
 	int i = 0, err;
 
+	/* When device is being removed it doesn't make sense to run the reset
+	 * task, just return in such a case.
+	 */
+	if (test_bit(__I40EVF_IN_REMOVE_TASK, &adapter->crit_section))
+		return;
+
 	while (test_and_set_bit(__I40EVF_IN_CLIENT_TASK,
 				&adapter->crit_section))
 		usleep_range(500, 1000);
@@ -3008,7 +3014,8 @@ static void i40evf_remove(struct pci_dev *pdev)
 	struct i40evf_mac_filter *f, *ftmp;
 	struct i40e_hw *hw = &adapter->hw;
 	int err;
-
+	/* Indicate we are in remove and not to run reset_task */
+	set_bit(__I40EVF_IN_REMOVE_TASK, &adapter->crit_section);
 	cancel_delayed_work_sync(&adapter->init_task);
 	cancel_work_sync(&adapter->reset_task);
 	cancel_delayed_work_sync(&adapter->client_task);
Signature · 1 line
2.15.1
#182 lore raw

PATCH 67/161 i40evf: ignore link up if not running

In reply to Sasha Levin

From: Alan Brady <[email protected]>

[ Upstream commit e0346f9fcb6c636d2f870e6666de8781413f34ea ]

If we receive the link status message from PF with link up before queues are actually enabled, it will trigger a TX hang. This fixes the issue by ignoring a link up message if the VF state is not yet in RUNNING state.

---
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    | 35 ++++++++++++++--------
 1 file changed, 23 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +23 -12
index 85876f4fb1fb..46bf11afba08 100644
@@ -937,23 +937,34 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
 	if (v_opcode == VIRTCHNL_OP_EVENT) {
 		struct virtchnl_pf_event *vpe =
 			(struct virtchnl_pf_event *)msg;
+		bool link_up = vpe->event_data.link_event.link_status;
 		switch (vpe->event) {
 		case VIRTCHNL_EVENT_LINK_CHANGE:
 			adapter->link_speed =
 				vpe->event_data.link_event.link_speed;
-			if (adapter->link_up !=
-			    vpe->event_data.link_event.link_status) {
-				adapter->link_up =
-					vpe->event_data.link_event.link_status;
-				if (adapter->link_up) {
-					netif_tx_start_all_queues(netdev);
-					netif_carrier_on(netdev);
-				} else {
-					netif_tx_stop_all_queues(netdev);
-					netif_carrier_off(netdev);
-				}
-				i40evf_print_link_message(adapter);
+
+			/* we've already got the right link status, bail */
+			if (adapter->link_up == link_up)
+				break;
+
+			/* If we get link up message and start queues before
+			 * our queues are configured it will trigger a TX hang.
+			 * In that case, just ignore the link status message,
+			 * we'll get another one after we enable queues and
+			 * actually prepared to send traffic.
+			 */
+			if (link_up && adapter->state != __I40EVF_RUNNING)
+				break;
+
+			adapter->link_up = link_up;
+			if (link_up) {
+				netif_tx_start_all_queues(netdev);
+				netif_carrier_on(netdev);
+			} else {
+				netif_tx_stop_all_queues(netdev);
+				netif_carrier_off(netdev);
 			}
+			i40evf_print_link_message(adapter);
 			break;
 		case VIRTCHNL_EVENT_RESET_IMPENDING:
 			dev_info(&adapter->pdev->dev, "PF reset warning received\n");
Signature · 1 line
2.15.1
#183 lore raw

PATCH 68/161 platform/x86: thinkpad_acpi: suppress warning about palm detection

In reply to Sasha Levin

From: David Herrmann <[email protected]>

[ Upstream commit 587d8628fb71c3bfae29fb2bbe84c1478c59bac8 ]

This patch prevents the thinkpad_acpi driver from warning about 2 event codes returned for keyboard palm-detection. No behavioral changes, other than suppressing the warning in the kernel log. The events are still forwarded via acpi-netlink channels.

We could, optionally, decide to forward the event through a input-switch on the tpacpi input device. However, so far no suitable input-code exists, and no similar drivers report such events. Hence, leave it an acpi event for now.

Note that the event-codes are named based on empirical studies. On the ThinkPad X1 5th Gen the sensor can be found underneath the arrow key.

---
 drivers/platform/x86/thinkpad_acpi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/platform/x86/thinkpad_acpi.c +10 -0
index 2242d6035d9e..c407d52ef7cf 100644
@@ -214,6 +214,10 @@ enum tpacpi_hkey_event_t {
 	/* AC-related events */
 	TP_HKEY_EV_AC_CHANGED		= 0x6040, /* AC status changed */
 
+	/* Further user-interface events */
+	TP_HKEY_EV_PALM_DETECTED	= 0x60b0, /* palm hoveres keyboard */
+	TP_HKEY_EV_PALM_UNDETECTED	= 0x60b1, /* palm removed */
+
 	/* Misc */
 	TP_HKEY_EV_RFKILL_CHANGED	= 0x7000, /* rfkill switch changed */
 };
@@ -3973,6 +3977,12 @@ static bool hotkey_notify_6xxx(const u32 hkey,
 		*send_acpi_ev = false;
 		break;
 
+	case TP_HKEY_EV_PALM_DETECTED:
+	case TP_HKEY_EV_PALM_UNDETECTED:
+		/* palm detected hovering the keyboard, forward to user-space
+		 * via netlink for consumption */
+		return true;
+
 	default:
 		pr_warn("unknown possible thermal alarm or keyboard event received\n");
 		known = false;
Signature · 1 line
2.15.1
#184 lore raw

PATCH 69/161 KVM: s390: vsie: use READ_ONCE to access some SCB fields

In reply to Sasha Levin

From: David Hildenbrand <[email protected]>

[ Upstream commit b3ecd4aa8632a86428605ab73393d14779019d82 ]

Another VCPU might try to modify the SCB while we are creating the shadow SCB. In general this is no problem - unless the compiler decides to not load values once, but e.g. twice.

For us, this is only relevant when checking/working with such values. E.g. the prefix value, the mso, state of transactional execution and addresses of satellite blocks.

E.g. if we blindly forward values (e.g. general purpose registers or execution controls after masking), we don't care.

Leaving unpin_blocks() untouched for now, will handle it separately.

The worst thing right now that I can see would be a missed prefix un/remap (mso, prefix, tx) or using wrong guest addresses. Nothing critical, but let's try to avoid unpredictable behavior.

Message-Id: <[email protected]>

---
 arch/s390/kvm/vsie.c | 50 +++++++++++++++++++++++++++++++-------------------
 1 file changed, 31 insertions(+), 19 deletions(-)
arch/s390/kvm/vsie.c +31 -19
index b18b5652e5c5..a74204db759b 100644
@@ -31,7 +31,11 @@ struct vsie_page {
 	 * the same offset as that in struct sie_page!
 	 */
 	struct mcck_volatile_info mcck_info;    /* 0x0200 */
-	/* the pinned originial scb */
+	/*
+	 * The pinned original scb. Be aware that other VCPUs can modify
+	 * it while we read from it. Values that are used for conditions or
+	 * are reused conditionally, should be accessed via READ_ONCE.
+	 */
 	struct kvm_s390_sie_block *scb_o;	/* 0x0218 */
 	/* the shadow gmap in use by the vsie_page */
 	struct gmap *gmap;			/* 0x0220 */
@@ -143,12 +147,13 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 {
 	struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
 	struct kvm_s390_sie_block *scb_o = vsie_page->scb_o;
-	u32 crycb_addr = scb_o->crycbd & 0x7ffffff8U;
+	const uint32_t crycbd_o = READ_ONCE(scb_o->crycbd);
+	const u32 crycb_addr = crycbd_o & 0x7ffffff8U;
 	unsigned long *b1, *b2;
 	u8 ecb3_flags;
 
 	scb_s->crycbd = 0;
-	if (!(scb_o->crycbd & vcpu->arch.sie_block->crycbd & CRYCB_FORMAT1))
+	if (!(crycbd_o & vcpu->arch.sie_block->crycbd & CRYCB_FORMAT1))
 		return 0;
 	/* format-1 is supported with message-security-assist extension 3 */
 	if (!test_kvm_facility(vcpu->kvm, 76))
@@ -186,12 +191,15 @@ static void prepare_ibc(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 {
 	struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
 	struct kvm_s390_sie_block *scb_o = vsie_page->scb_o;
+	/* READ_ONCE does not work on bitfields - use a temporary variable */
+	const uint32_t __new_ibc = scb_o->ibc;
+	const uint32_t new_ibc = READ_ONCE(__new_ibc) & 0x0fffU;
 	__u64 min_ibc = (sclp.ibc >> 16) & 0x0fffU;
 
 	scb_s->ibc = 0;
 	/* ibc installed in g2 and requested for g3 */
-	if (vcpu->kvm->arch.model.ibc && (scb_o->ibc & 0x0fffU)) {
-		scb_s->ibc = scb_o->ibc & 0x0fffU;
+	if (vcpu->kvm->arch.model.ibc && new_ibc) {
+		scb_s->ibc = new_ibc;
 		/* takte care of the minimum ibc level of the machine */
 		if (scb_s->ibc < min_ibc)
 			scb_s->ibc = min_ibc;
@@ -256,6 +264,10 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 {
 	struct kvm_s390_sie_block *scb_o = vsie_page->scb_o;
 	struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
+	/* READ_ONCE does not work on bitfields - use a temporary variable */
+	const uint32_t __new_prefix = scb_o->prefix;
+	const uint32_t new_prefix = READ_ONCE(__new_prefix);
+	const bool wants_tx = READ_ONCE(scb_o->ecb) & ECB_TE;
 	bool had_tx = scb_s->ecb & ECB_TE;
 	unsigned long new_mso = 0;
 	int rc;
@@ -302,14 +314,14 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 	scb_s->icpua = scb_o->icpua;
 
 	if (!(atomic_read(&scb_s->cpuflags) & CPUSTAT_SM))
-		new_mso = scb_o->mso & 0xfffffffffff00000UL;
+		new_mso = READ_ONCE(scb_o->mso) & 0xfffffffffff00000UL;
 	/* if the hva of the prefix changes, we have to remap the prefix */
-	if (scb_s->mso != new_mso || scb_s->prefix != scb_o->prefix)
+	if (scb_s->mso != new_mso || scb_s->prefix != new_prefix)
 		prefix_unmapped(vsie_page);
 	 /* SIE will do mso/msl validity and exception checks for us */
 	scb_s->msl = scb_o->msl & 0xfffffffffff00000UL;
 	scb_s->mso = new_mso;
-	scb_s->prefix = scb_o->prefix;
+	scb_s->prefix = new_prefix;
 
 	/* We have to definetly flush the tlb if this scb never ran */
 	if (scb_s->ihcpu != 0xffffU)
@@ -321,11 +333,11 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 	if (test_kvm_cpu_feat(vcpu->kvm, KVM_S390_VM_CPU_FEAT_ESOP))
 		scb_s->ecb |= scb_o->ecb & ECB_HOSTPROTINT;
 	/* transactional execution */
-	if (test_kvm_facility(vcpu->kvm, 73)) {
+	if (test_kvm_facility(vcpu->kvm, 73) && wants_tx) {
 		/* remap the prefix is tx is toggled on */
-		if ((scb_o->ecb & ECB_TE) && !had_tx)
+		if (!had_tx)
 			prefix_unmapped(vsie_page);
-		scb_s->ecb |= scb_o->ecb & ECB_TE;
+		scb_s->ecb |= ECB_TE;
 	}
 	/* SIMD */
 	if (test_kvm_facility(vcpu->kvm, 129)) {
@@ -544,9 +556,9 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 	gpa_t gpa;
 	int rc = 0;
 
-	gpa = scb_o->scaol & ~0xfUL;
+	gpa = READ_ONCE(scb_o->scaol) & ~0xfUL;
 	if (test_kvm_cpu_feat(vcpu->kvm, KVM_S390_VM_CPU_FEAT_64BSCAO))
-		gpa |= (u64) scb_o->scaoh << 32;
+		gpa |= (u64) READ_ONCE(scb_o->scaoh) << 32;
 	if (gpa) {
 		if (!(gpa & ~0x1fffUL))
 			rc = set_validity_icpt(scb_s, 0x0038U);
@@ -566,7 +578,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 		scb_s->scaol = (u32)(u64)hpa;
 	}
 
-	gpa = scb_o->itdba & ~0xffUL;
+	gpa = READ_ONCE(scb_o->itdba) & ~0xffUL;
 	if (gpa && (scb_s->ecb & ECB_TE)) {
 		if (!(gpa & ~0x1fffU)) {
 			rc = set_validity_icpt(scb_s, 0x0080U);
@@ -581,7 +593,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 		scb_s->itdba = hpa;
 	}
 
-	gpa = scb_o->gvrd & ~0x1ffUL;
+	gpa = READ_ONCE(scb_o->gvrd) & ~0x1ffUL;
 	if (gpa && (scb_s->eca & ECA_VX) && !(scb_s->ecd & ECD_HOSTREGMGMT)) {
 		if (!(gpa & ~0x1fffUL)) {
 			rc = set_validity_icpt(scb_s, 0x1310U);
@@ -599,7 +611,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 		scb_s->gvrd = hpa;
 	}
 
-	gpa = scb_o->riccbd & ~0x3fUL;
+	gpa = READ_ONCE(scb_o->riccbd) & ~0x3fUL;
 	if (gpa && (scb_s->ecb3 & ECB3_RI)) {
 		if (!(gpa & ~0x1fffUL)) {
 			rc = set_validity_icpt(scb_s, 0x0043U);
@@ -617,8 +629,8 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 	if ((scb_s->ecb & ECB_GS) && !(scb_s->ecd & ECD_HOSTREGMGMT)) {
 		unsigned long sdnxc;
 
-		gpa = scb_o->sdnxo & ~0xfUL;
-		sdnxc = scb_o->sdnxo & 0xfUL;
+		gpa = READ_ONCE(scb_o->sdnxo) & ~0xfUL;
+		sdnxc = READ_ONCE(scb_o->sdnxo) & 0xfUL;
 		if (!gpa || !(gpa & ~0x1fffUL)) {
 			rc = set_validity_icpt(scb_s, 0x10b0U);
 			goto unpin;
@@ -785,7 +797,7 @@ static void retry_vsie_icpt(struct vsie_page *vsie_page)
 static int handle_stfle(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 {
 	struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
-	__u32 fac = vsie_page->scb_o->fac & 0x7ffffff8U;
+	__u32 fac = READ_ONCE(vsie_page->scb_o->fac) & 0x7ffffff8U;
 
 	if (fac && test_kvm_facility(vcpu->kvm, 7)) {
 		retry_vsie_icpt(vsie_page);
Signature · 1 line
2.15.1
#185 lore raw

PATCH 70/161 blk-mq-debugfs: don't allow write on attributes with seq_operations set

In reply to Sasha Levin

From: Eryu Guan <[email protected]>

[ Upstream commit 6b136a24b05c81a24e0b648a4bd938bcd0c4f69e ]

Attributes that only implement .seq_ops are read-only, any write to them should be rejected. But currently kernel would crash when writing to such debugfs entries, e.g.

chmod +w /sys/kernel/debug/block/<dev>/requeue_list echo 0 > /sys/kernel/debug/block/<dev>/requeue_list chmod -w /sys/kernel/debug/block/<dev>/requeue_list

Fix it by returning -EPERM in blk_mq_debugfs_write() when writing to such attributes.

---
 block/blk-mq-debugfs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
block/blk-mq-debugfs.c +5 -1
index de294d775acf..d95439154556 100644
@@ -704,7 +704,11 @@ static ssize_t blk_mq_debugfs_write(struct file *file, const char __user *buf,
 	const struct blk_mq_debugfs_attr *attr = m->private;
 	void *data = d_inode(file->f_path.dentry->d_parent)->i_private;
 
-	if (!attr->write)
+	/*
+	 * Attributes that only implement .seq_ops are read-only and 'attr' is
+	 * the same with 'data' in this case.
+	 */
+	if (attr == data || !attr->write)
 		return -EPERM;
 
 	return attr->write(data, buf, count, ppos);
Signature · 1 line
2.15.1
#186 lore raw

PATCH 71/161 ASoC: rockchip: Use dummy_dai for rt5514 dsp dailink

In reply to Sasha Levin

From: Jeffy Chen <[email protected]>

[ Upstream commit fde7f9dbc71365230eeb8c8ea97ce9b552c8e5bd ]

The rt5514 dsp captures pcm data through spi directly, so we should not use rockchip-i2s as it's cpu dai like other codecs.

Use dummy_dai for rt5514 dsp dailink to make voice wakeup work again.

Fixes (72cfb0f20c75 ASoC: rockchip: Use codec of_node and dai_name for rt5514 dsp)
---
 sound/soc/rockchip/rk3399_gru_sound.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
sound/soc/rockchip/rk3399_gru_sound.c +16 -3
index 0513fe480353..21ac8d6cce3a 100644
@@ -387,7 +387,8 @@ static const struct snd_soc_dai_link rockchip_dais[] = {
 	[DAILINK_RT5514_DSP] = {
 		.name = "RT5514 DSP",
 		.stream_name = "Wake on Voice",
-		.codec_dai_name = "rt5514-dsp-cpu-dai",
+		.codec_name = "snd-soc-dummy",
+		.codec_dai_name = "snd-soc-dummy-dai",
 	},
 };
 
@@ -432,7 +433,18 @@ static int rockchip_sound_of_parse_dais(struct device *dev,
 		if (index < 0)
 			continue;
 
-		np_cpu = (index == DAILINK_CDNDP) ? np_cpu1 : np_cpu0;
+		switch (index) {
+		case DAILINK_CDNDP:
+			np_cpu = np_cpu1;
+			break;
+		case DAILINK_RT5514_DSP:
+			np_cpu = np_codec;
+			break;
+		default:
+			np_cpu = np_cpu0;
+			break;
+		}
+
 		if (!np_cpu) {
 			dev_err(dev, "Missing 'rockchip,cpu' for %s\n",
 				rockchip_dais[index].name);
@@ -442,7 +454,8 @@ static int rockchip_sound_of_parse_dais(struct device *dev,
 		dai = &card->dai_link[card->num_links++];
 		*dai = rockchip_dais[index];
 
-		dai->codec_of_node = np_codec;
+		if (!dai->codec_name)
+			dai->codec_of_node = np_codec;
 		dai->platform_of_node = np_cpu;
 		dai->cpu_of_node = np_cpu;
 	}
Signature · 1 line
2.15.1
#187 lore raw

PATCH 72/161 igb: Allow to remove administratively set MAC on VFs

In reply to Sasha Levin

From: Corinna Vinschen <[email protected]>

[ Upstream commit 177132df5e45b134c147f419f567a3b56aafaf2b ]

Before libvirt modifies the MAC address and vlan tag for an SRIOV VF for use by a virtual machine (either using vfio device assignment or macvtap passthru mode), it saves the current MAC address and vlan tag so that it can reset them to their original value when the guest is done. Libvirt can't leave the VF MAC set to the value used by the now-defunct guest since it may be started again later using a different VF, but it certainly shouldn't just pick any random value, either. So it saves the state of everything prior to using the VF, and resets it to that.

The igb driver initializes the MAC addresses of all VFs to 00:00:00:00:00:00, and reports that when asked (via an RTM_GETLINK netlink message, also visible in the list of VFs in the output of "ip link show"). But when libvirt attempts to restore the MAC address back to 00:00:00:00:00:00 (using an RTM_SETLINK netlink message) the kernel responds with "Invalid argument".

Forbidding a reset back to the original value leaves the VF MAC at the value set for the now-defunct virtual machine. Especially on a system with NetworkManager enabled, this has very bad consequences, since NetworkManager forces all interfacess to be IFF_UP all the time - if the same virtual machine is restarted using a different VF (or even on a different host), there will be multiple interfaces watching for traffic with the same MAC address.

To allow libvirt to revert to the original state, we need a way to remove the administrative set MAC on a VF, to allow normal host operation again, and to reset/overwrite the VF MAC via VF netdev.

This patch implements the outlined scenario by allowing to set the VF MAC to 00:00:00:00:00:00 via RTM_SETLINK on the PF. igb_ndo_set_vf_mac resets the IGB_VF_FLAG_PF_SET_MAC flag to 0, so it's possible to reset the VF MAC back to the original value via the VF netdev.

Note: Recent patches to libvirt allow for a workaround if the NIC isn't capable of resetting the administrative MAC back to all 0, but in theory the NIC should allow resetting the MAC in the first place.

---
 drivers/net/ethernet/intel/igb/igb_main.c | 42 +++++++++++++++++++++++--------
 1 file changed, 31 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +31 -11
index d1a44a84c97e..6ca580cdfd84 100644
@@ -8373,7 +8373,8 @@ static void igb_rar_set_index(struct igb_adapter *adapter, u32 index)
 
 	/* Indicate to hardware the Address is Valid. */
 	if (adapter->mac_table[index].state & IGB_MAC_STATE_IN_USE) {
-		rar_high |= E1000_RAH_AV;
+		if (is_valid_ether_addr(addr))
+			rar_high |= E1000_RAH_AV;
 
 		if (hw->mac.type == e1000_82575)
 			rar_high |= E1000_RAH_POOL_1 *
@@ -8411,17 +8412,36 @@ static int igb_set_vf_mac(struct igb_adapter *adapter,
 static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
 {
 	struct igb_adapter *adapter = netdev_priv(netdev);
-	if (!is_valid_ether_addr(mac) || (vf >= adapter->vfs_allocated_count))
+
+	if (vf >= adapter->vfs_allocated_count)
+		return -EINVAL;
+
+	/* Setting the VF MAC to 0 reverts the IGB_VF_FLAG_PF_SET_MAC
+	 * flag and allows to overwrite the MAC via VF netdev.  This
+	 * is necessary to allow libvirt a way to restore the original
+	 * MAC after unbinding vfio-pci and reloading igbvf after shutting
+	 * down a VM.
+	 */
+	if (is_zero_ether_addr(mac)) {
+		adapter->vf_data[vf].flags &= ~IGB_VF_FLAG_PF_SET_MAC;
+		dev_info(&adapter->pdev->dev,
+			 "remove administratively set MAC on VF %d\n",
+			 vf);
+	} else if (is_valid_ether_addr(mac)) {
+		adapter->vf_data[vf].flags |= IGB_VF_FLAG_PF_SET_MAC;
+		dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n",
+			 mac, vf);
+		dev_info(&adapter->pdev->dev,
+			 "Reload the VF driver to make this change effective.");
+		/* Generate additional warning if PF is down */
+		if (test_bit(__IGB_DOWN, &adapter->state)) {
+			dev_warn(&adapter->pdev->dev,
+				 "The VF MAC address has been set, but the PF device is not up.\n");
+			dev_warn(&adapter->pdev->dev,
+				 "Bring the PF device up before attempting to use the VF device.\n");
+		}
+	} else {
 		return -EINVAL;
-	adapter->vf_data[vf].flags |= IGB_VF_FLAG_PF_SET_MAC;
-	dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n", mac, vf);
-	dev_info(&adapter->pdev->dev,
-		 "Reload the VF driver to make this change effective.");
-	if (test_bit(__IGB_DOWN, &adapter->state)) {
-		dev_warn(&adapter->pdev->dev,
-			 "The VF MAC address has been set, but the PF device is not up.\n");
-		dev_warn(&adapter->pdev->dev,
-			 "Bring the PF device up before attempting to use the VF device.\n");
 	}
 	return igb_set_vf_mac(adapter, vf, mac);
 }
Signature · 1 line
2.15.1
#188 lore raw

PATCH 73/161 igb: Clear TXSTMP when ptp_tx_work() is timeout

In reply to Sasha Levin

From: Daniel Hua <[email protected]>

[ Upstream commit 3a53285228165225a7f76c7d5ff1ddc0213ce0e4 ]

Problem description:
After ethernet cable connect and disconnect for several iterations on a device with i210, tx timestamp will stop being put into the socket.

Steps to reproduce:
1. Setup a device with i210 and wire it to a 802.1AS capable switch ( Extreme Networks Summit x440 is used in our case)
2. Have the gptp daemon running on the device and make sure it is synced with the switch
3. Have the switch disable and enable the port, wait for the device gets resynced with the switch
4. Iterates step 3 until the device is not albe to get resynced
5. Review the log in dmesg and you will see warning message "igb : clearing Tx timestamp hang"

Root cause:
If ptp_tx_work() gets scheduled just before the port gets disabled, a LINK DOWN event will be processed before ptp_tx_work(), which may cause timeout in ptp_tx_work(). In the timeout logic, the TSYNCTXCTL's TXTT bit (Transmit timestamp valid bit) is not cleared, causing no new timestamp loaded to TXSTMP register. Consequently therefore, no new interrupt is triggerred by TSICR.TXTS bit and no more Tx timestamp send to the socket.

---
 drivers/net/ethernet/intel/igb/igb_ptp.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/ethernet/intel/igb/igb_ptp.c +9 -0
index 841c2a083349..0746b19ec6d3 100644
@@ -643,6 +643,10 @@ static void igb_ptp_tx_work(struct work_struct *work)
 		adapter->ptp_tx_skb = NULL;
 		clear_bit_unlock(__IGB_PTP_TX_IN_PROGRESS, &adapter->state);
 		adapter->tx_hwtstamp_timeouts++;
+		/* Clear the tx valid bit in TSYNCTXCTL register to enable
+		 * interrupt
+		 */
+		rd32(E1000_TXSTMPH);
 		dev_warn(&adapter->pdev->dev, "clearing Tx timestamp hang\n");
 		return;
 	}
@@ -717,6 +721,7 @@ void igb_ptp_rx_hang(struct igb_adapter *adapter)
  */
 void igb_ptp_tx_hang(struct igb_adapter *adapter)
 {
+	struct e1000_hw *hw = &adapter->hw;
 	bool timeout = time_is_before_jiffies(adapter->ptp_tx_start +
 					      IGB_PTP_TX_TIMEOUT);
 
@@ -736,6 +741,10 @@ void igb_ptp_tx_hang(struct igb_adapter *adapter)
 		adapter->ptp_tx_skb = NULL;
 		clear_bit_unlock(__IGB_PTP_TX_IN_PROGRESS, &adapter->state);
 		adapter->tx_hwtstamp_timeouts++;
+		/* Clear the tx valid bit in TSYNCTXCTL register to enable
+		 * interrupt
+		 */
+		rd32(E1000_TXSTMPH);
 		dev_warn(&adapter->pdev->dev, "clearing Tx timestamp hang\n");
 	}
 }
Signature · 1 line
2.15.1
#189 lore raw

PATCH 74/161 fm10k: fix "failed to kill vid" message for VF

In reply to Sasha Levin

From: Ngai-Mint Kwan <[email protected]>

[ Upstream commit cf315ea596ec26d7aa542a9ce354990875a920c0 ]

When a VF is under PF VLAN assignment:

ip link set <pf> vf <#> vlan <vid>

This will remove all previous entries in the VLAN table including those generated by VLAN interfaces created on the VF. The issue arises when the VF is under PF VLAN assignment and one or more of these VLAN interfaces of the VF are deleted. When deleting these VLAN interfaces, the following message will be generated in "dmesg":

failed to kill vid 0081/<vid> for device <vf>

This is due to the fact that "ndo_vlan_rx_kill_vid" exits with an error. The handler for this ndo is "fm10k_update_vid". Any calls to this function while under PF VLAN management will exit prematurely and, thus, it will generate the failure message.

Additionally, since "fm10k_update_vid" exits prematurely, none of the VLAN update is performed. So, even though the actual VLAN interfaces of the VF will be deleted, the active_vlans bitmask is not cleared. When the VF is no longer under PF VLAN assignment, the driver mistakenly restores the previous entries of the VLAN table based on an unsynchronized list of active VLANs.

The solution to this issue involves checking the VLAN update action type before exiting "fm10k_update_vid". If the VLAN update action type is to "add", this action will not be permitted while the VF is under PF VLAN assignment and the VLAN update is abandoned like before.

However, if the VLAN update action type is to "kill", then we need to also clear the active_vlans bitmask. However, we don't need to actually queue any messages to the PF, because the MAC and VLAN tables have already been cleared, and the PF would silently ignore these requests anyways.

---
 drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +12 -2
index e69d49d91d67..914258310ddd 100644
@@ -815,8 +815,12 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)
 	if (vid >= VLAN_N_VID)
 		return -EINVAL;
 
-	/* Verify we have permission to add VLANs */
-	if (hw->mac.vlan_override)
+	/* Verify that we have permission to add VLANs. If this is a request
+	 * to remove a VLAN, we still want to allow the user to remove the
+	 * VLAN device. In that case, we need to clear the bit in the
+	 * active_vlans bitmask.
+	 */
+	if (set && hw->mac.vlan_override)
 		return -EACCES;
 
 	/* update active_vlans bitmask */
@@ -835,6 +839,12 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)
 			rx_ring->vid &= ~FM10K_VLAN_CLEAR;
 	}
 
+	/* If our VLAN has been overridden, there is no reason to send VLAN
+	 * removal requests as they will be silently ignored.
+	 */
+	if (hw->mac.vlan_override)
+		return 0;
+
 	/* Do not remove default VLAN ID related entries from VLAN and MAC
 	 * tables
 	 */
Signature · 1 line
2.15.1
#190 lore raw

PATCH 75/161 x86/hyperv: Stop suppressing X86_FEATURE_PCID

In reply to Sasha Levin

From: Vitaly Kuznetsov <[email protected]>

[ Upstream commit 617ab45c9a8900e64a78b43696c02598b8cad68b ]

When hypercall-based TLB flush was enabled for Hyper-V guests PCID feature was deliberately suppressed as a precaution: back then PCID was never exposed to Hyper-V guests and it wasn't clear what will happen if some day it becomes available. The day came and PCID/INVPCID features are already exposed on certain Hyper-V hosts.

Quoted 1 line

From TLFS (as of 5.0b) it is unclear how TLB flush hypercalls combine with

PCID. In particular the usage of PCID is per-cpu based: the same mm gets different CR3 values on different CPUs. If the hypercall does exact matching this will fail. However, this is not the case. David Zhang explains:

"In practice, the AddressSpace argument is ignored on any VM that supports
PCIDs.

Architecturally, the AddressSpace argument must match the CR3 with PCID bits stripped out (i.e., the low 12 bits of AddressSpace should be 0 in long mode). The flush hypercalls flush all PCIDs for the specified AddressSpace."

With this, PCID can be enabled.

Cc David Zhang <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Haiyang Zhang <[email protected]>
Cc "Michael Kelley (EOSG)" <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc "K. Y. Srinivasan" <[email protected]>
Cc Aditya Bhandari <[email protected]>
---
 arch/x86/hyperv/mmu.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
arch/x86/hyperv/mmu.c +10 -2
index 9cc9e1c1e2db..56c9ebac946f 100644
@@ -137,7 +137,12 @@ static void hyperv_flush_tlb_others(const struct cpumask *cpus,
 	}
 
 	if (info->mm) {
+		/*
+		 * AddressSpace argument must match the CR3 with PCID bits
+		 * stripped out.
+		 */
 		flush->address_space = virt_to_phys(info->mm->pgd);
+		flush->address_space &= CR3_ADDR_MASK;
 		flush->flags = 0;
 	} else {
 		flush->address_space = 0;
@@ -219,7 +224,12 @@ static void hyperv_flush_tlb_others_ex(const struct cpumask *cpus,
 	}
 
 	if (info->mm) {
+		/*
+		 * AddressSpace argument must match the CR3 with PCID bits
+		 * stripped out.
+		 */
 		flush->address_space = virt_to_phys(info->mm->pgd);
+		flush->address_space &= CR3_ADDR_MASK;
 		flush->flags = 0;
 	} else {
 		flush->address_space = 0;
@@ -278,8 +288,6 @@ void hyperv_setup_mmu_ops(void)
 	if (!(ms_hyperv.hints & HV_X64_REMOTE_TLB_FLUSH_RECOMMENDED))
 		return;
 
-	setup_clear_cpu_cap(X86_FEATURE_PCID);
-
 	if (!(ms_hyperv.hints & HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED)) {
 		pr_info("Using hypercall for remote TLB flush\n");
 		pv_mmu_ops.flush_tlb_others = hyperv_flush_tlb_others;
Signature · 5 lines
2.15.1
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
#191 lore raw

PATCH 76/161 tty: serial: exar: Relocate sleep wake-up handling

In reply to Sasha Levin

From: Aaron Sierra <[email protected]>

[ Upstream commit c7e1b4059075c9e8eed101d7cc5da43e95eb5e18 ]

Exar sleep wake-up handling has been done on a per-channel basis by virtue of INT0 being accessible from each channel's address space. I believe this was initially done out of necessity, but now that Exar devices have their own driver, we can do things more efficiently by registering a dedicated INT0 handler at the PCI device level.

I see this change providing the following benefits:

1. If more than one port is active, eliminates the redundant bus cycles for reading INT0 on every interrupt.
2. This note associated with hooking in the per-channel handler in 8250_port.c is resolved:
/* Fixme: probably not the best place for this */

---
 drivers/tty/serial/8250/8250_exar.c | 34 ++++++++++++++++++++++++++++++----
 drivers/tty/serial/8250/8250_port.c | 26 --------------------------
 2 files changed, 30 insertions(+), 30 deletions(-)
drivers/tty/serial/8250/8250_exar.c +30 -4
index c55624703fdf..e0aa5f03004c 100644
@@ -37,6 +37,7 @@
 #define PCI_DEVICE_ID_EXAR_XR17V4358		0x4358
 #define PCI_DEVICE_ID_EXAR_XR17V8358		0x8358
 
+#define UART_EXAR_INT0		0x80
 #define UART_EXAR_8XMODE	0x88	/* 8X sampling rate select */
 
 #define UART_EXAR_FCTR		0x08	/* Feature Control Register */
@@ -124,6 +125,7 @@ struct exar8250_board {
 struct exar8250 {
 	unsigned int		nr;
 	struct exar8250_board	*board;
+	void __iomem		*virt;
 	int			line[0];
 };
 
@@ -134,12 +136,9 @@ static int default_setup(struct exar8250 *priv, struct pci_dev *pcidev,
 	const struct exar8250_board *board = priv->board;
 	unsigned int bar = 0;
 
-	if (!pcim_iomap_table(pcidev)[bar] && !pcim_iomap(pcidev, bar, 0))
-		return -ENOMEM;
-
 	port->port.iotype = UPIO_MEM;
 	port->port.mapbase = pci_resource_start(pcidev, bar) + offset;
-	port->port.membase = pcim_iomap_table(pcidev)[bar] + offset;
+	port->port.membase = priv->virt + offset;
 	port->port.regshift = board->reg_shift;
 
 	return 0;
@@ -423,6 +422,25 @@ static void pci_xr17v35x_exit(struct pci_dev *pcidev)
 	port->port.private_data = NULL;
 }
 
+/*
+ * These Exar UARTs have an extra interrupt indicator that could fire for a
+ * few interrupts that are not presented/cleared through IIR.  One of which is
+ * a wakeup interrupt when coming out of sleep.  These interrupts are only
+ * cleared by reading global INT0 or INT1 registers as interrupts are
+ * associated with channel 0. The INT[3:0] registers _are_ accessible from each
+ * channel's address space, but for the sake of bus efficiency we register a
+ * dedicated handler at the PCI device level to handle them.
+ */
+static irqreturn_t exar_misc_handler(int irq, void *data)
+{
+	struct exar8250 *priv = data;
+
+	/* Clear all PCI interrupts by reading INT0. No effect on IIR */
+	ioread8(priv->virt + UART_EXAR_INT0);
+
+	return IRQ_HANDLED;
+}
+
 static int
 exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
 {
@@ -451,6 +469,9 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
 		return -ENOMEM;
 
 	priv->board = board;
+	priv->virt = pcim_iomap(pcidev, bar, 0);
+	if (!priv->virt)
+		return -ENOMEM;
 
 	pci_set_master(pcidev);
 
@@ -464,6 +485,11 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
 	uart.port.irq = pci_irq_vector(pcidev, 0);
 	uart.port.dev = &pcidev->dev;
 
+	rc = devm_request_irq(&pcidev->dev, uart.port.irq, exar_misc_handler,
+			 IRQF_SHARED, "exar_uart", priv);
+	if (rc)
+		return rc;
+
 	for (i = 0; i < nr_ports && i < maxnr; i++) {
 		rc = board->setup(priv, pcidev, &uart, i);
 		if (rc) {
drivers/tty/serial/8250/8250_port.c +0 -26
index 8dcfd4978a03..e9d4420869dd 100644
@@ -445,7 +445,6 @@ static void io_serial_out(struct uart_port *p, int offset, int value)
 }
 
 static int serial8250_default_handle_irq(struct uart_port *port);
-static int exar_handle_irq(struct uart_port *port);
 
 static void set_io_from_upio(struct uart_port *p)
 {
@@ -1890,26 +1889,6 @@ static int serial8250_default_handle_irq(struct uart_port *port)
 	return ret;
 }
 
-/*
- * These Exar UARTs have an extra interrupt indicator that could
- * fire for a few unimplemented interrupts.  One of which is a
- * wakeup event when coming out of sleep.  Put this here just
- * to be on the safe side that these interrupts don't go unhandled.
- */
-static int exar_handle_irq(struct uart_port *port)
-{
-	unsigned int iir = serial_port_in(port, UART_IIR);
-	int ret = 0;
-
-	if (((port->type == PORT_XR17V35X) || (port->type == PORT_XR17D15X)) &&
-	    serial_port_in(port, UART_EXAR_INT0) != 0)
-		ret = 1;
-
-	ret |= serial8250_handle_irq(port, iir);
-
-	return ret;
-}
-
 /*
  * Newer 16550 compatible parts such as the SC16C650 & Altera 16550 Soft IP
  * have a programmable TX threshold that triggers the THRE interrupt in
@@ -3074,11 +3053,6 @@ static void serial8250_config_port(struct uart_port *port, int flags)
 	if (port->type == PORT_UNKNOWN)
 		serial8250_release_std_resource(up);
 
-	/* Fixme: probably not the best place for this */
-	if ((port->type == PORT_XR17V35X) ||
-	   (port->type == PORT_XR17D15X))
-		port->handle_irq = exar_handle_irq;
-
 	register_dev_spec_attr_grp(up);
 	up->fcr = uart_config[up->port.type].fcr;
 }
Signature · 1 line
2.15.1
#192 lore raw

PATCH 77/161 device property: Define type of PROPERTY_ENRTY_*() macros

In reply to Sasha Levin

From: Andy Shevchenko <[email protected]>

[ Upstream commit c505cbd45f6e9c539d57dd171d95ec7e5e9f9cd0 ]

Some of the drivers may use the macro at runtime flow, like

struct property_entry p[10];
...
p[index++] = PROPERTY_ENTRY_U8("u8 property", u8_data);

In that case and absence of the data type compiler fails the build:

drivers/char/ipmi/ipmi_dmi.c:79:29: error: Expected ; at end of statement drivers/char/ipmi/ipmi_dmi.c:79:29: error: got {

---
 include/linux/property.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
include/linux/property.h +5 -5
index 6bebee13c5e0..89d94b349912 100644
@@ -206,7 +206,7 @@ struct property_entry {
  */
 
 #define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _val_)	\
-{								\
+(struct property_entry) {					\
 	.name = _name_,						\
 	.length = ARRAY_SIZE(_val_) * sizeof(_type_),		\
 	.is_array = true,					\
@@ -224,7 +224,7 @@ struct property_entry {
 	PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u64, _val_)
 
 #define PROPERTY_ENTRY_STRING_ARRAY(_name_, _val_)		\
-{								\
+(struct property_entry) {					\
 	.name = _name_,						\
 	.length = ARRAY_SIZE(_val_) * sizeof(const char *),	\
 	.is_array = true,					\
@@ -233,7 +233,7 @@ struct property_entry {
 }
 
 #define PROPERTY_ENTRY_INTEGER(_name_, _type_, _val_)	\
-{							\
+(struct property_entry) {				\
 	.name = _name_,					\
 	.length = sizeof(_type_),			\
 	.is_string = false,				\
@@ -250,7 +250,7 @@ struct property_entry {
 	PROPERTY_ENTRY_INTEGER(_name_, u64, _val_)
 
 #define PROPERTY_ENTRY_STRING(_name_, _val_)		\
-{							\
+(struct property_entry) {				\
 	.name = _name_,					\
 	.length = sizeof(_val_),			\
 	.is_string = true,				\
@@ -258,7 +258,7 @@ struct property_entry {
 }
 
 #define PROPERTY_ENTRY_BOOL(_name_)		\
-{						\
+(struct property_entry) {			\
 	.name = _name_,				\
 }
 
Signature · 1 line
2.15.1
#193 lore raw

PATCH 78/161 crypto: artpec6 - remove select on non-existing CRYPTO_SHA384

In reply to Sasha Levin

From: Corentin LABBE <[email protected]>

[ Upstream commit 980b4c95e78e4113cb7b9f430f121dab1c814b6c ]

Since CRYPTO_SHA384 does not exists, Kconfig should not select it. Anyway, all SHA384 stuff is in CRYPTO_SHA512 which is already selected.

Fixes a21eb94fc4d3i ("crypto: axis - add ARTPEC-6/7 crypto accelerator driver")
---
 drivers/crypto/Kconfig | 1 -
 1 file changed, 1 deletion(-)
drivers/crypto/Kconfig +0 -1
index fe33c199fc1a..143f8bc403b9 100644
@@ -721,7 +721,6 @@ config CRYPTO_DEV_ARTPEC6
 	select CRYPTO_HASH
 	select CRYPTO_SHA1
 	select CRYPTO_SHA256
-	select CRYPTO_SHA384
 	select CRYPTO_SHA512
 	help
 	  Enables the driver for the on-chip crypto accelerator
Signature · 1 line
2.15.1
#194 lore raw

PATCH 79/161 RDMA/uverbs: Use an unambiguous errno for method not supported

In reply to Sasha Levin

From: Jason Gunthorpe <[email protected]>

[ Upstream commit 3624a8f02568f08aef299d3b117f2226f621177d ]

Returning EOPNOTSUPP is problematic because it can also be returned by the method function, and we use it in quite a few places in drivers these days.

Instead, dedicate EPROTONOSUPPORT to indicate that the ioctl framework is enabled but the requested object and method are not supported by the kernel. No other case will return this code, and it lets userspace know to fall back to write().

grep says we do not use it today in drivers/infiniband subsystem.

---
 drivers/infiniband/core/uverbs_ioctl.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/infiniband/core/uverbs_ioctl.c +13 -6
index 5286ad57d903..8f2dc79ad4ec 100644
@@ -245,16 +245,13 @@ static long ib_uverbs_cmd_verbs(struct ib_device *ib_dev,
 	uintptr_t data[UVERBS_OPTIMIZE_USING_STACK_SZ / sizeof(uintptr_t)];
 #endif
 
-	if (hdr->reserved)
-		return -EINVAL;
-
 	object_spec = uverbs_get_object(ib_dev, hdr->object_id);
 	if (!object_spec)
-		return -EOPNOTSUPP;
+		return -EPROTONOSUPPORT;
 
 	method_spec = uverbs_get_method(object_spec, hdr->method_id);
 	if (!method_spec)
-		return -EOPNOTSUPP;
+		return -EPROTONOSUPPORT;
 
 	if ((method_spec->flags & UVERBS_ACTION_FLAG_CREATE_ROOT) ^ !file->ucontext)
 		return -EINVAL;
@@ -310,6 +307,16 @@ static long ib_uverbs_cmd_verbs(struct ib_device *ib_dev,
 
 	err = uverbs_handle_method(buf, ctx->uattrs, hdr->num_attrs, ib_dev,
 				   file, method_spec, ctx->uverbs_attr_bundle);
+
+	/*
+	 * EPROTONOSUPPORT is ONLY to be returned if the ioctl framework can
+	 * not invoke the method because the request is not supported.  No
+	 * other cases should return this code.
+	*/
+	if (unlikely(err == -EPROTONOSUPPORT)) {
+		WARN_ON_ONCE(err == -EPROTONOSUPPORT);
+		err = -EINVAL;
+	}
 out:
 #ifdef UVERBS_OPTIMIZE_USING_STACK_SZ
 	if (ctx_size > UVERBS_OPTIMIZE_USING_STACK_SZ)
@@ -348,7 +355,7 @@ long ib_uverbs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		}
 
 		if (hdr.reserved) {
-			err = -EOPNOTSUPP;
+			err = -EPROTONOSUPPORT;
 			goto out;
 		}
 
Signature · 1 line
2.15.1
#195 lore raw

PATCH 80/161 jffs2: Fix use-after-free bug in jffs2_iget()'s error handling path

In reply to Sasha Levin

From: Jake Daryll Obina <[email protected]>

[ Upstream commit 5bdd0c6f89fba430e18d636493398389dadc3b17 ]

If jffs2_iget() fails for a newly-allocated inode, jffs2_do_clear_inode() can get called twice in the error handling path, the first call in jffs2_iget() itself and the second through iget_failed(). This can result to a use-after-free error in the second jffs2_do_clear_inode() call, such as shown by the oops below wherein the second jffs2_do_clear_inode() call was trying to free node fragments that were already freed in the first jffs2_do_clear_inode() call.

[   78.178860] jffs2: error: (1904) jffs2_do_read_inode_internal: CRC failed for read_inode of inode 24 at physical location 0x1fc00c
[   78.178914] Unable to handle kernel paging request at virtual address 6b6b6b6b6b6b6b7b
[   78.185871] pgd = ffffffc03a567000
[   78.188794] [6b6b6b6b6b6b6b7b] *pgd=0000000000000000, *pud=0000000000000000
[   78.194968] Internal error: Oops: 96000004 [#1] PREEMPT SMP
...
[   78.513147] PC is at rb_first_postorder+0xc/0x28
[   78.516503] LR is at jffs2_kill_fragtree+0x28/0x90 [jffs2]
[   78.520672] pc : [<ffffff8008323d28>] lr : [<ffffff8000eb1cc8>] pstate: 60000105
[   78.526757] sp : ffffff800cea38f0
[   78.528753] x29: ffffff800cea38f0 x28: ffffffc01f3f8e80
[   78.532754] x27: 0000000000000000 x26: ffffff800cea3c70
[   78.536756] x25: 00000000dc67c8ae x24: ffffffc033d6945d
[   78.540759] x23: ffffffc036811740 x22: ffffff800891a5b8
[   78.544760] x21: 0000000000000000 x20: 0000000000000000
[   78.548762] x19: ffffffc037d48910 x18: ffffff800891a588
[   78.552764] x17: 0000000000000800 x16: 0000000000000c00
[   78.556766] x15: 0000000000000010 x14: 6f2065646f6e695f
[   78.560767] x13: 6461657220726f66 x12: 2064656c69616620
[   78.564769] x11: 435243203a6c616e x10: 7265746e695f6564
[   78.568771] x9 : 6f6e695f64616572 x8 : ffffffc037974038
[   78.572774] x7 : bbbbbbbbbbbbbbbb x6 : 0000000000000008
[   78.576775] x5 : 002f91d85bd44a2f x4 : 0000000000000000
[   78.580777] x3 : 0000000000000000 x2 : 000000403755e000
[   78.584779] x1 : 6b6b6b6b6b6b6b6b x0 : 6b6b6b6b6b6b6b6b
...
[   79.038551] [<ffffff8008323d28>] rb_first_postorder+0xc/0x28
[   79.042962] [<ffffff8000eb5578>] jffs2_do_clear_inode+0x88/0x100 [jffs2]
[   79.048395] [<ffffff8000eb9ddc>] jffs2_evict_inode+0x3c/0x48 [jffs2]
[   79.053443] [<ffffff8008201ca8>] evict+0xb0/0x168
[   79.056835] [<ffffff8008202650>] iput+0x1c0/0x200
[   79.060228] [<ffffff800820408c>] iget_failed+0x30/0x3c
[   79.064097] [<ffffff8000eba0c0>] jffs2_iget+0x2d8/0x360 [jffs2]
[   79.068740] [<ffffff8000eb0a60>] jffs2_lookup+0xe8/0x130 [jffs2]
[   79.073434] [<ffffff80081f1a28>] lookup_slow+0x118/0x190
[   79.077435] [<ffffff80081f4708>] walk_component+0xfc/0x28c
[   79.081610] [<ffffff80081f4dd0>] path_lookupat+0x84/0x108
[   79.085699] [<ffffff80081f5578>] filename_lookup+0x88/0x100
[   79.089960] [<ffffff80081f572c>] user_path_at_empty+0x58/0x6c
[   79.094396] [<ffffff80081ebe14>] vfs_statx+0xa4/0x114
[   79.098138] [<ffffff80081ec44c>] SyS_newfstatat+0x58/0x98
[   79.102227] [<ffffff800808354c>] __sys_trace_return+0x0/0x4
[   79.106489] Code: d65f03c0 f9400001 b40000e1 aa0103e0 (f9400821)

The jffs2_do_clear_inode() call in jffs2_iget() is unnecessary since iget_failed() will eventually call jffs2_do_clear_inode() if needed, so just remove it.

Fixes 5451f79f5f81 ("iget: stop JFFS2 from using iget() and read_inode()")
---
 fs/jffs2/fs.c | 1 -
 1 file changed, 1 deletion(-)
fs/jffs2/fs.c +0 -1
index e96c6b05e43e..3c96f4bdc549 100644
@@ -362,7 +362,6 @@ error_io:
 	ret = -EIO;
 error:
 	mutex_unlock(&f->sem);
-	jffs2_do_clear_inode(c, f);
 	iget_failed(inode);
 	return ERR_PTR(ret);
 }
Signature · 1 line
2.15.1
#196 lore raw

PATCH 81/161 ixgbe: don't set RXDCTL.RLPML for 82599

In reply to Sasha Levin

From: Emil Tantilov <[email protected]>

[ Upstream commit 2bafa8fac19a31ca72ae1a3e48df35f73661dbed ]

commit 2de6aa3a666e ("ixgbe: Add support for padding packet")

Uses RXDCTL.RLPML to limit the maximum frame size on Rx when using build_skb. Unfortunately that register does not work on 82599.

Added an explicit check to avoid setting this register on 82599 MAC.

Extended the comment related to the setting of RXDCTL.RLPML to better explain its purpose.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +6 -2
index 29f600fd6977..9e30cfeac04b 100644
@@ -3987,11 +3987,15 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter,
 		rxdctl &= ~0x3FFFFF;
 		rxdctl |=  0x080420;
 #if (PAGE_SIZE < 8192)
-	} else {
+	/* RXDCTL.RLPML does not work on 82599 */
+	} else if (hw->mac.type != ixgbe_mac_82599EB) {
 		rxdctl &= ~(IXGBE_RXDCTL_RLPMLMASK |
 			    IXGBE_RXDCTL_RLPML_EN);
 
-		/* Limit the maximum frame size so we don't overrun the skb */
+		/* Limit the maximum frame size so we don't overrun the skb.
+		 * This can happen in SRIOV mode when the MTU of the VF is
+		 * higher than the MTU of the PF.
+		 */
 		if (ring_uses_build_skb(ring) &&
 		    !test_bit(__IXGBE_RX_3K_BUFFER, &ring->state))
 			rxdctl |= IXGBE_MAX_2K_FRAME_BUILD_SKB |
Signature · 1 line
2.15.1
#197 lore raw

PATCH 82/161 i40e: program fragmented IPv4 filter input set

In reply to Sasha Levin

From: Jacob Keller <[email protected]>

[ Upstream commit 02b4016bfe43d2d5ed043be7ffa56cda6a4d1100 ]

When implementing support for IP_USER_FLOW filters, we correctly programmed a filter for both the non fragmented IPv4/Other filter, as well as the fragmented IPv4 filters. However, we did not properly program the input set for fragmented IPv4 PCTYPE. This meant that the filters would almost certainly not match, unless the user specified all of the flow types.

Add support to program the fragmented IPv4 filter input set. Since we always program these filters together, we'll assume that the two input sets must match, and will thus always program the input sets to the same value.

---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 10 ++++++++++
 drivers/net/ethernet/intel/i40e/i40e_main.c    |  3 +++
 2 files changed, 13 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +10 -0
index 05e89864f781..fc27ba5caa55 100644
@@ -3648,6 +3648,16 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,
 
 	i40e_write_fd_input_set(pf, index, new_mask);
 
+	/* IP_USER_FLOW filters match both IPv4/Other and IPv4/Fragmented
+	 * frames. If we're programming the input set for IPv4/Other, we also
+	 * need to program the IPv4/Fragmented input set. Since we don't have
+	 * separate support, we'll always assume and enforce that the two flow
+	 * types must have matching input sets.
+	 */
+	if (index == I40E_FILTER_PCTYPE_NONF_IPV4_OTHER)
+		i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_FRAG_IPV4,
+					new_mask);
+
 	/* Add the new offset and update table, if necessary */
 	if (new_flex_offset) {
 		err = i40e_add_flex_offset(&pf->l4_flex_pit_list, src_offset,
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -0
index b1cde1b051a4..d36b799116e4 100644
@@ -5828,6 +5828,9 @@ static void i40e_fdir_filter_exit(struct i40e_pf *pf)
 	/* Reprogram the default input set for Other/IPv4 */
 	i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_NONF_IPV4_OTHER,
 				I40E_L3_SRC_MASK | I40E_L3_DST_MASK);
+
+	i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_FRAG_IPV4,
+				I40E_L3_SRC_MASK | I40E_L3_DST_MASK);
 }
 
 /**
Signature · 1 line
2.15.1