* [PATCH v2 0/1] scsi: ufs: fix waiting time for reference clock
From: Stanley Chu @ 2020-02-20 13:48 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: Stanley Chu, bvanassche, andy.teng, chun-hung.wu, kuohong.wang,
linux-kernel, cang, linux-mediatek, peter.wang, matthias.bgg,
beanhuo, linux-arm-kernel, asutoshd
Hi,
This patchset adds waiting time for reference clock provided to UFS device in MediaTek UFS implementation.
v1 -> v2:
- Drop patch #1 "scsi: ufs: add required delay after gating reference clock" since it will impact ufs-qcom flow without solid conclusion yet.
Stanley Chu (1):
scsi: ufs: ufs-mediatek: add waiting time for reference clock
drivers/scsi/ufs/ufs-mediatek.c | 46 +++++++++++++++++++++++++++++++--
drivers/scsi/ufs/ufs-mediatek.h | 2 ++
2 files changed, 46 insertions(+), 2 deletions(-)
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply
* Re: [PATCH v1 07/13] migrate/ram: Get rid of "place_source" in ram_load_postcopy()
From: Peter Xu @ 2020-02-20 13:48 UTC (permalink / raw)
To: David Hildenbrand
Cc: Eduardo Habkost, Juan Quintela, qemu-devel,
Dr . David Alan Gilbert, Paolo Bonzini, Richard Henderson
In-Reply-To: <899dc544-757f-29ac-3a97-f45a92e68040@redhat.com>
On Thu, Feb 20, 2020 at 02:22:48PM +0100, David Hildenbrand wrote:
> > For resizing test, an easy way (I can think of) is to temporarily
> > remove the size check below in your test branch:
>
> Yeah, it's especially hard to have a reliable test one can materialize.
> I played with manual tests like this myself.
Great!
>
> I'm thinking about testing this with a device that can trigger resizes
> on demand, e.g., virtio-mem, for now on my private branch. But I'd
> really like to have some test one can automate at one point ... however,
> there seems to be no easy way to achieve that right now.
Yes I totally agree.
Thanks,
--
Peter Xu
^ permalink raw reply
* [PATCH v2 0/1] scsi: ufs: fix waiting time for reference clock
From: Stanley Chu @ 2020-02-20 13:48 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: Stanley Chu, bvanassche, andy.teng, chun-hung.wu, kuohong.wang,
linux-kernel, cang, linux-mediatek, peter.wang, matthias.bgg,
beanhuo, linux-arm-kernel, asutoshd
Hi,
This patchset adds waiting time for reference clock provided to UFS device in MediaTek UFS implementation.
v1 -> v2:
- Drop patch #1 "scsi: ufs: add required delay after gating reference clock" since it will impact ufs-qcom flow without solid conclusion yet.
Stanley Chu (1):
scsi: ufs: ufs-mediatek: add waiting time for reference clock
drivers/scsi/ufs/ufs-mediatek.c | 46 +++++++++++++++++++++++++++++++--
drivers/scsi/ufs/ufs-mediatek.h | 2 ++
2 files changed, 46 insertions(+), 2 deletions(-)
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH v2 1/1] scsi: ufs: ufs-mediatek: add waiting time for reference clock
From: Stanley Chu @ 2020-02-20 13:48 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: Stanley Chu, bvanassche, andy.teng, chun-hung.wu, kuohong.wang,
linux-kernel, cang, linux-mediatek, peter.wang, matthias.bgg,
beanhuo, linux-arm-kernel, asutoshd
In-Reply-To: <20200220134848.8807-1-stanley.chu@mediatek.com>
Some delays may be required either after gating or before ungating
reference clock for device according to vendor requirements.
Note that in UFS 3.0, the delay time after gating reference
clock can be defined by attribute bRefClkGatingWaitTime. Use the
formal value instead if it can be queried from device.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
drivers/scsi/ufs/ufs-mediatek.c | 46 +++++++++++++++++++++++++++++++--
drivers/scsi/ufs/ufs-mediatek.h | 2 ++
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index 9d05962feb15..de650822c9d9 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -100,6 +100,17 @@ static int ufs_mtk_bind_mphy(struct ufs_hba *hba)
return err;
}
+static void ufs_mtk_udelay(unsigned long us)
+{
+ if (!us)
+ return;
+
+ if (us < 10)
+ udelay(us);
+ else
+ usleep_range(us, us + 10);
+}
+
static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)
{
struct ufs_mtk_host *host = ufshcd_get_variant(hba);
@@ -112,6 +123,7 @@ static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)
if (on) {
ufs_mtk_ref_clk_notify(on, res);
+ ufs_mtk_udelay(host->ref_clk_ungating_wait_us);
ufshcd_writel(hba, REFCLK_REQUEST, REG_UFS_REFCLK_CTRL);
} else {
ufshcd_writel(hba, REFCLK_RELEASE, REG_UFS_REFCLK_CTRL);
@@ -137,12 +149,29 @@ static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)
out:
host->ref_clk_enabled = on;
- if (!on)
+ if (!on) {
+ ufs_mtk_udelay(host->ref_clk_gating_wait_us);
ufs_mtk_ref_clk_notify(on, res);
+ }
return 0;
}
+static void ufs_mtk_setup_ref_clk_wait_us(struct ufs_hba *hba,
+ u16 gating_us, u16 ungating_us)
+{
+ struct ufs_mtk_host *host = ufshcd_get_variant(hba);
+
+ if (hba->dev_info.clk_gating_wait_us) {
+ host->ref_clk_gating_wait_us =
+ hba->dev_info.clk_gating_wait_us;
+ } else {
+ host->ref_clk_gating_wait_us = gating_us;
+ }
+
+ host->ref_clk_ungating_wait_us = ungating_us;
+}
+
static u32 ufs_mtk_link_get_state(struct ufs_hba *hba)
{
u32 val;
@@ -502,10 +531,23 @@ static void ufs_mtk_dbg_register_dump(struct ufs_hba *hba)
static int ufs_mtk_apply_dev_quirks(struct ufs_hba *hba)
{
struct ufs_dev_info *dev_info = &hba->dev_info;
+ u16 mid = dev_info->wmanufacturerid;
- if (dev_info->wmanufacturerid == UFS_VENDOR_SAMSUNG)
+ if (mid == UFS_VENDOR_SAMSUNG)
ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TACTIVATE), 6);
+ /*
+ * Decide waiting time before gating reference clock and
+ * after ungating reference clock according to vendors'
+ * requirements.
+ */
+ if (mid == UFS_VENDOR_SAMSUNG)
+ ufs_mtk_setup_ref_clk_wait_us(hba, 1, 1);
+ else if (mid == UFS_VENDOR_SKHYNIX)
+ ufs_mtk_setup_ref_clk_wait_us(hba, 30, 30);
+ else if (mid == UFS_VENDOR_TOSHIBA)
+ ufs_mtk_setup_ref_clk_wait_us(hba, 100, 32);
+
return 0;
}
diff --git a/drivers/scsi/ufs/ufs-mediatek.h b/drivers/scsi/ufs/ufs-mediatek.h
index 492414e5f481..4c787b99fe41 100644
--- a/drivers/scsi/ufs/ufs-mediatek.h
+++ b/drivers/scsi/ufs/ufs-mediatek.h
@@ -92,6 +92,8 @@ struct ufs_mtk_host {
struct ufs_hba *hba;
struct phy *mphy;
bool ref_clk_enabled;
+ u16 ref_clk_ungating_wait_us;
+ u16 ref_clk_gating_wait_us;
};
#endif /* !_UFS_MEDIATEK_H */
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related
* Re: [f2fs-dev] [PATCH v7 14/24] btrfs: Convert from readpages to readahead
From: Matthew Wilcox @ 2020-02-20 13:48 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com,
linux-mm@kvack.org, ocfs2-devel@oss.oracle.com,
linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-erofs@lists.ozlabs.org, linux-btrfs@vger.kernel.org
In-Reply-To: <SN4PR0401MB35987D7B76007B93B1C5CE5E9B130@SN4PR0401MB3598.namprd04.prod.outlook.com>
On Thu, Feb 20, 2020 at 09:42:19AM +0000, Johannes Thumshirn wrote:
> On 19/02/2020 22:03, Matthew Wilcox wrote:
> > From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> >
> > Use the new readahead operation in btrfs. Add a
> > readahead_for_each_batch() iterator to optimise the loop in the XArray.
>
> OK I must admit I haven't followed this series closely, but what
> happened to said readahead_for_each_batch()?
>
> As far as I can see it's now:
>
> [...]
> > + while ((nr = readahead_page_batch(rac, pagepool))) {
Oops, forgot to update the changelog there. Yes, that's exactly what it
changed to. That discussion was here:
https://lore.kernel.org/linux-fsdevel/20200219144117.GP24185@bombadil.infradead.org/
... and then Christoph pointed out the iterators weren't really adding
much value at that point, so they got deleted. New changelog for
this patch:
btrfs: Convert from readpages to readahead
Implement the new readahead method in btrfs. Add a readahead_page_batch()
to optimise fetching a batch of pages at once.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply
* [PATCH v2 1/1] scsi: ufs: ufs-mediatek: add waiting time for reference clock
From: Stanley Chu @ 2020-02-20 13:48 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: beanhuo, asutoshd, cang, matthias.bgg, bvanassche, linux-mediatek,
linux-arm-kernel, linux-kernel, kuohong.wang, peter.wang,
chun-hung.wu, andy.teng, Stanley Chu
In-Reply-To: <20200220134848.8807-1-stanley.chu@mediatek.com>
Some delays may be required either after gating or before ungating
reference clock for device according to vendor requirements.
Note that in UFS 3.0, the delay time after gating reference
clock can be defined by attribute bRefClkGatingWaitTime. Use the
formal value instead if it can be queried from device.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
drivers/scsi/ufs/ufs-mediatek.c | 46 +++++++++++++++++++++++++++++++--
drivers/scsi/ufs/ufs-mediatek.h | 2 ++
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index 9d05962feb15..de650822c9d9 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -100,6 +100,17 @@ static int ufs_mtk_bind_mphy(struct ufs_hba *hba)
return err;
}
+static void ufs_mtk_udelay(unsigned long us)
+{
+ if (!us)
+ return;
+
+ if (us < 10)
+ udelay(us);
+ else
+ usleep_range(us, us + 10);
+}
+
static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)
{
struct ufs_mtk_host *host = ufshcd_get_variant(hba);
@@ -112,6 +123,7 @@ static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)
if (on) {
ufs_mtk_ref_clk_notify(on, res);
+ ufs_mtk_udelay(host->ref_clk_ungating_wait_us);
ufshcd_writel(hba, REFCLK_REQUEST, REG_UFS_REFCLK_CTRL);
} else {
ufshcd_writel(hba, REFCLK_RELEASE, REG_UFS_REFCLK_CTRL);
@@ -137,12 +149,29 @@ static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)
out:
host->ref_clk_enabled = on;
- if (!on)
+ if (!on) {
+ ufs_mtk_udelay(host->ref_clk_gating_wait_us);
ufs_mtk_ref_clk_notify(on, res);
+ }
return 0;
}
+static void ufs_mtk_setup_ref_clk_wait_us(struct ufs_hba *hba,
+ u16 gating_us, u16 ungating_us)
+{
+ struct ufs_mtk_host *host = ufshcd_get_variant(hba);
+
+ if (hba->dev_info.clk_gating_wait_us) {
+ host->ref_clk_gating_wait_us =
+ hba->dev_info.clk_gating_wait_us;
+ } else {
+ host->ref_clk_gating_wait_us = gating_us;
+ }
+
+ host->ref_clk_ungating_wait_us = ungating_us;
+}
+
static u32 ufs_mtk_link_get_state(struct ufs_hba *hba)
{
u32 val;
@@ -502,10 +531,23 @@ static void ufs_mtk_dbg_register_dump(struct ufs_hba *hba)
static int ufs_mtk_apply_dev_quirks(struct ufs_hba *hba)
{
struct ufs_dev_info *dev_info = &hba->dev_info;
+ u16 mid = dev_info->wmanufacturerid;
- if (dev_info->wmanufacturerid == UFS_VENDOR_SAMSUNG)
+ if (mid == UFS_VENDOR_SAMSUNG)
ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TACTIVATE), 6);
+ /*
+ * Decide waiting time before gating reference clock and
+ * after ungating reference clock according to vendors'
+ * requirements.
+ */
+ if (mid == UFS_VENDOR_SAMSUNG)
+ ufs_mtk_setup_ref_clk_wait_us(hba, 1, 1);
+ else if (mid == UFS_VENDOR_SKHYNIX)
+ ufs_mtk_setup_ref_clk_wait_us(hba, 30, 30);
+ else if (mid == UFS_VENDOR_TOSHIBA)
+ ufs_mtk_setup_ref_clk_wait_us(hba, 100, 32);
+
return 0;
}
diff --git a/drivers/scsi/ufs/ufs-mediatek.h b/drivers/scsi/ufs/ufs-mediatek.h
index 492414e5f481..4c787b99fe41 100644
--- a/drivers/scsi/ufs/ufs-mediatek.h
+++ b/drivers/scsi/ufs/ufs-mediatek.h
@@ -92,6 +92,8 @@ struct ufs_mtk_host {
struct ufs_hba *hba;
struct phy *mphy;
bool ref_clk_enabled;
+ u16 ref_clk_ungating_wait_us;
+ u16 ref_clk_gating_wait_us;
};
#endif /* !_UFS_MEDIATEK_H */
--
2.18.0
^ permalink raw reply related
* [PATCH v2 1/1] scsi: ufs: ufs-mediatek: add waiting time for reference clock
From: Stanley Chu @ 2020-02-20 13:48 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: Stanley Chu, bvanassche, andy.teng, chun-hung.wu, kuohong.wang,
linux-kernel, cang, linux-mediatek, peter.wang, matthias.bgg,
beanhuo, linux-arm-kernel, asutoshd
In-Reply-To: <20200220134848.8807-1-stanley.chu@mediatek.com>
Some delays may be required either after gating or before ungating
reference clock for device according to vendor requirements.
Note that in UFS 3.0, the delay time after gating reference
clock can be defined by attribute bRefClkGatingWaitTime. Use the
formal value instead if it can be queried from device.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
drivers/scsi/ufs/ufs-mediatek.c | 46 +++++++++++++++++++++++++++++++--
drivers/scsi/ufs/ufs-mediatek.h | 2 ++
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index 9d05962feb15..de650822c9d9 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -100,6 +100,17 @@ static int ufs_mtk_bind_mphy(struct ufs_hba *hba)
return err;
}
+static void ufs_mtk_udelay(unsigned long us)
+{
+ if (!us)
+ return;
+
+ if (us < 10)
+ udelay(us);
+ else
+ usleep_range(us, us + 10);
+}
+
static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)
{
struct ufs_mtk_host *host = ufshcd_get_variant(hba);
@@ -112,6 +123,7 @@ static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)
if (on) {
ufs_mtk_ref_clk_notify(on, res);
+ ufs_mtk_udelay(host->ref_clk_ungating_wait_us);
ufshcd_writel(hba, REFCLK_REQUEST, REG_UFS_REFCLK_CTRL);
} else {
ufshcd_writel(hba, REFCLK_RELEASE, REG_UFS_REFCLK_CTRL);
@@ -137,12 +149,29 @@ static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)
out:
host->ref_clk_enabled = on;
- if (!on)
+ if (!on) {
+ ufs_mtk_udelay(host->ref_clk_gating_wait_us);
ufs_mtk_ref_clk_notify(on, res);
+ }
return 0;
}
+static void ufs_mtk_setup_ref_clk_wait_us(struct ufs_hba *hba,
+ u16 gating_us, u16 ungating_us)
+{
+ struct ufs_mtk_host *host = ufshcd_get_variant(hba);
+
+ if (hba->dev_info.clk_gating_wait_us) {
+ host->ref_clk_gating_wait_us =
+ hba->dev_info.clk_gating_wait_us;
+ } else {
+ host->ref_clk_gating_wait_us = gating_us;
+ }
+
+ host->ref_clk_ungating_wait_us = ungating_us;
+}
+
static u32 ufs_mtk_link_get_state(struct ufs_hba *hba)
{
u32 val;
@@ -502,10 +531,23 @@ static void ufs_mtk_dbg_register_dump(struct ufs_hba *hba)
static int ufs_mtk_apply_dev_quirks(struct ufs_hba *hba)
{
struct ufs_dev_info *dev_info = &hba->dev_info;
+ u16 mid = dev_info->wmanufacturerid;
- if (dev_info->wmanufacturerid == UFS_VENDOR_SAMSUNG)
+ if (mid == UFS_VENDOR_SAMSUNG)
ufshcd_dme_set(hba, UIC_ARG_MIB(PA_TACTIVATE), 6);
+ /*
+ * Decide waiting time before gating reference clock and
+ * after ungating reference clock according to vendors'
+ * requirements.
+ */
+ if (mid == UFS_VENDOR_SAMSUNG)
+ ufs_mtk_setup_ref_clk_wait_us(hba, 1, 1);
+ else if (mid == UFS_VENDOR_SKHYNIX)
+ ufs_mtk_setup_ref_clk_wait_us(hba, 30, 30);
+ else if (mid == UFS_VENDOR_TOSHIBA)
+ ufs_mtk_setup_ref_clk_wait_us(hba, 100, 32);
+
return 0;
}
diff --git a/drivers/scsi/ufs/ufs-mediatek.h b/drivers/scsi/ufs/ufs-mediatek.h
index 492414e5f481..4c787b99fe41 100644
--- a/drivers/scsi/ufs/ufs-mediatek.h
+++ b/drivers/scsi/ufs/ufs-mediatek.h
@@ -92,6 +92,8 @@ struct ufs_mtk_host {
struct ufs_hba *hba;
struct phy *mphy;
bool ref_clk_enabled;
+ u16 ref_clk_ungating_wait_us;
+ u16 ref_clk_gating_wait_us;
};
#endif /* !_UFS_MEDIATEK_H */
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v2 0/1] scsi: ufs: fix waiting time for reference clock
From: Stanley Chu @ 2020-02-20 13:48 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: beanhuo, asutoshd, cang, matthias.bgg, bvanassche, linux-mediatek,
linux-arm-kernel, linux-kernel, kuohong.wang, peter.wang,
chun-hung.wu, andy.teng, Stanley Chu
Hi,
This patchset adds waiting time for reference clock provided to UFS device in MediaTek UFS implementation.
v1 -> v2:
- Drop patch #1 "scsi: ufs: add required delay after gating reference clock" since it will impact ufs-qcom flow without solid conclusion yet.
Stanley Chu (1):
scsi: ufs: ufs-mediatek: add waiting time for reference clock
drivers/scsi/ufs/ufs-mediatek.c | 46 +++++++++++++++++++++++++++++++--
drivers/scsi/ufs/ufs-mediatek.h | 2 ++
2 files changed, 46 insertions(+), 2 deletions(-)
--
2.18.0
^ permalink raw reply
* Re: [PATCH v7 14/24] btrfs: Convert from readpages to readahead
From: Matthew Wilcox @ 2020-02-20 13:48 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org,
linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com,
ocfs2-devel@oss.oracle.com, linux-xfs@vger.kernel.org
In-Reply-To: <SN4PR0401MB35987D7B76007B93B1C5CE5E9B130@SN4PR0401MB3598.namprd04.prod.outlook.com>
On Thu, Feb 20, 2020 at 09:42:19AM +0000, Johannes Thumshirn wrote:
> On 19/02/2020 22:03, Matthew Wilcox wrote:
> > From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> >
> > Use the new readahead operation in btrfs. Add a
> > readahead_for_each_batch() iterator to optimise the loop in the XArray.
>
> OK I must admit I haven't followed this series closely, but what
> happened to said readahead_for_each_batch()?
>
> As far as I can see it's now:
>
> [...]
> > + while ((nr = readahead_page_batch(rac, pagepool))) {
Oops, forgot to update the changelog there. Yes, that's exactly what it
changed to. That discussion was here:
https://lore.kernel.org/linux-fsdevel/20200219144117.GP24185@bombadil.infradead.org/
... and then Christoph pointed out the iterators weren't really adding
much value at that point, so they got deleted. New changelog for
this patch:
btrfs: Convert from readpages to readahead
Implement the new readahead method in btrfs. Add a readahead_page_batch()
to optimise fetching a batch of pages at once.
^ permalink raw reply
* [Ocfs2-devel] [PATCH v7 14/24] btrfs: Convert from readpages to readahead
From: Matthew Wilcox @ 2020-02-20 13:48 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org,
linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com,
ocfs2-devel@oss.oracle.com, linux-xfs@vger.kernel.org
In-Reply-To: <SN4PR0401MB35987D7B76007B93B1C5CE5E9B130@SN4PR0401MB3598.namprd04.prod.outlook.com>
On Thu, Feb 20, 2020 at 09:42:19AM +0000, Johannes Thumshirn wrote:
> On 19/02/2020 22:03, Matthew Wilcox wrote:
> > From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> >
> > Use the new readahead operation in btrfs. Add a
> > readahead_for_each_batch() iterator to optimise the loop in the XArray.
>
> OK I must admit I haven't followed this series closely, but what
> happened to said readahead_for_each_batch()?
>
> As far as I can see it's now:
>
> [...]
> > + while ((nr = readahead_page_batch(rac, pagepool))) {
Oops, forgot to update the changelog there. Yes, that's exactly what it
changed to. That discussion was here:
https://urldefense.com/v3/__https://lore.kernel.org/linux-fsdevel/20200219144117.GP24185 at bombadil.infradead.org/__;!!GqivPVa7Brio!NowpsY7jqCHi3nk-7KYRB6OMBhU9RUBOzzoIQZqqy0USKzVxxygQi3ltRqDxPjzhgEcEiw$
... and then Christoph pointed out the iterators weren't really adding
much value at that point, so they got deleted. New changelog for
this patch:
btrfs: Convert from readpages to readahead
Implement the new readahead method in btrfs. Add a readahead_page_batch()
to optimise fetching a batch of pages at once.
^ permalink raw reply
* [Cluster-devel] [PATCH v7 14/24] btrfs: Convert from readpages to readahead
From: Matthew Wilcox @ 2020-02-20 13:48 UTC (permalink / raw)
To: cluster-devel.redhat.com
In-Reply-To: <SN4PR0401MB35987D7B76007B93B1C5CE5E9B130@SN4PR0401MB3598.namprd04.prod.outlook.com>
On Thu, Feb 20, 2020 at 09:42:19AM +0000, Johannes Thumshirn wrote:
> On 19/02/2020 22:03, Matthew Wilcox wrote:
> > From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> >
> > Use the new readahead operation in btrfs. Add a
> > readahead_for_each_batch() iterator to optimise the loop in the XArray.
>
> OK I must admit I haven't followed this series closely, but what
> happened to said readahead_for_each_batch()?
>
> As far as I can see it's now:
>
> [...]
> > + while ((nr = readahead_page_batch(rac, pagepool))) {
Oops, forgot to update the changelog there. Yes, that's exactly what it
changed to. That discussion was here:
https://lore.kernel.org/linux-fsdevel/20200219144117.GP24185 at bombadil.infradead.org/
... and then Christoph pointed out the iterators weren't really adding
much value at that point, so they got deleted. New changelog for
this patch:
btrfs: Convert from readpages to readahead
Implement the new readahead method in btrfs. Add a readahead_page_batch()
to optimise fetching a batch of pages at once.
^ permalink raw reply
* Re: [PATCH v3 3/6] powerpc/fsl_booke/64: implement KASLR for fsl_booke64
From: Christophe Leroy @ 2020-02-20 13:48 UTC (permalink / raw)
To: Jason Yan, mpe, linuxppc-dev, diana.craciun, benh, paulus,
npiggin, keescook, kernel-hardening, oss
Cc: linux-kernel, zhaohongjiang
In-Reply-To: <20200206025825.22934-4-yanaijie@huawei.com>
Le 06/02/2020 à 03:58, Jason Yan a écrit :
> The implementation for Freescale BookE64 is similar as BookE32. One
> difference is that Freescale BookE64 set up a TLB mapping of 1G during
> booting. Another difference is that ppc64 needs the kernel to be
> 64K-aligned. So we can randomize the kernel in this 1G mapping and make
> it 64K-aligned. This can save some code to creat another TLB map at
> early boot. The disadvantage is that we only have about 1G/64K = 16384
> slots to put the kernel in.
>
> To support secondary cpu boot up, a variable __kaslr_offset was added in
> first_256B section. This can help secondary cpu get the kaslr offset
> before the 1:1 mapping has been setup.
>
> Signed-off-by: Jason Yan <yanaijie@huawei.com>
> Cc: Scott Wood <oss@buserror.net>
> Cc: Diana Craciun <diana.craciun@nxp.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Christophe Leroy <christophe.leroy@c-s.fr>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Kees Cook <keescook@chromium.org>
> ---
> arch/powerpc/Kconfig | 2 +-
> arch/powerpc/kernel/exceptions-64e.S | 10 +++++++++
> arch/powerpc/kernel/head_64.S | 7 ++++++
> arch/powerpc/kernel/setup_64.c | 4 +++-
> arch/powerpc/mm/mmu_decl.h | 16 +++++++-------
> arch/powerpc/mm/nohash/kaslr_booke.c | 33 +++++++++++++++++++++++++---
> 6 files changed, 59 insertions(+), 13 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index c150a9d49343..754aeb96bb1c 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -568,7 +568,7 @@ config RELOCATABLE
>
> config RANDOMIZE_BASE
> bool "Randomize the address of the kernel image"
> - depends on (FSL_BOOKE && FLATMEM && PPC32)
> + depends on (PPC_FSL_BOOK3E && FLATMEM)
> depends on RELOCATABLE
> help
> Randomizes the virtual address at which the kernel image is
> diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
> index 1b9b174bee86..c1c05b8684ca 100644
> --- a/arch/powerpc/kernel/exceptions-64e.S
> +++ b/arch/powerpc/kernel/exceptions-64e.S
> @@ -1378,6 +1378,7 @@ skpinv: addi r6,r6,1 /* Increment */
> 1: mflr r6
> addi r6,r6,(2f - 1b)
> tovirt(r6,r6)
> + add r6,r6,r19
> lis r7,MSR_KERNEL@h
> ori r7,r7,MSR_KERNEL@l
> mtspr SPRN_SRR0,r6
> @@ -1400,6 +1401,7 @@ skpinv: addi r6,r6,1 /* Increment */
>
> /* We translate LR and return */
> tovirt(r8,r8)
> + add r8,r8,r19
> mtlr r8
> blr
>
> @@ -1528,6 +1530,7 @@ a2_tlbinit_code_end:
> */
> _GLOBAL(start_initialization_book3e)
> mflr r28
> + li r19, 0
>
> /* First, we need to setup some initial TLBs to map the kernel
> * text, data and bss at PAGE_OFFSET. We don't have a real mode
> @@ -1570,6 +1573,12 @@ _GLOBAL(book3e_secondary_core_init)
> cmplwi r4,0
> bne 2f
>
> + li r19, 0
> +#ifdef CONFIG_RANDOMIZE_BASE
> + LOAD_REG_ADDR_PIC(r19, __kaslr_offset)
> + lwz r19,0(r19)
> + rlwinm r19,r19,0,0,5
> +#endif
> /* Setup TLB for this core */
> bl initial_tlb_book3e
>
> @@ -1602,6 +1611,7 @@ _GLOBAL(book3e_secondary_core_init)
> lis r3,PAGE_OFFSET@highest
> sldi r3,r3,32
> or r28,r28,r3
> + add r28,r28,r19
> 1: mtlr r28
> blr
>
> diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
> index ad79fddb974d..744624140fb8 100644
> --- a/arch/powerpc/kernel/head_64.S
> +++ b/arch/powerpc/kernel/head_64.S
> @@ -104,6 +104,13 @@ __secondary_hold_acknowledge:
> .8byte 0x0
>
> #ifdef CONFIG_RELOCATABLE
> +#ifdef CONFIG_RANDOMIZE_BASE
> + . = 0x58
> + .globl __kaslr_offset
> +__kaslr_offset:
> +DEFINE_FIXED_SYMBOL(__kaslr_offset)
> + .long 0
> +#endif
> /* This flag is set to 1 by a loader if the kernel should run
> * at the loaded address instead of the linked address. This
> * is used by kexec-tools to keep the the kdump kernel in the
> diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
> index 6104917a282d..a16b970a8d1a 100644
> --- a/arch/powerpc/kernel/setup_64.c
> +++ b/arch/powerpc/kernel/setup_64.c
> @@ -66,7 +66,7 @@
> #include <asm/feature-fixups.h>
> #include <asm/kup.h>
> #include <asm/early_ioremap.h>
> -
Why remove this new line which clearly separates things in asm/ and
things in local dir ?
> +#include <mm/mmu_decl.h>
> #include "setup.h"
>
> int spinning_secondaries;
> @@ -300,6 +300,8 @@ void __init early_setup(unsigned long dt_ptr)
> /* Enable early debugging if any specified (see udbg.h) */
> udbg_early_init();
>
> + kaslr_early_init(__va(dt_ptr), 0);
> +
> udbg_printf(" -> %s(), dt_ptr: 0x%lx\n", __func__, dt_ptr);
>
> /*
> diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
> index 3e1c85c7d10b..bbd721d1e3d7 100644
> --- a/arch/powerpc/mm/mmu_decl.h
> +++ b/arch/powerpc/mm/mmu_decl.h
> @@ -147,14 +147,6 @@ void reloc_kernel_entry(void *fdt, long addr);
> extern void loadcam_entry(unsigned int index);
> extern void loadcam_multi(int first_idx, int num, int tmp_idx);
>
> -#ifdef CONFIG_RANDOMIZE_BASE
> -void kaslr_early_init(void *dt_ptr, phys_addr_t size);
> -void kaslr_late_init(void);
> -#else
> -static inline void kaslr_early_init(void *dt_ptr, phys_addr_t size) {}
> -static inline void kaslr_late_init(void) {}
> -#endif
> -
> struct tlbcam {
> u32 MAS0;
> u32 MAS1;
> @@ -164,6 +156,14 @@ struct tlbcam {
> };
> #endif
>
> +#ifdef CONFIG_RANDOMIZE_BASE
> +void kaslr_early_init(void *dt_ptr, phys_addr_t size);
> +void kaslr_late_init(void);
> +#else
> +static inline void kaslr_early_init(void *dt_ptr, phys_addr_t size) {}
> +static inline void kaslr_late_init(void) {}
> +#endif
> +
> #if defined(CONFIG_PPC_BOOK3S_32) || defined(CONFIG_FSL_BOOKE) || defined(CONFIG_PPC_8xx)
> /* 6xx have BATS */
> /* FSL_BOOKE have TLBCAM */
> diff --git a/arch/powerpc/mm/nohash/kaslr_booke.c b/arch/powerpc/mm/nohash/kaslr_booke.c
> index 07b036e98353..c6f5c1db1394 100644
> --- a/arch/powerpc/mm/nohash/kaslr_booke.c
> +++ b/arch/powerpc/mm/nohash/kaslr_booke.c
> @@ -231,7 +231,7 @@ static __init unsigned long get_usable_address(const void *fdt,
> unsigned long pa;
> unsigned long pa_end;
>
> - for (pa = offset; (long)pa > (long)start; pa -= SZ_16K) {
> + for (pa = offset; (long)pa > (long)start; pa -= SZ_64K) {
Doesn't this modify the behaviour for PPC32 too ?
> pa_end = pa + regions.kernel_size;
> if (overlaps_region(fdt, pa, pa_end))
> continue;
> @@ -265,14 +265,14 @@ static unsigned long __init kaslr_legal_offset(void *dt_ptr, unsigned long rando
> {
> unsigned long koffset = 0;
> unsigned long start;
> - unsigned long index;
> unsigned long offset;
>
> +#ifdef CONFIG_PPC32
Can we use
if (IS_ENABLED(CONFIG_PPC32)) {
/* 32 bits stuff */
} else {
/* 64 bits stuff */
}
> /*
> * Decide which 64M we want to start
> * Only use the low 8 bits of the random seed
> */
> - index = random & 0xFF;
> + unsigned long index = random & 0xFF;
That's not good in terms of readability, index declaration should remain
at the top of the function, should be possible if using IS_ENABLED() instead
> index %= regions.linear_sz / SZ_64M;
>
> /* Decide offset inside 64M */
> @@ -287,6 +287,15 @@ static unsigned long __init kaslr_legal_offset(void *dt_ptr, unsigned long rando
> break;
> index--;
> }
> +#else
> + /* Decide kernel offset inside 1G */
> + offset = random % (SZ_1G - regions.kernel_size);
> + offset = round_down(offset, SZ_64K);
> +
> + start = memstart_addr;
> + offset = memstart_addr + offset;
> + koffset = get_usable_address(dt_ptr, start, offset);
> +#endif
>
> if (koffset != 0)
> koffset -= memstart_addr;
> @@ -325,6 +334,7 @@ static unsigned long __init kaslr_choose_location(void *dt_ptr, phys_addr_t size
> else
> pr_warn("KASLR: No safe seed for randomizing the kernel base.\n");
>
> +#ifdef CONFIG_PPC32
> ram = min_t(phys_addr_t, __max_low_memory, size);
> ram = map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM, true);
> linear_sz = min_t(unsigned long, ram, SZ_512M);
> @@ -332,6 +342,7 @@ static unsigned long __init kaslr_choose_location(void *dt_ptr, phys_addr_t size
> /* If the linear size is smaller than 64M, do not randmize */
> if (linear_sz < SZ_64M)
> return 0;
> +#endif
>
> /* check for a reserved-memory node and record its cell sizes */
> regions.reserved_mem = fdt_path_offset(dt_ptr, "/reserved-memory");
> @@ -363,6 +374,17 @@ notrace void __init kaslr_early_init(void *dt_ptr, phys_addr_t size)
> unsigned long offset;
> unsigned long kernel_sz;
>
> +#ifdef CONFIG_PPC64
Same, can we use a standard C if/else sequence with
IS_ENABLED(CONFIG_PPC64) ?
> + unsigned int *__kaslr_offset = (unsigned int *)(KERNELBASE + 0x58);
> + unsigned int *__run_at_load = (unsigned int *)(KERNELBASE + 0x5c);
> +
> + if (*__run_at_load == 1)
> + return;
> +
> + /* Setup flat device-tree pointer */
> + initial_boot_params = dt_ptr;
> +#endif
> +
> kernel_sz = (unsigned long)_end - (unsigned long)_stext;
>
> offset = kaslr_choose_location(dt_ptr, size, kernel_sz);
> @@ -372,6 +394,7 @@ notrace void __init kaslr_early_init(void *dt_ptr, phys_addr_t size)
> kernstart_virt_addr += offset;
> kernstart_addr += offset;
>
> +#ifdef CONFIG_PPC32
> is_second_reloc = 1;
>
> if (offset >= SZ_64M) {
> @@ -381,6 +404,10 @@ notrace void __init kaslr_early_init(void *dt_ptr, phys_addr_t size)
> /* Create kernel map to relocate in */
> create_kaslr_tlb_entry(1, tlb_virt, tlb_phys);
> }
> +#else
> + *__kaslr_offset = kernstart_virt_addr - KERNELBASE;
> + *__run_at_load = 1;
> +#endif
>
> /* Copy the kernel to it's new location and run */
> memcpy((void *)kernstart_virt_addr, (void *)_stext, kernel_sz);
>
Christophe
^ permalink raw reply
* Re: [PATCH] s390/sclp: improve special wait psw logic
From: Janosch Frank @ 2020-02-20 13:47 UTC (permalink / raw)
To: Christian Borntraeger, Cornelia Huck
Cc: Janosch Frank, David Hildenbrand, qemu-stable, qemu-devel,
qemu-s390x, Richard Henderson
In-Reply-To: <1582204582-22995-1-git-send-email-borntraeger@de.ibm.com>
[-- Attachment #1.1: Type: text/plain, Size: 960 bytes --]
On 2/20/20 2:16 PM, Christian Borntraeger wrote:
> There is a special quiesce PSW that we check for "shutdown". Otherwise disabled
> wait is detected as "crashed". Architecturally we must only check PSW bits
> 116-127. Fix this.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
> ---
> target/s390x/helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/s390x/helper.c b/target/s390x/helper.c
> index a3a4916..6808dfd 100644
> --- a/target/s390x/helper.c
> +++ b/target/s390x/helper.c
> @@ -89,7 +89,7 @@ hwaddr s390_cpu_get_phys_addr_debug(CPUState *cs, vaddr vaddr)
> static inline bool is_special_wait_psw(uint64_t psw_addr)
> {
> /* signal quiesce */
> - return psw_addr == 0xfffUL;
> + return (psw_addr & 0xfffUL) == 0xfffUL;
> }
>
> void s390_handle_wait(S390CPU *cpu)
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH 1/6] drm/bridge: anx6345: Fix getting anx6345 regulators
From: Laurent Pinchart @ 2020-02-20 13:46 UTC (permalink / raw)
To: Vasily Khoruzhick
Cc: Mark Rutland, Neil Armstrong, David Airlie, Linus Walleij,
dri-devel, Andrzej Hajda, Thierry Reding, Sam Ravnborg,
Stephen Rothwell, Samuel Holland, Heiko Stuebner, Chen-Yu Tsai,
Icenowy Zheng, Stephan Gerhold, Jonas Karlman, Torsten Duwe,
Rob Herring, Maxime Ripard, linux-arm-kernel, Jernej Skrabec,
linux-kernel, Mark Brown, Daniel Vetter
In-Reply-To: <20200220083508.792071-2-anarsoul@gmail.com>
Hi Vasily,
Thank you for the patch.
On Thu, Feb 20, 2020 at 12:35:03AM -0800, Vasily Khoruzhick wrote:
> From: Samuel Holland <samuel@sholland.org>
>
> We don't need to pass '-supply' suffix to devm_get_regulator()
>
> Fixes: 6aa192698089 ("drm/bridge: Add Analogix anx6345 support")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> index 56f55c53abfd..0d8d083b0207 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> @@ -712,14 +712,14 @@ static int anx6345_i2c_probe(struct i2c_client *client,
> DRM_DEBUG("No panel found\n");
>
> /* 1.2V digital core power regulator */
> - anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12-supply");
> + anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12");
> if (IS_ERR(anx6345->dvdd12)) {
> DRM_ERROR("dvdd12-supply not found\n");
> return PTR_ERR(anx6345->dvdd12);
> }
>
> /* 2.5V digital core power regulator */
> - anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25-supply");
> + anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25");
> if (IS_ERR(anx6345->dvdd25)) {
> DRM_ERROR("dvdd25-supply not found\n");
> return PTR_ERR(anx6345->dvdd25);
--
Regards,
Laurent Pinchart
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [Intel-gfx] [PATCH] drm/i915: Distribute switch variables for initialization
From: Ville Syrjälä @ 2020-02-20 13:47 UTC (permalink / raw)
To: Kees Cook
Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, intel-gfx,
Alexander Potapenko, linux-kernel
In-Reply-To: <20200220062258.68854-1-keescook@chromium.org>
On Wed, Feb 19, 2020 at 10:22:58PM -0800, Kees Cook wrote:
> Variables declared in a switch statement before any case statements
> cannot be automatically initialized with compiler instrumentation (as
> they are not part of any execution flow). With GCC's proposed automatic
> stack variable initialization feature, this triggers a warning (and they
> don't get initialized). Clang's automatic stack variable initialization
> (via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also
> doesn't initialize such variables[1].
Silly compilers.
> Note that these warnings (or silent
> skipping) happen before the dead-store elimination optimization phase,
> so even when the automatic initializations are later elided in favor of
> direct initializations, the warnings remain.
>
> To avoid these problems, move such variables into the "case" where
> they're used or lift them up into the main function body.
>
> drivers/gpu/drm/i915/display/intel_display.c: In function ‘check_digital_port_conflicts’:
> drivers/gpu/drm/i915/display/intel_display.c:12963:17: warning: statement will never be executed [-Wswitch-unreachable]
> 12963 | unsigned int port_mask;
> | ^~~~~~~~~
>
> drivers/gpu/drm/i915/intel_pm.c: In function ‘vlv_get_fifo_size’:
> drivers/gpu/drm/i915/intel_pm.c:474:7: warning: statement will never be executed [-Wswitch-unreachable]
> 474 | u32 dsparb, dsparb2, dsparb3;
> | ^~~~~~
> drivers/gpu/drm/i915/intel_pm.c: In function ‘vlv_atomic_update_fifo’:
> drivers/gpu/drm/i915/intel_pm.c:1997:7: warning: statement will never be executed [-Wswitch-unreachable]
> 1997 | u32 dsparb, dsparb2, dsparb3;
> | ^~~~~~
>
> [1] https://bugs.llvm.org/show_bug.cgi?id=44916
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> drivers/gpu/drm/i915/display/intel_display.c | 6 ++++--
> drivers/gpu/drm/i915/intel_pm.c | 4 ++--
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 064dd99bbc49..c829cd26f99e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -12960,14 +12960,15 @@ static bool check_digital_port_conflicts(struct intel_atomic_state *state)
> WARN_ON(!connector_state->crtc);
>
> switch (encoder->type) {
> - unsigned int port_mask;
> case INTEL_OUTPUT_DDI:
> if (WARN_ON(!HAS_DDI(to_i915(dev))))
> break;
> /* else, fall through */
> case INTEL_OUTPUT_DP:
> case INTEL_OUTPUT_HDMI:
> - case INTEL_OUTPUT_EDP:
> + case INTEL_OUTPUT_EDP: {
> + unsigned int port_mask;
This one I'd just remove and s/port_mask/BIT(encoder->port)/
everywhere. Otherwise lgtm.
> +
> port_mask = 1 << encoder->port;
>
> /* the same port mustn't appear more than once */
> @@ -12976,6 +12977,7 @@ static bool check_digital_port_conflicts(struct intel_atomic_state *state)
>
> used_ports |= port_mask;
> break;
> + }
> case INTEL_OUTPUT_DP_MST:
> used_mst_ports |=
> 1 << encoder->port;
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index bd2d30ecc030..17d8833787c4 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -469,9 +469,9 @@ static void vlv_get_fifo_size(struct intel_crtc_state *crtc_state)
> struct vlv_fifo_state *fifo_state = &crtc_state->wm.vlv.fifo_state;
> enum pipe pipe = crtc->pipe;
> int sprite0_start, sprite1_start;
> + u32 dsparb, dsparb2, dsparb3;
>
> switch (pipe) {
> - u32 dsparb, dsparb2, dsparb3;
> case PIPE_A:
> dsparb = I915_READ(DSPARB);
> dsparb2 = I915_READ(DSPARB2);
> @@ -1969,6 +1969,7 @@ static void vlv_atomic_update_fifo(struct intel_atomic_state *state,
> const struct vlv_fifo_state *fifo_state =
> &crtc_state->wm.vlv.fifo_state;
> int sprite0_start, sprite1_start, fifo_size;
> + u32 dsparb, dsparb2, dsparb3;
>
> if (!crtc_state->fifo_changed)
> return;
> @@ -1994,7 +1995,6 @@ static void vlv_atomic_update_fifo(struct intel_atomic_state *state,
> spin_lock(&uncore->lock);
>
> switch (crtc->pipe) {
> - u32 dsparb, dsparb2, dsparb3;
> case PIPE_A:
> dsparb = intel_uncore_read_fw(uncore, DSPARB);
> dsparb2 = intel_uncore_read_fw(uncore, DSPARB2);
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel
^ permalink raw reply
* Re: [Intel-gfx] [PATCH] drm/i915: Distribute switch variables for initialization
From: Ville Syrjälä @ 2020-02-20 13:47 UTC (permalink / raw)
To: Kees Cook; +Cc: intel-gfx, linux-kernel, Alexander Potapenko
In-Reply-To: <20200220062258.68854-1-keescook@chromium.org>
On Wed, Feb 19, 2020 at 10:22:58PM -0800, Kees Cook wrote:
> Variables declared in a switch statement before any case statements
> cannot be automatically initialized with compiler instrumentation (as
> they are not part of any execution flow). With GCC's proposed automatic
> stack variable initialization feature, this triggers a warning (and they
> don't get initialized). Clang's automatic stack variable initialization
> (via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also
> doesn't initialize such variables[1].
Silly compilers.
> Note that these warnings (or silent
> skipping) happen before the dead-store elimination optimization phase,
> so even when the automatic initializations are later elided in favor of
> direct initializations, the warnings remain.
>
> To avoid these problems, move such variables into the "case" where
> they're used or lift them up into the main function body.
>
> drivers/gpu/drm/i915/display/intel_display.c: In function ‘check_digital_port_conflicts’:
> drivers/gpu/drm/i915/display/intel_display.c:12963:17: warning: statement will never be executed [-Wswitch-unreachable]
> 12963 | unsigned int port_mask;
> | ^~~~~~~~~
>
> drivers/gpu/drm/i915/intel_pm.c: In function ‘vlv_get_fifo_size’:
> drivers/gpu/drm/i915/intel_pm.c:474:7: warning: statement will never be executed [-Wswitch-unreachable]
> 474 | u32 dsparb, dsparb2, dsparb3;
> | ^~~~~~
> drivers/gpu/drm/i915/intel_pm.c: In function ‘vlv_atomic_update_fifo’:
> drivers/gpu/drm/i915/intel_pm.c:1997:7: warning: statement will never be executed [-Wswitch-unreachable]
> 1997 | u32 dsparb, dsparb2, dsparb3;
> | ^~~~~~
>
> [1] https://bugs.llvm.org/show_bug.cgi?id=44916
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> drivers/gpu/drm/i915/display/intel_display.c | 6 ++++--
> drivers/gpu/drm/i915/intel_pm.c | 4 ++--
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 064dd99bbc49..c829cd26f99e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -12960,14 +12960,15 @@ static bool check_digital_port_conflicts(struct intel_atomic_state *state)
> WARN_ON(!connector_state->crtc);
>
> switch (encoder->type) {
> - unsigned int port_mask;
> case INTEL_OUTPUT_DDI:
> if (WARN_ON(!HAS_DDI(to_i915(dev))))
> break;
> /* else, fall through */
> case INTEL_OUTPUT_DP:
> case INTEL_OUTPUT_HDMI:
> - case INTEL_OUTPUT_EDP:
> + case INTEL_OUTPUT_EDP: {
> + unsigned int port_mask;
This one I'd just remove and s/port_mask/BIT(encoder->port)/
everywhere. Otherwise lgtm.
> +
> port_mask = 1 << encoder->port;
>
> /* the same port mustn't appear more than once */
> @@ -12976,6 +12977,7 @@ static bool check_digital_port_conflicts(struct intel_atomic_state *state)
>
> used_ports |= port_mask;
> break;
> + }
> case INTEL_OUTPUT_DP_MST:
> used_mst_ports |=
> 1 << encoder->port;
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index bd2d30ecc030..17d8833787c4 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -469,9 +469,9 @@ static void vlv_get_fifo_size(struct intel_crtc_state *crtc_state)
> struct vlv_fifo_state *fifo_state = &crtc_state->wm.vlv.fifo_state;
> enum pipe pipe = crtc->pipe;
> int sprite0_start, sprite1_start;
> + u32 dsparb, dsparb2, dsparb3;
>
> switch (pipe) {
> - u32 dsparb, dsparb2, dsparb3;
> case PIPE_A:
> dsparb = I915_READ(DSPARB);
> dsparb2 = I915_READ(DSPARB2);
> @@ -1969,6 +1969,7 @@ static void vlv_atomic_update_fifo(struct intel_atomic_state *state,
> const struct vlv_fifo_state *fifo_state =
> &crtc_state->wm.vlv.fifo_state;
> int sprite0_start, sprite1_start, fifo_size;
> + u32 dsparb, dsparb2, dsparb3;
>
> if (!crtc_state->fifo_changed)
> return;
> @@ -1994,7 +1995,6 @@ static void vlv_atomic_update_fifo(struct intel_atomic_state *state,
> spin_lock(&uncore->lock);
>
> switch (crtc->pipe) {
> - u32 dsparb, dsparb2, dsparb3;
> case PIPE_A:
> dsparb = intel_uncore_read_fw(uncore, DSPARB);
> dsparb2 = intel_uncore_read_fw(uncore, DSPARB2);
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply
* Re: [PATCH 1/6] drm/bridge: anx6345: Fix getting anx6345 regulators
From: Laurent Pinchart @ 2020-02-20 13:46 UTC (permalink / raw)
To: Vasily Khoruzhick
Cc: Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
Rob Herring, Mark Rutland, Maxime Ripard, Chen-Yu Tsai,
Andrzej Hajda, Neil Armstrong, Jonas Karlman, Jernej Skrabec,
Icenowy Zheng, Torsten Duwe, Heiko Stuebner, Linus Walleij,
Stephan Gerhold, Mark Brown, Stephen Rothwell, Samuel Holland,
dri-devel, linux-kernel, linux-arm-kernel
In-Reply-To: <20200220083508.792071-2-anarsoul@gmail.com>
Hi Vasily,
Thank you for the patch.
On Thu, Feb 20, 2020 at 12:35:03AM -0800, Vasily Khoruzhick wrote:
> From: Samuel Holland <samuel@sholland.org>
>
> We don't need to pass '-supply' suffix to devm_get_regulator()
>
> Fixes: 6aa192698089 ("drm/bridge: Add Analogix anx6345 support")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> index 56f55c53abfd..0d8d083b0207 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> @@ -712,14 +712,14 @@ static int anx6345_i2c_probe(struct i2c_client *client,
> DRM_DEBUG("No panel found\n");
>
> /* 1.2V digital core power regulator */
> - anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12-supply");
> + anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12");
> if (IS_ERR(anx6345->dvdd12)) {
> DRM_ERROR("dvdd12-supply not found\n");
> return PTR_ERR(anx6345->dvdd12);
> }
>
> /* 2.5V digital core power regulator */
> - anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25-supply");
> + anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25");
> if (IS_ERR(anx6345->dvdd25)) {
> DRM_ERROR("dvdd25-supply not found\n");
> return PTR_ERR(anx6345->dvdd25);
--
Regards,
Laurent Pinchart
^ permalink raw reply
* Re: [PATCH 1/6] drm/bridge: anx6345: Fix getting anx6345 regulators
From: Laurent Pinchart @ 2020-02-20 13:46 UTC (permalink / raw)
To: Vasily Khoruzhick
Cc: Mark Rutland, Neil Armstrong, David Airlie, dri-devel,
Andrzej Hajda, Thierry Reding, Sam Ravnborg, Stephen Rothwell,
Samuel Holland, Heiko Stuebner, Chen-Yu Tsai, Icenowy Zheng,
Stephan Gerhold, Jonas Karlman, Torsten Duwe, Rob Herring,
Maxime Ripard, linux-arm-kernel, Jernej Skrabec, linux-kernel,
Mark Brown
In-Reply-To: <20200220083508.792071-2-anarsoul@gmail.com>
Hi Vasily,
Thank you for the patch.
On Thu, Feb 20, 2020 at 12:35:03AM -0800, Vasily Khoruzhick wrote:
> From: Samuel Holland <samuel@sholland.org>
>
> We don't need to pass '-supply' suffix to devm_get_regulator()
>
> Fixes: 6aa192698089 ("drm/bridge: Add Analogix anx6345 support")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> index 56f55c53abfd..0d8d083b0207 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> @@ -712,14 +712,14 @@ static int anx6345_i2c_probe(struct i2c_client *client,
> DRM_DEBUG("No panel found\n");
>
> /* 1.2V digital core power regulator */
> - anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12-supply");
> + anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12");
> if (IS_ERR(anx6345->dvdd12)) {
> DRM_ERROR("dvdd12-supply not found\n");
> return PTR_ERR(anx6345->dvdd12);
> }
>
> /* 2.5V digital core power regulator */
> - anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25-supply");
> + anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25");
> if (IS_ERR(anx6345->dvdd25)) {
> DRM_ERROR("dvdd25-supply not found\n");
> return PTR_ERR(anx6345->dvdd25);
--
Regards,
Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* Re: [PATCH rdma-next 1/2] RDMA/ipoib: Don't set constant driver version
From: Leon Romanovsky @ 2020-02-20 13:46 UTC (permalink / raw)
To: Dennis Dalessandro; +Cc: Doug Ledford, Jason Gunthorpe, RDMA mailing list
In-Reply-To: <dc3541f9-720c-7f6c-2073-df5f2b446fa3@intel.com>
On Thu, Feb 20, 2020 at 08:34:00AM -0500, Dennis Dalessandro wrote:
> On 2/20/2020 2:12 AM, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > There is no need to set driver version in in-tree kernel code.
> >
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> > drivers/infiniband/ulp/ipoib/ipoib.h | 2 --
> > drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 3 ---
> > drivers/infiniband/ulp/ipoib/ipoib_main.c | 4 ----
> > 3 files changed, 9 deletions(-)
> >
>
> Same comments as the other patch, can we just remove the field from the
> drvinfo struct altogether.
Ahh, and extra thing.
I put default version in ->version before calling to the driver. It
allows for out-of-tree drivers overwrite that field and continue to
manage their internal versions.
Thanks
>
> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
>
^ permalink raw reply
* [PATCH] jbd2: fix ocfs2 corrupt when clearing block group bits
From: wangyan @ 2020-02-20 13:46 UTC (permalink / raw)
To: jack, tytso; +Cc: linux-ext4, ocfs2-devel@oss.oracle.com, stable, piaojun
I found a NULL pointer dereference in ocfs2_block_group_clear_bits().
The running environment:
kernel version: 4.19
A cluster with two nodes, 5 luns mounted on two nodes, and do some
file operations like dd/fallocate/truncate/rm on every lun with storage
network disconnection.
The fallocate operation on dm-23-45 caused an null pointer dereference.
The information of NULL pointer dereference as follows:
[577992.878282] JBD2: Error -5 detected when updating journal superblock for dm-23-45.
[577992.878290] Aborting journal on device dm-23-45.
...
[577992.890778] JBD2: Error -5 detected when updating journal superblock for dm-24-46.
[577992.890908] __journal_remove_journal_head: freeing b_committed_data
[577992.890916] (fallocate,88392,52):ocfs2_extend_trans:474 ERROR: status = -30
[577992.890918] __journal_remove_journal_head: freeing b_committed_data
[577992.890920] (fallocate,88392,52):ocfs2_rotate_tree_right:2500 ERROR: status = -30
[577992.890922] __journal_remove_journal_head: freeing b_committed_data
[577992.890924] (fallocate,88392,52):ocfs2_do_insert_extent:4382 ERROR: status = -30
[577992.890928] (fallocate,88392,52):ocfs2_insert_extent:4842 ERROR: status = -30
[577992.890928] __journal_remove_journal_head: freeing b_committed_data
[577992.890930] (fallocate,88392,52):ocfs2_add_clusters_in_btree:4947 ERROR: status = -30
[577992.890933] __journal_remove_journal_head: freeing b_committed_data
[577992.890939] __journal_remove_journal_head: freeing b_committed_data
[577992.890949] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
[577992.890950] Mem abort info:
[577992.890951] ESR = 0x96000004
[577992.890952] Exception class = DABT (current EL), IL = 32 bits
[577992.890952] SET = 0, FnV = 0
[577992.890953] EA = 0, S1PTW = 0
[577992.890954] Data abort info:
[577992.890955] ISV = 0, ISS = 0x00000004
[577992.890956] CM = 0, WnR = 0
[577992.890958] user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000f8da07a9
[577992.890960] [0000000000000020] pgd=0000000000000000
[577992.890964] Internal error: Oops: 96000004 [#1] SMP
[577992.890965] Process fallocate (pid: 88392, stack limit = 0x00000000013db2fd)
[577992.890968] CPU: 52 PID: 88392 Comm: fallocate Kdump: loaded Tainted: G W OE 4.19.36 #1
[577992.890969] Hardware name: Huawei TaiShan 2280 V2/BC82AMDD, BIOS 0.98 08/25/2019
[577992.890971] pstate: 60400009 (nZCv daif +PAN -UAO)
[577992.891054] pc : _ocfs2_free_suballoc_bits+0x63c/0x968 [ocfs2]
[577992.891082] lr : _ocfs2_free_suballoc_bits+0x618/0x968 [ocfs2]
[577992.891084] sp : ffff0000c8e2b810
[577992.891085] x29: ffff0000c8e2b820 x28: 0000000000000000
[577992.891087] x27: 00000000000006f3 x26: ffffa07957b02e70
[577992.891089] x25: ffff807c59d50000 x24: 00000000000006f2
[577992.891091] x23: 0000000000000001 x22: ffff807bd39abc30
[577992.891093] x21: ffff0000811d9000 x20: ffffa07535d6a000
[577992.891097] x19: ffff000001681638 x18: ffffffffffffffff
[577992.891098] x17: 0000000000000000 x16: ffff000080a03df0
[577992.891100] x15: ffff0000811d9708 x14: 203d207375746174
[577992.891101] x13: 73203a524f525245 x12: 20373439343a6565
[577992.891103] x11: 0000000000000038 x10: 0101010101010101
[577992.891106] x9 : ffffa07c68a85d70 x8 : 7f7f7f7f7f7f7f7f
[577992.891109] x7 : 0000000000000000 x6 : 0000000000000080
[577992.891110] x5 : 0000000000000000 x4 : 0000000000000002
[577992.891112] x3 : ffff000001713390 x2 : 2ff90f88b1c22f00
[577992.891114] x1 : ffff807bd39abc30 x0 : 0000000000000000
[577992.891116] Call trace:
[577992.891139] _ocfs2_free_suballoc_bits+0x63c/0x968 [ocfs2]
[577992.891162] _ocfs2_free_clusters+0x100/0x290 [ocfs2]
[577992.891185] ocfs2_free_clusters+0x50/0x68 [ocfs2]
[577992.891206] ocfs2_add_clusters_in_btree+0x198/0x5e0 [ocfs2]
[577992.891227] ocfs2_add_inode_data+0x94/0xc8 [ocfs2]
[577992.891248] ocfs2_extend_allocation+0x1bc/0x7a8 [ocfs2]
[577992.891269] ocfs2_allocate_extents+0x14c/0x338 [ocfs2]
[577992.891290] __ocfs2_change_file_space+0x3f8/0x610 [ocfs2]
[577992.891309] ocfs2_fallocate+0xe4/0x128 [ocfs2]
[577992.891316] vfs_fallocate+0x11c/0x250
[577992.891317] ksys_fallocate+0x54/0x88
[577992.891319] __arm64_sys_fallocate+0x28/0x38
[577992.891323] el0_svc_common+0x78/0x130
[577992.891325] el0_svc_handler+0x38/0x78
[577992.891327] el0_svc+0x8/0xc
My analysis process as follows:
ocfs2_fallocate
__ocfs2_change_file_space
ocfs2_allocate_extents
ocfs2_extend_allocation
ocfs2_add_inode_data
ocfs2_add_clusters_in_btree
ocfs2_insert_extent
ocfs2_do_insert_extent
ocfs2_rotate_tree_right
ocfs2_extend_rotate_transaction
ocfs2_extend_trans
jbd2_journal_restart
jbd2__journal_restart
/* handle->h_transaction is NULL,
* is_handle_aborted(handle) is true
*/
handle->h_transaction = NULL;
start_this_handle
return -EROFS;
ocfs2_free_clusters
_ocfs2_free_clusters
_ocfs2_free_suballoc_bits
ocfs2_block_group_clear_bits
ocfs2_journal_access_gd
__ocfs2_journal_access
jbd2_journal_get_undo_access
/* I think jbd2_write_access_granted() will
* return true, because do_get_write_access()
* will return -EROFS.
*/
if (jbd2_write_access_granted(...)) return 0;
do_get_write_access
/* handle->h_transaction is NULL, it will
* return -EROFS here, so do_get_write_access()
* was not called.
*/
if (is_handle_aborted(handle)) return -EROFS;
/* bh2jh(group_bh) is NULL, caused NULL
pointer dereference */
undo_bg = (struct ocfs2_group_desc *)
bh2jh(group_bh)->b_committed_data;
If handle->h_transaction == NULL, then jbd2_write_access_granted()
does not really guarantee that journal_head will stay around,
not even speaking of its b_committed_data. The bh2jh(group_bh)
can be removed after ocfs2_journal_access_gd() and before call
"bh2jh(group_bh)->b_committed_data". So, we should move
is_handle_aborted() check from do_get_write_access() into
jbd2_journal_get_undo_access() and jbd2_journal_get_write_access()
before the call to jbd2_write_access_granted().
Signed-off-by: Yan Wang <wangyan122@huawei.com>
Reviewed-by: Jun Piao <piaojun@huawei.com>
---
fs/jbd2/transaction.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 2dd848a743ed..d181948c0390 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -936,8 +936,6 @@ do_get_write_access(handle_t *handle, struct journal_head *jh,
char *frozen_buffer = NULL;
unsigned long start_lock, time_lock;
- if (is_handle_aborted(handle))
- return -EROFS;
journal = transaction->t_journal;
jbd_debug(5, "journal_head %p, force_copy %d\n", jh, force_copy);
@@ -1189,6 +1187,9 @@ int jbd2_journal_get_write_access(handle_t *handle, struct buffer_head *bh)
struct journal_head *jh;
int rc;
+ if (is_handle_aborted(handle))
+ return -EROFS;
+
if (jbd2_write_access_granted(handle, bh, false))
return 0;
@@ -1326,6 +1327,9 @@ int jbd2_journal_get_undo_access(handle_t *handle, struct buffer_head *bh)
struct journal_head *jh;
char *committed_data = NULL;
+ if (is_handle_aborted(handle))
+ return -EROFS;
+
if (jbd2_write_access_granted(handle, bh, true))
return 0;
--
2.19.1
^ permalink raw reply related
* Re: [dpdk-dev] [PATCH 0/2] net/mlx5: copy the item flags from prefix flow
From: Raslan Darawsheh @ 2020-02-20 13:46 UTC (permalink / raw)
To: Suanming Mou, Slava Ovsiienko, Matan Azrad; +Cc: dev@dpdk.org
In-Reply-To: <AM0PR05MB67078070E1BA534D9A6AFB98C2130@AM0PR05MB6707.eurprd05.prod.outlook.com>
Hi,
Taking this series out of next-net-mlx,
Waiting for a v2, we are seeing a Seg. Fault due to the first patch of this series.
Kindest regards,
Raslan Darawsheh
> -----Original Message-----
> From: Raslan Darawsheh
> Sent: Thursday, February 20, 2020 2:13 PM
> To: Suanming Mou <suanmingm@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; Matan Azrad <matan@mellanox.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH 0/2] net/mlx5: copy the item flags from prefix flow
>
> Hi,
>
> > -----Original Message-----
> > From: Suanming Mou <suanmingm@mellanox.com>
> > Sent: Wednesday, February 19, 2020 4:31 PM
> > To: Slava Ovsiienko <viacheslavo@mellanox.com>; Matan Azrad
> > <matan@mellanox.com>
> > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@mellanox.com>
> > Subject: [PATCH 0/2] net/mlx5: copy the item flags from prefix flow
> >
> > For flow split to several subflows, the match items maybe in the prefix
> > flow, and the actions are split to the suffix flow.
> >
> > In this case, for the actions need the user defined match item will not
> > create correctly.
> >
> > Copy the item layers flags to the suffix flow from prefix flow to fix
> > the issue.
> >
> > This patch series should be applied after:
> >
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch
> >
> es.dpdk.org%2Fproject%2Fdpdk%2Flist%2F%3Fseries%3D8613&data=0
> >
> 2%7C01%7Crasland%40mellanox.com%7C18e60c79e62d40313b6008d7b5485c
> >
> df%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C6371771947191293
> >
> 09&sdata=QE%2FeFbc3rp1m5KgmtmR%2Bfu5%2B2v%2BeBANO1u80R2
> > PdS9A%3D&reserved=0
> >
> > Suanming Mou (2):
> > net/mlx5: fix layer flags missing in metadata
> > net/mlx5: fix lack of match information in meter
> >
> > drivers/net/mlx5/mlx5_flow.c | 41 +++++++++++++++++++-------
> > drivers/net/mlx5/mlx5_flow_dv.c | 64
> > +++++++++++++++++++++++++++++++----------
> > 2 files changed, 79 insertions(+), 26 deletions(-)
> >
> > --
> > 1.8.3.1
>
>
> Series applied to next-net-mlx,
>
> Kindest regards,
> Raslan Darawsheh
^ permalink raw reply
* [Ocfs2-devel] [PATCH] jbd2: fix ocfs2 corrupt when clearing block group bits
From: wangyan @ 2020-02-20 13:46 UTC (permalink / raw)
To: jack, tytso; +Cc: linux-ext4, ocfs2-devel@oss.oracle.com, stable, piaojun
I found a NULL pointer dereference in ocfs2_block_group_clear_bits().
The running environment:
kernel version: 4.19
A cluster with two nodes, 5 luns mounted on two nodes, and do some
file operations like dd/fallocate/truncate/rm on every lun with storage
network disconnection.
The fallocate operation on dm-23-45 caused an null pointer dereference.
The information of NULL pointer dereference as follows:
[577992.878282] JBD2: Error -5 detected when updating journal superblock for dm-23-45.
[577992.878290] Aborting journal on device dm-23-45.
...
[577992.890778] JBD2: Error -5 detected when updating journal superblock for dm-24-46.
[577992.890908] __journal_remove_journal_head: freeing b_committed_data
[577992.890916] (fallocate,88392,52):ocfs2_extend_trans:474 ERROR: status = -30
[577992.890918] __journal_remove_journal_head: freeing b_committed_data
[577992.890920] (fallocate,88392,52):ocfs2_rotate_tree_right:2500 ERROR: status = -30
[577992.890922] __journal_remove_journal_head: freeing b_committed_data
[577992.890924] (fallocate,88392,52):ocfs2_do_insert_extent:4382 ERROR: status = -30
[577992.890928] (fallocate,88392,52):ocfs2_insert_extent:4842 ERROR: status = -30
[577992.890928] __journal_remove_journal_head: freeing b_committed_data
[577992.890930] (fallocate,88392,52):ocfs2_add_clusters_in_btree:4947 ERROR: status = -30
[577992.890933] __journal_remove_journal_head: freeing b_committed_data
[577992.890939] __journal_remove_journal_head: freeing b_committed_data
[577992.890949] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
[577992.890950] Mem abort info:
[577992.890951] ESR = 0x96000004
[577992.890952] Exception class = DABT (current EL), IL = 32 bits
[577992.890952] SET = 0, FnV = 0
[577992.890953] EA = 0, S1PTW = 0
[577992.890954] Data abort info:
[577992.890955] ISV = 0, ISS = 0x00000004
[577992.890956] CM = 0, WnR = 0
[577992.890958] user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000f8da07a9
[577992.890960] [0000000000000020] pgd=0000000000000000
[577992.890964] Internal error: Oops: 96000004 [#1] SMP
[577992.890965] Process fallocate (pid: 88392, stack limit = 0x00000000013db2fd)
[577992.890968] CPU: 52 PID: 88392 Comm: fallocate Kdump: loaded Tainted: G W OE 4.19.36 #1
[577992.890969] Hardware name: Huawei TaiShan 2280 V2/BC82AMDD, BIOS 0.98 08/25/2019
[577992.890971] pstate: 60400009 (nZCv daif +PAN -UAO)
[577992.891054] pc : _ocfs2_free_suballoc_bits+0x63c/0x968 [ocfs2]
[577992.891082] lr : _ocfs2_free_suballoc_bits+0x618/0x968 [ocfs2]
[577992.891084] sp : ffff0000c8e2b810
[577992.891085] x29: ffff0000c8e2b820 x28: 0000000000000000
[577992.891087] x27: 00000000000006f3 x26: ffffa07957b02e70
[577992.891089] x25: ffff807c59d50000 x24: 00000000000006f2
[577992.891091] x23: 0000000000000001 x22: ffff807bd39abc30
[577992.891093] x21: ffff0000811d9000 x20: ffffa07535d6a000
[577992.891097] x19: ffff000001681638 x18: ffffffffffffffff
[577992.891098] x17: 0000000000000000 x16: ffff000080a03df0
[577992.891100] x15: ffff0000811d9708 x14: 203d207375746174
[577992.891101] x13: 73203a524f525245 x12: 20373439343a6565
[577992.891103] x11: 0000000000000038 x10: 0101010101010101
[577992.891106] x9 : ffffa07c68a85d70 x8 : 7f7f7f7f7f7f7f7f
[577992.891109] x7 : 0000000000000000 x6 : 0000000000000080
[577992.891110] x5 : 0000000000000000 x4 : 0000000000000002
[577992.891112] x3 : ffff000001713390 x2 : 2ff90f88b1c22f00
[577992.891114] x1 : ffff807bd39abc30 x0 : 0000000000000000
[577992.891116] Call trace:
[577992.891139] _ocfs2_free_suballoc_bits+0x63c/0x968 [ocfs2]
[577992.891162] _ocfs2_free_clusters+0x100/0x290 [ocfs2]
[577992.891185] ocfs2_free_clusters+0x50/0x68 [ocfs2]
[577992.891206] ocfs2_add_clusters_in_btree+0x198/0x5e0 [ocfs2]
[577992.891227] ocfs2_add_inode_data+0x94/0xc8 [ocfs2]
[577992.891248] ocfs2_extend_allocation+0x1bc/0x7a8 [ocfs2]
[577992.891269] ocfs2_allocate_extents+0x14c/0x338 [ocfs2]
[577992.891290] __ocfs2_change_file_space+0x3f8/0x610 [ocfs2]
[577992.891309] ocfs2_fallocate+0xe4/0x128 [ocfs2]
[577992.891316] vfs_fallocate+0x11c/0x250
[577992.891317] ksys_fallocate+0x54/0x88
[577992.891319] __arm64_sys_fallocate+0x28/0x38
[577992.891323] el0_svc_common+0x78/0x130
[577992.891325] el0_svc_handler+0x38/0x78
[577992.891327] el0_svc+0x8/0xc
My analysis process as follows:
ocfs2_fallocate
__ocfs2_change_file_space
ocfs2_allocate_extents
ocfs2_extend_allocation
ocfs2_add_inode_data
ocfs2_add_clusters_in_btree
ocfs2_insert_extent
ocfs2_do_insert_extent
ocfs2_rotate_tree_right
ocfs2_extend_rotate_transaction
ocfs2_extend_trans
jbd2_journal_restart
jbd2__journal_restart
/* handle->h_transaction is NULL,
* is_handle_aborted(handle) is true
*/
handle->h_transaction = NULL;
start_this_handle
return -EROFS;
ocfs2_free_clusters
_ocfs2_free_clusters
_ocfs2_free_suballoc_bits
ocfs2_block_group_clear_bits
ocfs2_journal_access_gd
__ocfs2_journal_access
jbd2_journal_get_undo_access
/* I think jbd2_write_access_granted() will
* return true, because do_get_write_access()
* will return -EROFS.
*/
if (jbd2_write_access_granted(...)) return 0;
do_get_write_access
/* handle->h_transaction is NULL, it will
* return -EROFS here, so do_get_write_access()
* was not called.
*/
if (is_handle_aborted(handle)) return -EROFS;
/* bh2jh(group_bh) is NULL, caused NULL
pointer dereference */
undo_bg = (struct ocfs2_group_desc *)
bh2jh(group_bh)->b_committed_data;
If handle->h_transaction == NULL, then jbd2_write_access_granted()
does not really guarantee that journal_head will stay around,
not even speaking of its b_committed_data. The bh2jh(group_bh)
can be removed after ocfs2_journal_access_gd() and before call
"bh2jh(group_bh)->b_committed_data". So, we should move
is_handle_aborted() check from do_get_write_access() into
jbd2_journal_get_undo_access() and jbd2_journal_get_write_access()
before the call to jbd2_write_access_granted().
Signed-off-by: Yan Wang <wangyan122@huawei.com>
Reviewed-by: Jun Piao <piaojun@huawei.com>
---
fs/jbd2/transaction.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 2dd848a743ed..d181948c0390 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -936,8 +936,6 @@ do_get_write_access(handle_t *handle, struct journal_head *jh,
char *frozen_buffer = NULL;
unsigned long start_lock, time_lock;
- if (is_handle_aborted(handle))
- return -EROFS;
journal = transaction->t_journal;
jbd_debug(5, "journal_head %p, force_copy %d\n", jh, force_copy);
@@ -1189,6 +1187,9 @@ int jbd2_journal_get_write_access(handle_t *handle, struct buffer_head *bh)
struct journal_head *jh;
int rc;
+ if (is_handle_aborted(handle))
+ return -EROFS;
+
if (jbd2_write_access_granted(handle, bh, false))
return 0;
@@ -1326,6 +1327,9 @@ int jbd2_journal_get_undo_access(handle_t *handle, struct buffer_head *bh)
struct journal_head *jh;
char *committed_data = NULL;
+ if (is_handle_aborted(handle))
+ return -EROFS;
+
if (jbd2_write_access_granted(handle, bh, true))
return 0;
--
2.19.1
^ permalink raw reply related
* Re: [PATCH] NFS: Don't hard-code the fs_type when submounting
From: Patrick Steinhardt @ 2020-02-20 13:46 UTC (permalink / raw)
To: Scott Mayhew; +Cc: trond.myklebust, anna.schumaker, dhowells, linux-nfs
In-Reply-To: <20200220130620.3547817-1-smayhew@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1452 bytes --]
On Thu, Feb 20, 2020 at 08:06:20AM -0500, Scott Mayhew wrote:
> Hard-coding the fstype causes "nfs4" mounts to appear as "nfs",
> which breaks scripts that do "umount -at nfs4".
>
> Reported-by: Patrick Steinhardt <ps@pks.im>
> Fixes: f2aedb713c28 ("NFS: Add fs_context support.")
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
> ---
> fs/nfs/namespace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
> index ad6077404947..f3ece8ed3203 100644
> --- a/fs/nfs/namespace.c
> +++ b/fs/nfs/namespace.c
> @@ -153,7 +153,7 @@ struct vfsmount *nfs_d_automount(struct path *path)
> /* Open a new filesystem context, transferring parameters from the
> * parent superblock, including the network namespace.
> */
> - fc = fs_context_for_submount(&nfs_fs_type, path->dentry);
> + fc = fs_context_for_submount(path->mnt->mnt_sb->s_type, path->dentry);
> if (IS_ERR(fc))
> return ERR_CAST(fc);
Thanks for your fix! While this fixes the fstype with mount.nfs4(8),
it still doesn't work when using mount(8):
$ sudo mount server:/mnt /mnt && findmnt -n -ofstype /mnt
nfs
$ sudo umount /mnt
$ sudo mount.nfs4 server:/mnt /mnt && findmnt -n -ofstype /mnt
nfs4
I guess the issue is that the kernel doesn't yet know which NFS version
the server provides at the point where `fs_context_for_submount()` is
called.
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH rdma-next 2/2] RDMA/opa_vnic: Delete driver version
From: Leon Romanovsky @ 2020-02-20 13:44 UTC (permalink / raw)
To: Dennis Dalessandro; +Cc: Doug Ledford, Jason Gunthorpe, RDMA mailing list
In-Reply-To: <a5b477e5-1c2b-055b-b617-76351b290adf@intel.com>
On Thu, Feb 20, 2020 at 08:32:35AM -0500, Dennis Dalessandro wrote:
> On 2/20/2020 2:12 AM, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > The default version provided by "ethtool -i" it the correct way
> > to identify Driver version. There is no need to overwrite it.
> >
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> > drivers/infiniband/ulp/opa_vnic/opa_vnic_ethtool.c | 2 --
> > drivers/infiniband/ulp/opa_vnic/opa_vnic_internal.h | 1 -
> > drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c | 5 -----
> > 3 files changed, 8 deletions(-)
> >
> > diff --git a/drivers/infiniband/ulp/opa_vnic/opa_vnic_ethtool.c b/drivers/infiniband/ulp/opa_vnic/opa_vnic_ethtool.c
> > index 8ad7da989a0e..42d557dff19d 100644
> > --- a/drivers/infiniband/ulp/opa_vnic/opa_vnic_ethtool.c
> > +++ b/drivers/infiniband/ulp/opa_vnic/opa_vnic_ethtool.c
> > @@ -125,8 +125,6 @@ static void vnic_get_drvinfo(struct net_device *netdev,
> > struct ethtool_drvinfo *drvinfo)
> > {
> > strlcpy(drvinfo->driver, opa_vnic_driver_name, sizeof(drvinfo->driver));
> > - strlcpy(drvinfo->version, opa_vnic_driver_version,
> > - sizeof(drvinfo->version));
> > strlcpy(drvinfo->bus_info, dev_name(netdev->dev.parent),
> > sizeof(drvinfo->bus_info));
> > }
>
> Is there a patch series to get rid of drvinfo->version? Seems to me if we
> don't want drivers to set it then we don't need it to begin with do we?
Unfortunately struct ethtool_drvinfo is defined in include/uapi/linux/ethtool.h
and we can't change it without breaking ethtool.
My WIP in progress branch (based on net-next) is located here:
https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/log/?h=ethtool
At the end of my journey, we will have checkpatch.pl patch and update of
coding style.
>
> Regardless I don't have any objections to the patch. We've been down this
> road with version numbers and I believe this was added to vnic specifically
> to fill in something for ethtool.
And now, you will be able to see real version :)
>
> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Thanks
>
> -Denny
^ permalink raw reply
* Re: [PATCH v3 02/20] hw: Remove unnecessary cast when calling dma_memory_read()
From: Philippe Mathieu-Daudé @ 2020-02-20 13:43 UTC (permalink / raw)
To: Eric Blake, Peter Maydell, qemu-devel
Cc: Fam Zheng, Dmitry Fleytman, Matthew Rosato, Michael S. Tsirkin,
Jason Wang, Gerd Hoffmann, Edgar E. Iglesias, Stefano Stabellini,
kvm, qemu-block, David Hildenbrand, Halil Pasic,
Christian Borntraeger, Hervé Poussineau, Anthony Perard,
xen-devel, Aleksandar Rikalo, David Gibson, Laurent Vivier,
Thomas Huth, Eduardo Habkost, Stefan Weil, Alistair Francis,
Richard Henderson, Paul Durrant, Eric Auger, qemu-s390x, qemu-arm,
Cédric Le Goater, John Snow, Richard Henderson,
Igor Mitsyanko, Cornelia Huck, Michael Walle, qemu-ppc,
Paolo Bonzini
In-Reply-To: <68120807-6f6b-1602-8208-fd76d64e74bc@redhat.com>
On 2/20/20 2:16 PM, Eric Blake wrote:
> On 2/20/20 7:05 AM, Philippe Mathieu-Daudé wrote:
>> Since its introduction in commit d86a77f8abb, dma_memory_read()
>> always accepted void pointer argument. Remove the unnecessary
>> casts.
>>
>> This commit was produced with the included Coccinelle script
>> scripts/coccinelle/exec_rw_const.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> scripts/coccinelle/exec_rw_const.cocci | 15 +++++++++++++++
>> hw/arm/smmu-common.c | 3 +--
>> hw/arm/smmuv3.c | 10 ++++------
>> hw/sd/sdhci.c | 15 +++++----------
>> 4 files changed, 25 insertions(+), 18 deletions(-)
>> create mode 100644 scripts/coccinelle/exec_rw_const.cocci
>>
>> diff --git a/scripts/coccinelle/exec_rw_const.cocci
>> b/scripts/coccinelle/exec_rw_const.cocci
>> new file mode 100644
>> index 0000000000..a0054f009d
>> --- /dev/null
>> +++ b/scripts/coccinelle/exec_rw_const.cocci
>> @@ -0,0 +1,15 @@
>> +// Usage:
>> +// spatch --sp-file scripts/coccinelle/exec_rw_const.cocci --dir .
>> --in-place
>
> This command line should also use '--macro-file
> scripts/cocci-macro-file.h' to cover more of the code base (Coccinelle
> skips portions of the code that uses macros it doesn't recognize).
>
>
>> @@ -726,13 +724,10 @@ static void get_adma_description(SDHCIState *s,
>> ADMADescr *dscr)
>> }
>> break;
>> case SDHC_CTRL_ADMA2_64:
>> - dma_memory_read(s->dma_as, entry_addr,
>> - (uint8_t *)(&dscr->attr), 1);
>> - dma_memory_read(s->dma_as, entry_addr + 2,
>> - (uint8_t *)(&dscr->length), 2);
>> + dma_memory_read(s->dma_as, entry_addr, (&dscr->attr), 1);
>> + dma_memory_read(s->dma_as, entry_addr + 2, (&dscr->length), 2);
>
> The () around &dscr->length are now pointless.
Thanks Eric, patch updated. Peter are you OK if I change the cocci
header using /* */ as:
-- >8 --
diff --git a/scripts/coccinelle/exec_rw_const.cocci
b/scripts/coccinelle/exec_rw_const.cocci
index a0054f009d..7e42682240 100644
--- a/scripts/coccinelle/exec_rw_const.cocci
+++ b/scripts/coccinelle/exec_rw_const.cocci
@@ -1,5 +1,13 @@
-// Usage:
-// spatch --sp-file scripts/coccinelle/exec_rw_const.cocci --dir .
--in-place
+/*
+ Usage:
+
+ spatch \
+ --macro-file scripts/cocci-macro-file.h \
+ --sp-file scripts/coccinelle/exec_rw_const.cocci \
+ --keep-comments \
+ --in-place \
+ --dir .
+*/
// Remove useless cast
@@
@@ -7,9 +15,9 @@ expression E1, E2, E3, E4;
type T;
@@
(
-- dma_memory_read(E1, E2, (T *)E3, E4)
+- dma_memory_read(E1, E2, (T *)(E3), E4)
+ dma_memory_read(E1, E2, E3, E4)
|
-- dma_memory_write(E1, E2, (T *)E3, E4)
+- dma_memory_write(E1, E2, (T *)(E3), E4)
+ dma_memory_write(E1, E2, E3, E4)
)
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index d5abdaad41..de63ffb037 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -724,10 +724,10 @@ static void get_adma_description(SDHCIState *s,
ADMADescr *dscr)
}
break;
case SDHC_CTRL_ADMA2_64:
- dma_memory_read(s->dma_as, entry_addr, (&dscr->attr), 1);
- dma_memory_read(s->dma_as, entry_addr + 2, (&dscr->length), 2);
+ dma_memory_read(s->dma_as, entry_addr, &dscr->attr, 1);
+ dma_memory_read(s->dma_as, entry_addr + 2, &dscr->length, 2);
dscr->length = le16_to_cpu(dscr->length);
- dma_memory_read(s->dma_as, entry_addr + 4, (&dscr->addr), 8);
+ dma_memory_read(s->dma_as, entry_addr + 4, &dscr->addr, 8);
dscr->addr = le64_to_cpu(dscr->addr);
dscr->attr &= (uint8_t) ~0xC0;
dscr->incr = 12;
---
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.