This is a note to let you know that I've just added the patch titled

    mei: me: do not reset when less than expected data is received

to my char-misc git tree which can be found at
    git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From b1b94b5d387e3a1f034c308e22f9295828d7174a Mon Sep 17 00:00:00 2001
From: Tomas Winkler <tomas.wink...@intel.com>
Date: Mon, 3 Mar 2014 00:21:28 +0200
Subject: mei: me: do not reset when less than expected data is received

There is a race in ME hardware between data copy for host and interrupt
delivery. An interrupt can be delivered prior to whole data copied for the
host to read but rather then going trough the reset we just merely need to
wait for the next interrupt.

The bug is visible in read/write stress with multiple connections per client

This is a regression caused as a side effect of the commit:
commit 544f94601409653f07ae6e22d4a39e3a90dceead
mei: do not run reset flow from the interrupt thread

Signed-off-by: Tomas Winkler <tomas.wink...@intel.com>
Cc: stable <stable@vger.kernel.org> # 3.14
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/misc/mei/hw-me.c     | 9 +++++++++
 drivers/misc/mei/interrupt.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index 7e769c59a420..7145929cdb51 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -507,7 +507,16 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void 
*dev_id)
        while (slots > 0) {
                dev_dbg(&dev->pdev->dev, "slots to read = %08x\n", slots);
                rets = mei_irq_read_handler(dev, &complete_list, &slots);
+               /* There is a race between ME write and interrupt delivery:
+                * Not all data is always available immediately after the
+                * interrupt, so try to read again on the next interrupt.
+                */
+               if (rets == -ENODATA)
+                       break;
+
                if (rets && dev->dev_state != MEI_DEV_RESETTING) {
+                       dev_err(&dev->pdev->dev, "mei_irq_read_handler ret = 
%d.\n",
+                                               rets);
                        schedule_work(&dev->reset_work);
                        goto end;
                }
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index 2fbf0c0625ed..f38a32addad0 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -351,7 +351,7 @@ int mei_irq_read_handler(struct mei_device *dev,
                dev_err(&dev->pdev->dev, "less data available than 
length=%08x.\n",
                                *slots);
                /* we can't read the message */
-               ret = -EBADMSG;
+               ret = -ENODATA;
                goto end;
        }
 
-- 
1.9.0


--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to