The following changes since commit be9c6bad9b46451ba5bb8d366c51e2475f374981:
vdpa: potential uninitialized return in vhost_vdpa_va_map() (2021-09-14 18:10:43 -0400)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus
for you to fetch changes up to bcef9356fc2e1302daf373c83c826aa27954d128:
vhost-vdpa: Fix the wrong input in config_cb (2021-10-13 08:42:07 -0400)
----------------------------------------------------------------
virtio,vdpa: fixes
Fixes up some issues in rc5.
Signed-off-by: Michael S. Tsirkin <mst(a)redhat.com>
----------------------------------------------------------------
Cindy Lu (1):
vhost-vdpa: Fix the wrong input in config_cb
Halil Pasic (1):
virtio: write back F_VERSION_1 before validate
Michael S. Tsirkin (1):
Revert "virtio-blk: Add validation for block size in config space"
Randy Dunlap (1):
VDUSE: fix documentation underline warning
Wu Zongyong (1):
vhost_vdpa: unset vq irq before freeing irq
Documentation/userspace-api/vduse.rst | 2 +-
drivers/block/virtio_blk.c | 37 ++++++-----------------------------
drivers/vhost/vdpa.c | 10 +++++-----
drivers/virtio/virtio.c | 11 +++++++++++
4 files changed, 23 insertions(+), 37 deletions(-)
If io_rw_should_reissue() fails in iopoll path and we can't reissue we
fail the request. Don't forget to also mark it as failed, so links are
broken.
Cc: stable(a)vger.kernel.org
Signed-off-by: Pavel Begunkov <asml.silence(a)gmail.com>
---
fs/io_uring.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 0d7613c7355c..40b1697e7354 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2687,6 +2687,7 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2)
req->flags |= REQ_F_REISSUE;
return;
}
+ req_set_fail(req);
req->result = res;
}
--
2.33.1
Some Intel chipsets disconnect the time and date RTC registers when the
clock update is in progress: during this time reads may return bogus
values and writes fail silently. This includes the RTC alarm registers.
[1]
cmos_read_alarm() and cmos_set_alarm() did not take account for that,
which caused alarm time reads to sometimes return bogus values. This can
be shown with a test patch that I am attaching to this patch series.
Setting the alarm clock also probably did fail sometimes.
To make this patch suitable for inclusion in stable kernels, I'm using a
simple method for avoiding the RTC update cycle. This method is used in
mach_set_rtc_mmss() in arch/x86/kernel/rtc.c. A more elaborate algorithm
- as in mc146818_get_time() in drivers/rtc/rtc-mc146818-lib.c - would be
too complcated for stable. [2]
cmos_wait_for_uip_clear() has the rtc_lock taken while waiting for the
UIP bit to become clear. This should be harmless as during the UIP the RTC
cannot be read from anyway. mach_get_cmos_time() in arch/x86/kernel/rtc.c
does things the same way.
[1] 7th Generation Intel ® Processor Family I/O for U/Y Platforms [...]
Datasheet, Volume 1 of 2 (Intel's Document Number: 334658-006)
Page 208
https://www.intel.com/content/dam/www/public/us/en/documents/datasheets/7th…
"If a RAM read from the ten time and date bytes is attempted
during an update cycle, the value read do not necessarily
represent the true contents of those locations. Any RAM writes
under the same conditions are ignored.'
[2] I'm going to submit a unification patch for a later kernel release -
prefer to see this in stable.
Signed-off-by: Mateusz Jończyk <mat.jonczyk(a)o2.pl>
Cc: Alessandro Zummo <a.zummo(a)towertech.it>
Cc: Alexandre Belloni <alexandre.belloni(a)bootlin.com>
Cc: stable(a)vger.kernel.org
---
drivers/rtc/rtc-cmos.c | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 2cd0fe728ab2..643433d984ab 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -248,6 +248,31 @@ static int cmos_set_time(struct device *dev, struct rtc_time *t)
return mc146818_set_time(t);
}
+/* Some Intel chipsets disconnect the alarm registers when the clock update is
+ * in progress - during this time reads return bogus values and writes may fail
+ * silently. See for example "7th Generation Intel® Processor Family I/O for
+ * U/Y Platforms [...] Datasheet", section 27.7.1
+ *
+ * Check the UIP bit to prevent this, waiting for max 10ms for it to become
+ * clear.
+ *
+ * This function has to be called with rtc_lock taken.
+ */
+static int cmos_wait_for_uip_clear(struct device *dev)
+{
+ int i;
+
+ for (i = 0; i < 100; i++) {
+ if ((CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) == 0)
+ return 0;
+ udelay(100);
+ }
+
+ dev_warn_ratelimited(dev, "UIP bit is stuck, cannot access RTC registers\n");
+
+ return 1;
+}
+
static int cmos_read_alarm(struct device *dev, struct rtc_wkalrm *t)
{
struct cmos_rtc *cmos = dev_get_drvdata(dev);
@@ -257,12 +282,17 @@ static int cmos_read_alarm(struct device *dev, struct rtc_wkalrm *t)
if (!is_valid_irq(cmos->irq))
return -EIO;
+ spin_lock_irq(&rtc_lock);
+
+ if (cmos_wait_for_uip_clear(dev)) {
+ spin_unlock_irq(&rtc_lock);
+ return -EIO;
+ }
+
/* Basic alarms only support hour, minute, and seconds fields.
* Some also support day and month, for alarms up to a year in
* the future.
*/
-
- spin_lock_irq(&rtc_lock);
t->time.tm_sec = CMOS_READ(RTC_SECONDS_ALARM);
t->time.tm_min = CMOS_READ(RTC_MINUTES_ALARM);
t->time.tm_hour = CMOS_READ(RTC_HOURS_ALARM);
@@ -477,6 +507,10 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t)
}
spin_lock_irq(&rtc_lock);
+ if (cmos_wait_for_uip_clear(dev)) {
+ spin_unlock_irq(&rtc_lock);
+ return -EIO;
+ }
/* next rtc irq must not be from previous alarm setting */
cmos_irq_disable(cmos, RTC_AIE);
--
2.25.1