lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20170224065449.14997-1-yinghai@kernel.org>
Date:   Thu, 23 Feb 2017 22:54:49 -0800
From:   Yinghai Lu <yinghai@...nel.org>
To:     Bjorn Helgaas <bhelgaas@...gle.com>
Cc:     Ashok Raj <ashok.raj@...el.com>,
        james puthukattukaran <james.puthukattukaran@...cle.com>,
        Yinghai Lu <yinghai.lu@...cle.com>, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org, Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH] PCI,pciehp: Skip not changed command write

Notice two systems with different cpu hve different print out when power on
slots:
First one:
 pciehp 0000:60:03.2:pcie004: pciehp_green_led_on: SLOTCTRL a8 write cmd 100
 pciehp 0000:60:03.2:pcie004: pciehp_set_attention_status: SLOTCTRL a8 write cmd c0
 pciehp 0000:60:03.2:pcie004: pending interrupts 0x0010 from Slot Status

Second one:
 pciehp 0000:73:00.0:pcie004: pciehp_green_led_on: SLOTCTRL a8 write cmd 100
 pciehp 0000:73:00.0:pcie004: pciehp_set_attention_status: SLOTCTRL a8 write cmd c0
 pciehp 0000:73:00.0:pcie004: pending interrupts 0x0010 from Slot Status
 pciehp 0000:73:00.0:pcie004: pending interrupts 0x0010 from Slot Status

Actually attention is not changed on both.

First one will not generate CC if write not change cmd.
Second one will generate CC even if write not change cmd.

To avoid those difference interrupts, check if we are trying to
write same cmd, if so skip writing.

Signed-off-by: Yinghai Lu <yinghai@...nel.org>
---
 drivers/pci/hotplug/pciehp_hpc.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
===================================================================
--- linux-2.6.orig/drivers/pci/hotplug/pciehp_hpc.c
+++ linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
@@ -186,7 +186,7 @@ static void pcie_do_write_cmd(struct con
 			      u16 mask, bool wait)
 {
 	struct pci_dev *pdev = ctrl_dev(ctrl);
-	u16 slot_ctrl;
+	u16 slot_ctrl, old_slot_ctrl;
 
 	mutex_lock(&ctrl->ctrl_lock);
 
@@ -201,8 +201,14 @@ static void pcie_do_write_cmd(struct con
 		goto out;
 	}
 
+	old_slot_ctrl = slot_ctrl;
 	slot_ctrl &= ~mask;
 	slot_ctrl |= (cmd & mask);
+	if (slot_ctrl == old_slot_ctrl) {
+		ctrl_dbg(ctrl, "%s: mask/cmd %x/%x no change\n", __func__,
+			 mask, cmd & mask);
+		goto out;
+	}
 	ctrl->cmd_busy = 1;
 	smp_mb();
 	pcie_capability_write_word(pdev, PCI_EXP_SLTCTL, slot_ctrl);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ