All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH net-next v4 2/8] net/fungible: Add service module for Fungible drivers
From: Jakub Kicinski @ 2022-01-05 17:32 UTC (permalink / raw)
  To: Dimitris Michailidis; +Cc: davem, netdev, Andrew Lunn
In-Reply-To: <CAOkoqZmom=Yqxq7FkF=3oBrtd+0BenZZMES3nvUxf2b3CCiyfg@mail.gmail.com>

On Tue, 4 Jan 2022 22:12:35 -0800 Dimitris Michailidis wrote:
> On Tue, Jan 4, 2022 at 8:49 PM Dimitris Michailidis
> > On Tue, Jan 4, 2022 at 6:10 PM Jakub Kicinski <kuba@kernel.org> wrote:  
> > > CHECK: Unnecessary parentheses around 'fdev->admin_q->rq_depth > 0'
> > > #630: FILE: drivers/net/ethernet/fungible/funcore/fun_dev.c:584:
> > > +       if (cq_count < 2 || sq_count < 2 + (fdev->admin_q->rq_depth > 0))  
> >
> > I saw this one but checkpatch misunderstands this expression.
> > There are different equivalent expressions that wouldn't have them
> > but this one needs them.  
> 
> What I wrote is probably unclear. By 'them' I meant the parentheses.

I see, perhaps it's better written as:

	if (cq_count < 2 || sq_count < 2 + !!fdev->admin_q->rq_depth)

^ permalink raw reply

* [PATCH v2] drm/dp: Fix off-by-one in register cache size
From: Kees Cook @ 2022-01-05 17:33 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: Kees Cook, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Daniel Vetter, dri-devel, stable, Gustavo A . R . Silva,
	Uma Shankar, Jani Nikula, Ankit Nautiyal, linux-kernel,
	linux-hardening

The pcon_dsc_dpcd array holds 13 registers (0x92 through 0x9E). Fix the
math to calculate the max size. Found from a -Warray-bounds build:

drivers/gpu/drm/drm_dp_helper.c: In function 'drm_dp_pcon_dsc_bpp_incr':
drivers/gpu/drm/drm_dp_helper.c:3130:28: error: array subscript 12 is outside array bounds of 'const u8[12]' {aka 'const unsigned char[12]'} [-Werror=array-bounds]
 3130 |         buf = pcon_dsc_dpcd[DP_PCON_DSC_BPP_INCR - DP_PCON_DSC_ENCODER];
      |               ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/drm_dp_helper.c:3126:39: note: while referencing 'pcon_dsc_dpcd'
 3126 | int drm_dp_pcon_dsc_bpp_incr(const u8 pcon_dsc_dpcd[DP_PCON_DSC_ENCODER_CAP_SIZE])
      |                              ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Fixes: e2e16da398d9 ("drm/dp_helper: Add support for Configuring DSC for HDMI2.1 Pcon")
Cc: stable@vger.kernel.org
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/lkml/20211214001849.GA62559@embeddedor/
Signed-off-by: Kees Cook <keescook@chromium.org>
---
v1: https://lore.kernel.org/lkml/20211203084333.3105038-1-keescook@chromium.org/
v2:
 - add reviewed-by
 - add cc:stable
---
 include/drm/drm_dp_helper.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 30359e434c3f..472dac376284 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -456,7 +456,7 @@ struct drm_panel;
 #define DP_FEC_CAPABILITY_1			0x091   /* 2.0 */
 
 /* DP-HDMI2.1 PCON DSC ENCODER SUPPORT */
-#define DP_PCON_DSC_ENCODER_CAP_SIZE        0xC	/* 0x9E - 0x92 */
+#define DP_PCON_DSC_ENCODER_CAP_SIZE        0xD	/* 0x92 through 0x9E */
 #define DP_PCON_DSC_ENCODER                 0x092
 # define DP_PCON_DSC_ENCODER_SUPPORTED      (1 << 0)
 # define DP_PCON_DSC_PPS_ENC_OVERRIDE       (1 << 1)
-- 
2.30.2


^ permalink raw reply related

* [PATCH v2] drm/dp: Fix off-by-one in register cache size
From: Kees Cook @ 2022-01-05 17:33 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: David Airlie, Gustavo A . R . Silva, dri-devel, linux-kernel,
	Jani Nikula, Uma Shankar, linux-hardening, Thomas Zimmermann,
	stable, Ankit Nautiyal, Kees Cook

The pcon_dsc_dpcd array holds 13 registers (0x92 through 0x9E). Fix the
math to calculate the max size. Found from a -Warray-bounds build:

drivers/gpu/drm/drm_dp_helper.c: In function 'drm_dp_pcon_dsc_bpp_incr':
drivers/gpu/drm/drm_dp_helper.c:3130:28: error: array subscript 12 is outside array bounds of 'const u8[12]' {aka 'const unsigned char[12]'} [-Werror=array-bounds]
 3130 |         buf = pcon_dsc_dpcd[DP_PCON_DSC_BPP_INCR - DP_PCON_DSC_ENCODER];
      |               ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/drm_dp_helper.c:3126:39: note: while referencing 'pcon_dsc_dpcd'
 3126 | int drm_dp_pcon_dsc_bpp_incr(const u8 pcon_dsc_dpcd[DP_PCON_DSC_ENCODER_CAP_SIZE])
      |                              ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Fixes: e2e16da398d9 ("drm/dp_helper: Add support for Configuring DSC for HDMI2.1 Pcon")
Cc: stable@vger.kernel.org
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/lkml/20211214001849.GA62559@embeddedor/
Signed-off-by: Kees Cook <keescook@chromium.org>
---
v1: https://lore.kernel.org/lkml/20211203084333.3105038-1-keescook@chromium.org/
v2:
 - add reviewed-by
 - add cc:stable
---
 include/drm/drm_dp_helper.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 30359e434c3f..472dac376284 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -456,7 +456,7 @@ struct drm_panel;
 #define DP_FEC_CAPABILITY_1			0x091   /* 2.0 */
 
 /* DP-HDMI2.1 PCON DSC ENCODER SUPPORT */
-#define DP_PCON_DSC_ENCODER_CAP_SIZE        0xC	/* 0x9E - 0x92 */
+#define DP_PCON_DSC_ENCODER_CAP_SIZE        0xD	/* 0x92 through 0x9E */
 #define DP_PCON_DSC_ENCODER                 0x092
 # define DP_PCON_DSC_ENCODER_SUPPORTED      (1 << 0)
 # define DP_PCON_DSC_PPS_ENC_OVERRIDE       (1 << 1)
-- 
2.30.2


^ permalink raw reply related

* Re: [PATCH v2] drm/bridge: parade-ps8640: Link device to ensure suspend/resume order
From: Robert Foss @ 2022-01-05 17:33 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: jonas, airlied, dri-devel, narmstrong, linux-kernel,
	jernej.skrabec, a.hajda, laurent.pinchart, kernel
In-Reply-To: <20220105090802.73564-1-angelogioacchino.delregno@collabora.com>

On Wed, 5 Jan 2022 at 10:08, AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Entering suspend while the display attached to this bridge is still on
> makes the resume sequence to resume the bridge first, display last:
> when this happens, we get a timeout while resuming the bridge, as its
> MCU will get stuck due to the display being unpowered.
>
> On the other hand, on mt8173-elm, closing the lid makes the display to
> get powered off first, bridge last, so at resume time the sequence is
> swapped (compared to the first example) and everything just works
> as expected.
>
> Add a stateless device link to the DRM device that this bridge belongs
> to, ensuring a correct resume sequence and solving the unability to
> correctly resume bridge operation in the first mentioned example.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/bridge/parade-ps8640.c | 27 ++++++++++++++++++++++++--
>  1 file changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c
> index 818704bf5e86..450bc9bdf295 100644
> --- a/drivers/gpu/drm/bridge/parade-ps8640.c
> +++ b/drivers/gpu/drm/bridge/parade-ps8640.c
> @@ -102,6 +102,7 @@ struct ps8640 {
>         struct regulator_bulk_data supplies[2];
>         struct gpio_desc *gpio_reset;
>         struct gpio_desc *gpio_powerdown;
> +       struct device_link *link;
>         bool pre_enabled;
>  };
>
> @@ -456,14 +457,36 @@ static int ps8640_bridge_attach(struct drm_bridge *bridge,
>                 return ret;
>         }
>
> +       ps_bridge->link = device_link_add(bridge->dev->dev, dev, DL_FLAG_STATELESS);
> +       if (!ps_bridge->link) {
> +               dev_err(dev, "failed to create device link");
> +               ret = -EINVAL;
> +               goto err_devlink;
> +       }
> +
>         /* Attach the panel-bridge to the dsi bridge */
> -       return drm_bridge_attach(bridge->encoder, ps_bridge->panel_bridge,
> +       ret = drm_bridge_attach(bridge->encoder, ps_bridge->panel_bridge,
>                                  &ps_bridge->bridge, flags);

Bad alignment according to checkpatch --strict

> +       if (ret)
> +               goto err_bridge_attach;
> +
> +       return 0;
> +
> +err_bridge_attach:
> +       device_link_del(ps_bridge->link);
> +err_devlink:
> +       drm_dp_aux_unregister(&ps_bridge->aux);
> +
> +       return ret;
>  }
>
>  static void ps8640_bridge_detach(struct drm_bridge *bridge)
>  {
> -       drm_dp_aux_unregister(&bridge_to_ps8640(bridge)->aux);
> +       struct ps8640 *ps_bridge = bridge_to_ps8640(bridge);
> +
> +       drm_dp_aux_unregister(&ps_bridge->aux);
> +       if (ps_bridge->link)
> +               device_link_del(ps_bridge->link);
>  }
>
>  static struct edid *ps8640_bridge_get_edid(struct drm_bridge *bridge,
> --
> 2.33.1
>

Fixed alignment issue, applied to drm-misc-next and added r-b tag.

Reviewed-by: Robert Foss <robert.foss@linaro.org>

^ permalink raw reply

* Re: [PATCH v2] drm/bridge: parade-ps8640: Link device to ensure suspend/resume order
From: Robert Foss @ 2022-01-05 17:33 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: a.hajda, narmstrong, laurent.pinchart, jonas, jernej.skrabec,
	airlied, daniel, dri-devel, kernel, linux-kernel
In-Reply-To: <20220105090802.73564-1-angelogioacchino.delregno@collabora.com>

On Wed, 5 Jan 2022 at 10:08, AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Entering suspend while the display attached to this bridge is still on
> makes the resume sequence to resume the bridge first, display last:
> when this happens, we get a timeout while resuming the bridge, as its
> MCU will get stuck due to the display being unpowered.
>
> On the other hand, on mt8173-elm, closing the lid makes the display to
> get powered off first, bridge last, so at resume time the sequence is
> swapped (compared to the first example) and everything just works
> as expected.
>
> Add a stateless device link to the DRM device that this bridge belongs
> to, ensuring a correct resume sequence and solving the unability to
> correctly resume bridge operation in the first mentioned example.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/bridge/parade-ps8640.c | 27 ++++++++++++++++++++++++--
>  1 file changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c
> index 818704bf5e86..450bc9bdf295 100644
> --- a/drivers/gpu/drm/bridge/parade-ps8640.c
> +++ b/drivers/gpu/drm/bridge/parade-ps8640.c
> @@ -102,6 +102,7 @@ struct ps8640 {
>         struct regulator_bulk_data supplies[2];
>         struct gpio_desc *gpio_reset;
>         struct gpio_desc *gpio_powerdown;
> +       struct device_link *link;
>         bool pre_enabled;
>  };
>
> @@ -456,14 +457,36 @@ static int ps8640_bridge_attach(struct drm_bridge *bridge,
>                 return ret;
>         }
>
> +       ps_bridge->link = device_link_add(bridge->dev->dev, dev, DL_FLAG_STATELESS);
> +       if (!ps_bridge->link) {
> +               dev_err(dev, "failed to create device link");
> +               ret = -EINVAL;
> +               goto err_devlink;
> +       }
> +
>         /* Attach the panel-bridge to the dsi bridge */
> -       return drm_bridge_attach(bridge->encoder, ps_bridge->panel_bridge,
> +       ret = drm_bridge_attach(bridge->encoder, ps_bridge->panel_bridge,
>                                  &ps_bridge->bridge, flags);

Bad alignment according to checkpatch --strict

> +       if (ret)
> +               goto err_bridge_attach;
> +
> +       return 0;
> +
> +err_bridge_attach:
> +       device_link_del(ps_bridge->link);
> +err_devlink:
> +       drm_dp_aux_unregister(&ps_bridge->aux);
> +
> +       return ret;
>  }
>
>  static void ps8640_bridge_detach(struct drm_bridge *bridge)
>  {
> -       drm_dp_aux_unregister(&bridge_to_ps8640(bridge)->aux);
> +       struct ps8640 *ps_bridge = bridge_to_ps8640(bridge);
> +
> +       drm_dp_aux_unregister(&ps_bridge->aux);
> +       if (ps_bridge->link)
> +               device_link_del(ps_bridge->link);
>  }
>
>  static struct edid *ps8640_bridge_get_edid(struct drm_bridge *bridge,
> --
> 2.33.1
>

Fixed alignment issue, applied to drm-misc-next and added r-b tag.

Reviewed-by: Robert Foss <robert.foss@linaro.org>

^ permalink raw reply

* [bug] GNOME loses all settings following failure to resume from suspend
From: Chris Murphy @ 2022-01-05 17:34 UTC (permalink / raw)
  To: Btrfs BTRFS; +Cc: Josef Bacik

https://gitlab.gnome.org/GNOME/dconf/-/issues/73

Following a crash, instead of either the old or new dconf database
file being present, a corrupt one is present.

dconf uses g_file_set_contents() to atomically update the database
file, which effectively inhibits (one or more?) fsync's, yet somehow
in the crash/powerfail case this is resulting in a corrupt dconf
database. I don't know if by "corrupt" this is a 0 length file or some
other effect.

Thanks,

-- 
Chris Murphy

^ permalink raw reply

* [PATCH] drm/dp: Remove common Post Cursor2 register handling
From: Kees Cook @ 2022-01-05 17:35 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: David Airlie, linux-kernel, dri-devel, Jonathan Hunter,
	Thierry Reding, linux-hardening, Thomas Zimmermann, linux-tegra,
	Kees Cook

The link_status array was not large enough to read the Adjust Request
Post Cursor2 register, so remove the common helper function to avoid
an OOB read, found with a -Warray-bounds build:

drivers/gpu/drm/drm_dp_helper.c: In function 'drm_dp_get_adjust_request_post_cursor':
drivers/gpu/drm/drm_dp_helper.c:59:27: error: array subscript 10 is outside array bounds of 'const u8[6]' {aka 'const unsigned char[6]'} [-Werror=array-bounds]
   59 |         return link_status[r - DP_LANE0_1_STATUS];
      |                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/drm_dp_helper.c:147:51: note: while referencing 'link_status'
  147 | u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE],
      |                                          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Replace the only user of the helper with an open-coded fetch and decode,
similar to drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c.

Fixes: 79465e0ffeb9 ("drm/dp: Add helper to get post-cursor adjustments")
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
This is the alternative to:
https://lore.kernel.org/lkml/20211203084354.3105253-1-keescook@chromium.org/
---
 drivers/gpu/drm/drm_dp_helper.c | 10 ----------
 drivers/gpu/drm/tegra/dp.c      | 11 ++++++++++-
 include/drm/drm_dp_helper.h     |  2 --
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 23f9073bc473..c9528aa62c9c 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -144,16 +144,6 @@ u8 drm_dp_get_adjust_tx_ffe_preset(const u8 link_status[DP_LINK_STATUS_SIZE],
 }
 EXPORT_SYMBOL(drm_dp_get_adjust_tx_ffe_preset);
 
-u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE],
-					 unsigned int lane)
-{
-	unsigned int offset = DP_ADJUST_REQUEST_POST_CURSOR2;
-	u8 value = dp_link_status(link_status, offset);
-
-	return (value >> (lane << 1)) & 0x3;
-}
-EXPORT_SYMBOL(drm_dp_get_adjust_request_post_cursor);
-
 static int __8b10b_clock_recovery_delay_us(const struct drm_dp_aux *aux, u8 rd_interval)
 {
 	if (rd_interval > 4)
diff --git a/drivers/gpu/drm/tegra/dp.c b/drivers/gpu/drm/tegra/dp.c
index 70dfb7d1dec5..f5535eb04c6b 100644
--- a/drivers/gpu/drm/tegra/dp.c
+++ b/drivers/gpu/drm/tegra/dp.c
@@ -549,6 +549,15 @@ static void drm_dp_link_get_adjustments(struct drm_dp_link *link,
 {
 	struct drm_dp_link_train_set *adjust = &link->train.adjust;
 	unsigned int i;
+	u8 post_cursor;
+	int err;
+
+	err = drm_dp_dpcd_read(link->aux, DP_ADJUST_REQUEST_POST_CURSOR2,
+			       &post_cursor, sizeof(post_cursor));
+	if (err < 0) {
+		DRM_ERROR("failed to read post_cursor2: %d\n", err);
+		post_cursor = 0;
+	}
 
 	for (i = 0; i < link->lanes; i++) {
 		adjust->voltage_swing[i] =
@@ -560,7 +569,7 @@ static void drm_dp_link_get_adjustments(struct drm_dp_link *link,
 				DP_TRAIN_PRE_EMPHASIS_SHIFT;
 
 		adjust->post_cursor[i] =
-			drm_dp_get_adjust_request_post_cursor(status, i);
+			(post_cursor >> (i << 1)) & 0x3;
 	}
 }
 
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 472dac376284..fdf3cf6ccc02 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -1528,8 +1528,6 @@ u8 drm_dp_get_adjust_request_pre_emphasis(const u8 link_status[DP_LINK_STATUS_SI
 					  int lane);
 u8 drm_dp_get_adjust_tx_ffe_preset(const u8 link_status[DP_LINK_STATUS_SIZE],
 				   int lane);
-u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE],
-					 unsigned int lane);
 
 #define DP_BRANCH_OUI_HEADER_SIZE	0xc
 #define DP_RECEIVER_CAP_SIZE		0xf
-- 
2.30.2


^ permalink raw reply related

* [PATCH] drm/dp: Remove common Post Cursor2 register handling
From: Kees Cook @ 2022-01-05 17:35 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: Kees Cook, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Daniel Vetter, dri-devel, Jani Nikula, Thierry Reding,
	Jonathan Hunter, Philipp Zabel, Lyude Paul, linux-kernel,
	linux-tegra, linux-hardening

The link_status array was not large enough to read the Adjust Request
Post Cursor2 register, so remove the common helper function to avoid
an OOB read, found with a -Warray-bounds build:

drivers/gpu/drm/drm_dp_helper.c: In function 'drm_dp_get_adjust_request_post_cursor':
drivers/gpu/drm/drm_dp_helper.c:59:27: error: array subscript 10 is outside array bounds of 'const u8[6]' {aka 'const unsigned char[6]'} [-Werror=array-bounds]
   59 |         return link_status[r - DP_LANE0_1_STATUS];
      |                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/drm_dp_helper.c:147:51: note: while referencing 'link_status'
  147 | u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE],
      |                                          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Replace the only user of the helper with an open-coded fetch and decode,
similar to drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c.

Fixes: 79465e0ffeb9 ("drm/dp: Add helper to get post-cursor adjustments")
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
This is the alternative to:
https://lore.kernel.org/lkml/20211203084354.3105253-1-keescook@chromium.org/
---
 drivers/gpu/drm/drm_dp_helper.c | 10 ----------
 drivers/gpu/drm/tegra/dp.c      | 11 ++++++++++-
 include/drm/drm_dp_helper.h     |  2 --
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 23f9073bc473..c9528aa62c9c 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -144,16 +144,6 @@ u8 drm_dp_get_adjust_tx_ffe_preset(const u8 link_status[DP_LINK_STATUS_SIZE],
 }
 EXPORT_SYMBOL(drm_dp_get_adjust_tx_ffe_preset);
 
-u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE],
-					 unsigned int lane)
-{
-	unsigned int offset = DP_ADJUST_REQUEST_POST_CURSOR2;
-	u8 value = dp_link_status(link_status, offset);
-
-	return (value >> (lane << 1)) & 0x3;
-}
-EXPORT_SYMBOL(drm_dp_get_adjust_request_post_cursor);
-
 static int __8b10b_clock_recovery_delay_us(const struct drm_dp_aux *aux, u8 rd_interval)
 {
 	if (rd_interval > 4)
diff --git a/drivers/gpu/drm/tegra/dp.c b/drivers/gpu/drm/tegra/dp.c
index 70dfb7d1dec5..f5535eb04c6b 100644
--- a/drivers/gpu/drm/tegra/dp.c
+++ b/drivers/gpu/drm/tegra/dp.c
@@ -549,6 +549,15 @@ static void drm_dp_link_get_adjustments(struct drm_dp_link *link,
 {
 	struct drm_dp_link_train_set *adjust = &link->train.adjust;
 	unsigned int i;
+	u8 post_cursor;
+	int err;
+
+	err = drm_dp_dpcd_read(link->aux, DP_ADJUST_REQUEST_POST_CURSOR2,
+			       &post_cursor, sizeof(post_cursor));
+	if (err < 0) {
+		DRM_ERROR("failed to read post_cursor2: %d\n", err);
+		post_cursor = 0;
+	}
 
 	for (i = 0; i < link->lanes; i++) {
 		adjust->voltage_swing[i] =
@@ -560,7 +569,7 @@ static void drm_dp_link_get_adjustments(struct drm_dp_link *link,
 				DP_TRAIN_PRE_EMPHASIS_SHIFT;
 
 		adjust->post_cursor[i] =
-			drm_dp_get_adjust_request_post_cursor(status, i);
+			(post_cursor >> (i << 1)) & 0x3;
 	}
 }
 
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 472dac376284..fdf3cf6ccc02 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -1528,8 +1528,6 @@ u8 drm_dp_get_adjust_request_pre_emphasis(const u8 link_status[DP_LINK_STATUS_SI
 					  int lane);
 u8 drm_dp_get_adjust_tx_ffe_preset(const u8 link_status[DP_LINK_STATUS_SIZE],
 				   int lane);
-u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE],
-					 unsigned int lane);
 
 #define DP_BRANCH_OUI_HEADER_SIZE	0xc
 #define DP_RECEIVER_CAP_SIZE		0xf
-- 
2.30.2


^ permalink raw reply related

* stable/linux-4.9.y baseline: 132 runs, 1 regressions (v4.9.296)
From: kernelci.org bot @ 2022-01-05 17:36 UTC (permalink / raw)
  To: stable, kernel-build-reports, kernelci-results

stable/linux-4.9.y baseline: 132 runs, 1 regressions (v4.9.296)

Regressions Summary
-------------------

platform | arch | lab           | compiler | defconfig           | regressions
---------+------+---------------+----------+---------------------+------------
panda    | arm  | lab-collabora | gcc-10   | omap2plus_defconfig | 1          

  Details:  https://kernelci.org/test/job/stable/branch/linux-4.9.y/kernel/v4.9.296/plan/baseline/

  Test:     baseline
  Tree:     stable
  Branch:   linux-4.9.y
  Describe: v4.9.296
  URL:      https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
  SHA:      710bf39c7aec32641ea63f6593db1df8c3e4a4d7 


Test Regressions
---------------- 


platform | arch | lab           | compiler | defconfig           | regressions
---------+------+---------------+----------+---------------------+------------
panda    | arm  | lab-collabora | gcc-10   | omap2plus_defconfig | 1          

  Details:     https://kernelci.org/test/plan/id/61d5a27d47c1a58a8cef676d

  Results:     4 PASS, 1 FAIL, 1 SKIP
  Full config: omap2plus_defconfig
  Compiler:    gcc-10 (arm-linux-gnueabihf-gcc (Debian 10.2.1-6) 10.2.1 20210110)
  Plain log:   https://storage.kernelci.org//stable/linux-4.9.y/v4.9.296/arm/omap2plus_defconfig/gcc-10/lab-collabora/baseline-panda.txt
  HTML log:    https://storage.kernelci.org//stable/linux-4.9.y/v4.9.296/arm/omap2plus_defconfig/gcc-10/lab-collabora/baseline-panda.html
  Rootfs:      http://storage.kernelci.org/images/rootfs/buildroot/buildroot-baseline/20211210.0/armel/rootfs.cpio.gz 


  * baseline.dmesg.emerg: https://kernelci.org/test/case/id/61d5a27d47c1a58a8cef6770
        failing since 22 days (last pass: v4.9.292, first fail: v4.9.293)
        2 lines

    2022-01-05T13:51:41.284165  [   19.857482] smsc95xx 3-1.1:1.0 eth0: register 'smsc95xx' at usb-4a064c00.ehci-1.1, smsc95xx USB 2.0 Ethernet, 4e:54:52:57:10:6a
    2022-01-05T13:51:41.290782  [   19.858367] usbcore: registered new interface driver smsc95xx
    2022-01-05T13:51:41.340258  kern  :emerg : BUG: spinlock bad magic on CPU#0, udevd/116
    2022-01-05T13:51:41.349110  kern  :emerg :  lock: emif_lock+0x0/0xfffff230 [emif], .magic: dead4ead, .owner: <none>/-1, .owner_cpu: -1   
  

^ permalink raw reply

* Re: [PATCH] Revert "net: usb: r8152: Add MAC passthrough support for more Lenovo Docks"
From: Andrew Lunn @ 2022-01-05 17:36 UTC (permalink / raw)
  To: Aaron Ma
  Cc: Oliver Neukum, kuba, henning.schild, linux-usb, netdev,
	linux-kernel, davem, hayeswang, tiwai
In-Reply-To: <fa192218-4fc8-678f-8b40-95b85e36097e@canonical.com>

On Thu, Jan 06, 2022 at 12:05:28AM +0800, Aaron Ma wrote:
> 
> On 1/6/22 00:01, Oliver Neukum wrote:
> > 
> > On 05.01.22 16:51, Aaron Ma wrote:
> > > This reverts commit f77b83b5bbab53d2be339184838b19ed2c62c0a5.
> > > 
> > > This change breaks multiple usb to ethernet dongles attached on Lenovo
> > > USB hub.
> > 
> > Hi,
> > 
> > now we should maybe discuss a sensible way to identify device
> > that should use passthrough. Are your reasons to not have a list
> > of devices maintainability or is it impossible?
> > 
> 
> The USB to ethernet ID is 0bda:8153. It's is original Realtek 8153 ID.
> It's impossible.
> 
> And ocp data are 0.
> No way to identify it's from dock.

Can you at least identify the dock?

Can you have a udev rule which matches on 0bda:8153, it then walks up
the tree and checks if it is part of the dock? And it is on the
expected port of the hub within the dock, and not a USB stick plugged
into the dock on some other port of the hub?

     Andrew

^ permalink raw reply

* [PATCH][RESEND] scsi: megaraid: Avoid mismatched storage type sizes
From: Kees Cook @ 2022-01-05 17:36 UTC (permalink / raw)
  To: Kashyap Desai
  Cc: Kees Cook, Sumit Saxena, Shivasharan S, James E.J. Bottomley,
	Martin K. Petersen, megaraidlinux.pdl, linux-scsi, linux-kernel,
	linux-hardening

Remove needless use of mbox_t, replacing with just struct
mbox_out. Silences compiler warnings under a -Warray-bounds build:

drivers/scsi/megaraid.c: In function 'megaraid_probe_one':
drivers/scsi/megaraid.c:3615:30: error: array subscript 'mbox_t[0]' is partly outside array bounds of 'unsigned char[15]' [-Werror=array-bounds]
 3615 |         mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/megaraid.c:3599:23: note: while referencing 'raw_mbox'
 3599 |         unsigned char raw_mbox[sizeof(struct mbox_out)];
      |                       ^~~~~~~~

Cc: Kashyap Desai <kashyap.desai@broadcom.com>
Cc: Sumit Saxena <sumit.saxena@broadcom.com>
Cc: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: megaraidlinux.pdl@broadcom.com
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Original patch sent here:
https://lore.kernel.org/lkml/20211203091424.3355371-1-keescook@chromium.org/
---
 drivers/scsi/megaraid.c | 84 +++++++++++++++++------------------------
 1 file changed, 34 insertions(+), 50 deletions(-)

diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 0d31d7a5e335..bf987f3a7f3f 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -192,23 +192,21 @@ mega_query_adapter(adapter_t *adapter)
 {
 	dma_addr_t	prod_info_dma_handle;
 	mega_inquiry3	*inquiry3;
-	u8	raw_mbox[sizeof(struct mbox_out)];
-	mbox_t	*mbox;
+	struct mbox_out	mbox;
+	u8	*raw_mbox = (u8 *)&mbox;
 	int	retval;
 
 	/* Initialize adapter inquiry mailbox */
 
-	mbox = (mbox_t *)raw_mbox;
-
 	memset((void *)adapter->mega_buffer, 0, MEGA_BUFFER_SIZE);
-	memset(&mbox->m_out, 0, sizeof(raw_mbox));
+	memset(&mbox, 0, sizeof(mbox));
 
 	/*
 	 * Try to issue Inquiry3 command
 	 * if not succeeded, then issue MEGA_MBOXCMD_ADAPTERINQ command and
 	 * update enquiry3 structure
 	 */
-	mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
+	mbox.xferaddr = (u32)adapter->buf_dma_handle;
 
 	inquiry3 = (mega_inquiry3 *)adapter->mega_buffer;
 
@@ -232,10 +230,10 @@ mega_query_adapter(adapter_t *adapter)
 
 		inq = &ext_inq->raid_inq;
 
-		mbox->m_out.xferaddr = (u32)dma_handle;
+		mbox.xferaddr = (u32)dma_handle;
 
 		/*issue old 0x04 command to adapter */
-		mbox->m_out.cmd = MEGA_MBOXCMD_ADPEXTINQ;
+		mbox.cmd = MEGA_MBOXCMD_ADPEXTINQ;
 
 		issue_scb_block(adapter, raw_mbox);
 
@@ -262,7 +260,7 @@ mega_query_adapter(adapter_t *adapter)
 						      sizeof(mega_product_info),
 						      DMA_FROM_DEVICE);
 
-		mbox->m_out.xferaddr = prod_info_dma_handle;
+		mbox.xferaddr = prod_info_dma_handle;
 
 		raw_mbox[0] = FC_NEW_CONFIG;	/* i.e. mbox->cmd=0xA1 */
 		raw_mbox[2] = NC_SUBOP_PRODUCT_INFO;	/* i.e. 0x0E */
@@ -3569,16 +3567,14 @@ mega_n_to_m(void __user *arg, megacmd_t *mc)
 static int
 mega_is_bios_enabled(adapter_t *adapter)
 {
-	unsigned char	raw_mbox[sizeof(struct mbox_out)];
-	mbox_t	*mbox;
-
-	mbox = (mbox_t *)raw_mbox;
+	struct mbox_out mbox;
+	unsigned char	*raw_mbox = (u8 *)&mbox;
 
-	memset(&mbox->m_out, 0, sizeof(raw_mbox));
+	memset(&mbox, 0, sizeof(mbox));
 
 	memset((void *)adapter->mega_buffer, 0, MEGA_BUFFER_SIZE);
 
-	mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
+	mbox.xferaddr = (u32)adapter->buf_dma_handle;
 
 	raw_mbox[0] = IS_BIOS_ENABLED;
 	raw_mbox[2] = GET_BIOS;
@@ -3600,13 +3596,11 @@ mega_is_bios_enabled(adapter_t *adapter)
 static void
 mega_enum_raid_scsi(adapter_t *adapter)
 {
-	unsigned char raw_mbox[sizeof(struct mbox_out)];
-	mbox_t *mbox;
+	struct mbox_out mbox;
+	unsigned char	*raw_mbox = (u8 *)&mbox;
 	int i;
 
-	mbox = (mbox_t *)raw_mbox;
-
-	memset(&mbox->m_out, 0, sizeof(raw_mbox));
+	memset(&mbox, 0, sizeof(mbox));
 
 	/*
 	 * issue command to find out what channels are raid/scsi
@@ -3616,7 +3610,7 @@ mega_enum_raid_scsi(adapter_t *adapter)
 
 	memset((void *)adapter->mega_buffer, 0, MEGA_BUFFER_SIZE);
 
-	mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
+	mbox.xferaddr = (u32)adapter->buf_dma_handle;
 
 	/*
 	 * Non-ROMB firmware fail this command, so all channels
@@ -3655,23 +3649,21 @@ static void
 mega_get_boot_drv(adapter_t *adapter)
 {
 	struct private_bios_data	*prv_bios_data;
-	unsigned char	raw_mbox[sizeof(struct mbox_out)];
-	mbox_t	*mbox;
+	struct mbox_out mbox;
+	unsigned char	*raw_mbox = (u8 *)&mbox;
 	u16	cksum = 0;
 	u8	*cksum_p;
 	u8	boot_pdrv;
 	int	i;
 
-	mbox = (mbox_t *)raw_mbox;
-
-	memset(&mbox->m_out, 0, sizeof(raw_mbox));
+	memset(&mbox, 0, sizeof(mbox));
 
 	raw_mbox[0] = BIOS_PVT_DATA;
 	raw_mbox[2] = GET_BIOS_PVT_DATA;
 
 	memset((void *)adapter->mega_buffer, 0, MEGA_BUFFER_SIZE);
 
-	mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
+	mbox.xferaddr = (u32)adapter->buf_dma_handle;
 
 	adapter->boot_ldrv_enabled = 0;
 	adapter->boot_ldrv = 0;
@@ -3721,13 +3713,11 @@ mega_get_boot_drv(adapter_t *adapter)
 static int
 mega_support_random_del(adapter_t *adapter)
 {
-	unsigned char raw_mbox[sizeof(struct mbox_out)];
-	mbox_t *mbox;
+	struct mbox_out mbox;
+	unsigned char	*raw_mbox = (u8 *)&mbox;
 	int rval;
 
-	mbox = (mbox_t *)raw_mbox;
-
-	memset(&mbox->m_out, 0, sizeof(raw_mbox));
+	memset(&mbox, 0, sizeof(mbox));
 
 	/*
 	 * issue command
@@ -3750,13 +3740,11 @@ mega_support_random_del(adapter_t *adapter)
 static int
 mega_support_ext_cdb(adapter_t *adapter)
 {
-	unsigned char raw_mbox[sizeof(struct mbox_out)];
-	mbox_t *mbox;
+	struct mbox_out mbox;
+	unsigned char	*raw_mbox = (u8 *)&mbox;
 	int rval;
 
-	mbox = (mbox_t *)raw_mbox;
-
-	memset(&mbox->m_out, 0, sizeof(raw_mbox));
+	memset(&mbox, 0, sizeof(mbox));
 	/*
 	 * issue command to find out if controller supports extended CDBs.
 	 */
@@ -3865,16 +3853,14 @@ mega_do_del_logdrv(adapter_t *adapter, int logdrv)
 static void
 mega_get_max_sgl(adapter_t *adapter)
 {
-	unsigned char	raw_mbox[sizeof(struct mbox_out)];
-	mbox_t	*mbox;
+	struct mbox_out	mbox;
+	unsigned char	*raw_mbox = (u8 *)&mbox;
 
-	mbox = (mbox_t *)raw_mbox;
-
-	memset(mbox, 0, sizeof(raw_mbox));
+	memset(&mbox, 0, sizeof(mbox));
 
 	memset((void *)adapter->mega_buffer, 0, MEGA_BUFFER_SIZE);
 
-	mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
+	mbox.xferaddr = (u32)adapter->buf_dma_handle;
 
 	raw_mbox[0] = MAIN_MISC_OPCODE;
 	raw_mbox[2] = GET_MAX_SG_SUPPORT;
@@ -3888,7 +3874,7 @@ mega_get_max_sgl(adapter_t *adapter)
 	}
 	else {
 		adapter->sglen = *((char *)adapter->mega_buffer);
-		
+
 		/*
 		 * Make sure this is not more than the resources we are
 		 * planning to allocate
@@ -3910,16 +3896,14 @@ mega_get_max_sgl(adapter_t *adapter)
 static int
 mega_support_cluster(adapter_t *adapter)
 {
-	unsigned char	raw_mbox[sizeof(struct mbox_out)];
-	mbox_t	*mbox;
-
-	mbox = (mbox_t *)raw_mbox;
+	struct mbox_out	mbox;
+	unsigned char	*raw_mbox = (u8 *)&mbox;
 
-	memset(mbox, 0, sizeof(raw_mbox));
+	memset(&mbox, 0, sizeof(mbox));
 
 	memset((void *)adapter->mega_buffer, 0, MEGA_BUFFER_SIZE);
 
-	mbox->m_out.xferaddr = (u32)adapter->buf_dma_handle;
+	mbox.xferaddr = (u32)adapter->buf_dma_handle;
 
 	/*
 	 * Try to get the initiator id. This command will succeed iff the
-- 
2.30.2


^ permalink raw reply related

* Re: [PATCH net] ppp: ensure minimum packet size in ppp_write()
From: Guillaume Nault @ 2022-01-05 17:37 UTC (permalink / raw)
  To: James Carlson
  Cc: Eric Dumazet, David S . Miller, Jakub Kicinski, netdev,
	Eric Dumazet, Paul Mackerras, linux-ppp, syzbot
In-Reply-To: <f78e2051-714d-ff74-7e36-bea3b4edc682@workingcode.com>

On Wed, Jan 05, 2022 at 11:35:52AM -0500, James Carlson wrote:
> On 1/5/22 11:29, Guillaume Nault wrote:
> > On Wed, Jan 05, 2022 at 10:30:09AM -0500, James Carlson wrote:
> >> On 1/5/22 08:19, Guillaume Nault wrote:
> >>> On Wed, Jan 05, 2022 at 03:48:42AM -0800, Eric Dumazet wrote:
> >>>> From: Eric Dumazet <edumazet@google.com>
> >>>>
> >>>> It seems pretty clear ppp layer assumed user space
> >>>> would always be kind to provide enough data
> >>>> in their write() to a ppp device.
> >>>>
> >>>> This patch makes sure user provides at least
> >>>> 2 bytes.
> >>>>
> >>>> It adds PPP_PROTO_LEN macro that could replace
> >>>> in net-next many occurrences of hard-coded 2 value.
> >>>
> >>> The PPP header can be compressed to only 1 byte, but since 2 bytes is
> >>> assumed in several parts of the code, rejecting such packets in
> >>> ppp_xmit() is probably the best we can do.
> >>
> >> The only ones that can be compressed are those less than 0x0100, which
> >> are (intentionally) all network layer protocols.  We should be getting
> >> only control protocol messages though the user-space interface, not
> >> network layer, so I'd say it's not just the best we can do, but indeed
> >> the right thing to do by design.
> > 
> > Well, I know of at least one implementation that used to transmit data
> > by writing on ppp unit file descriptors. That was a hack to work around
> > some other problems. Not a beautiful one, but it worked.
> > 
> 
> So, if you do that sort of hack, then you're constrained to send
> uncompressed protocol numbers regardless of what's negotiated. That
> seems like a tiny concession. (And receivers are required to handle
> uncompressed no matter what LCP negotiation says, per 1661 6.5.)

In the case I was refering to, the program was just retransmitting PPP
frames and wasn't supposed to modify the headers. We now have kernel
support for that, but it landed only one year ago. Before that, the only
option was to write on the ppp fd (btw, that was the channel fd, not the
unit, sorry).

> And I'd still maintain that the intended design is that control
> protocols are handled by the user portion, while network layer protocols
> are connected in the kernel.

Absolutely, I was just pointing out that the kernel doesn't enforce
this design and therefore implementations sometimes ignore it.

Anyway, I don't see any problem with refusing to send packets smaller
than 2 bytes. Hence my acked-by.


^ permalink raw reply

* Re: [PATCH 0/8] DEV_PM_OPS macros rework
From: Rafael J. Wysocki @ 2022-01-05 17:37 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Jonathan Cameron, Rafael J . Wysocki, Ulf Hansson,
	Jonathan Cameron, Lars-Peter Clausen, Linus Walleij,
	Arnd Bergmann, Len Brown, Pavel Machek, list, linux-iio,
	Linux Kernel Mailing List, open list:BROADCOM NVRAM DRIVER,
	linux-mmc, Linux PM
In-Reply-To: <TLW85R.NW4VI31QKSEJ3@crapouillou.net>

On Wed, Jan 5, 2022 at 5:32 PM Paul Cercueil <paul@crapouillou.net> wrote:
>
>
>
> Le mer., janv. 5 2022 at 10:17:37 +0000, Jonathan Cameron
> <Jonathan.Cameron@Huawei.com> a écrit :
> > On Tue, 4 Jan 2022 21:42:06 +0000
> > Paul Cercueil <paul@crapouillou.net> wrote:
> >
> >>  Hi,
> >>
> >>  This set of commits rework a bit the *_DEV_PM_OPS() macros that were
> >>  introduced recently.
> >>
> >>  - Remove the DEFINE_UNIVERSAL_DEV_PM_OPS() macro, since I highly
> >> doubt
> >>    anything is going to use it. The macro it replaces
> >>    (UNIVERSAL_DEV_PM_OPS) seems to only be used incorrectly in code
> >> that
> >>    hasn't been updated in ages.
> >>
> >>  - Remove the static qualifier in DEFINE_SIMPLE_DEV_PM_OPS, so that
> >> the
> >>    macro is more in line with what's done elsewhere in the kernel.
> >>
> >>  - Add a DEFINE_RUNTIME_DEV_PM_OPS() macro, for use with drivers
> >> that use
> >>    runtime PM, and use
> >> runtime_pm_force_suspend/runtime_pm_force_resume
> >>    as their system sleep callbacks.
> >>
> >>  - Add EXPORT_*_DEV_PM_OPS macros, which can be used for when the
> >>    underlying dev_pm_ops is to be exported. With CONFIG_PM set, the
> >>    symbol is exported as you would expect. With CONFIG_PM disabled,
> >> the
> >>    dev_pm_ops is garbage-collected along with the suspend/resume
> >>    callbacks.
> >>
> >>  - Update the two places which used DEFINE_SIMPLE_DEV_PM_OPS, to add
> >> back
> >>    the "static" qualifier that was stripped from the macro.
> >>
> >>  - Update one driver to use EXPORT_RUNTIME_DEV_PM_OPS(), just to
> >> showcase
> >>    how to use this macro in the case where a dev_pm_ops is to be
> >>    exported.
> >>    Note that the driver itself is GPL, and the symbol is only used
> >> within
> >>    a GPL driver, so I would assume the symbol would be exported as
> >> GPL.
> >>    But it was not the case in the original code, so I did not change
> >> the
> >>    behaviour.
> >>
> >>  Feedback welcome.
> >
> > Comments on individual patches (in particular bad pick for that final
> > example ;)
> >
> > Given how late we are in the cycle, I'd argue we 'need' patches 2 (+
> > 5,6 which
> > should probably be all one patch to avoid introducing then fixing a
> > warning in
> > different patches).  The others could wait for the following cycle if
> > needed.
>
> Ok, should I V2 with patches 2/5/6 merged together?

Yes, please!

^ permalink raw reply

* Re: [syzbot] WARNING in signalfd_cleanup
From: Pavel Begunkov @ 2022-01-05 17:37 UTC (permalink / raw)
  To: Eric Biggers, Jens Axboe, io-uring
  Cc: Eric Dumazet, syzbot, changbin.du, Daniel Borkmann, David Miller,
	Heiner Kallweit, Jakub Kicinski, linux-fsdevel, LKML, netdev,
	syzkaller-bugs, Al Viro, Yajun Deng
In-Reply-To: <YdW+trV0x25fhTqV@sol.localdomain>

On 1/5/22 15:52, Eric Biggers wrote:
> [+io_uring list and maintainers]
> 
> This appears to be the known bug in io_uring where it doesn't POLLFREE
> notifications.  See previous discussion:
> https://lore.kernel.org/all/4a472e72-d527-db79-d46e-efa9d4cad5bb@kernel.dk/

We've got some fixing and groundwork done, but not POLLFREE yet.
Great to have a repro, thanks


> On Wed, Jan 05, 2022 at 07:42:10AM -0800, 'Eric Dumazet' via syzkaller-bugs wrote:
>> On Wed, Jan 5, 2022 at 7:37 AM syzbot
>> <syzbot+5426c7ed6868c705ca14@syzkaller.appspotmail.com> wrote:
>>>
>>> Hello,
>>>
>>> syzbot found the following issue on:
>>>
>>> HEAD commit:    6b8d4927540e Add linux-next specific files for 20220104
>>> git tree:       linux-next
>>> console output: https://syzkaller.appspot.com/x/log.txt?x=159d88e3b00000
>>> kernel config:  https://syzkaller.appspot.com/x/.config?x=45c9bbbf2ae8e3d3
>>> dashboard link: https://syzkaller.appspot.com/bug?extid=5426c7ed6868c705ca14
>>> compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
>>> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=117be65db00000
>>> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15a75c8db00000
>>>
>>
>> C repro looks legit, point to an io_uring issue.
>>
>>> The issue was bisected to:
>>
>> Please ignore the bisection.
>>
>>>
>>> commit e4b8954074f6d0db01c8c97d338a67f9389c042f
>>> Author: Eric Dumazet <edumazet@google.com>
>>> Date:   Tue Dec 7 01:30:37 2021 +0000
>>>
>>>      netlink: add net device refcount tracker to struct ethnl_req_info
>>>
>>> bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=12bca4e3b00000
>>> final oops:     https://syzkaller.appspot.com/x/report.txt?x=11bca4e3b00000
>>> console output: https://syzkaller.appspot.com/x/log.txt?x=16bca4e3b00000
>>>
>>> IMPORTANT: if you fix the issue, please add the following tag to the commit:
>>> Reported-by: syzbot+5426c7ed6868c705ca14@syzkaller.appspotmail.com
>>> Fixes: e4b8954074f6 ("netlink: add net device refcount tracker to struct ethnl_req_info")
>>>
>>> ------------[ cut here ]------------
>>> WARNING: CPU: 0 PID: 3604 at kernel/sched/wait.c:245 __wake_up_pollfree+0x40/0x50 kernel/sched/wait.c:246
>>> Modules linked in:
>>> CPU: 0 PID: 3604 Comm: syz-executor714 Not tainted 5.16.0-rc8-next-20220104-syzkaller #0
>>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
>>> RIP: 0010:__wake_up_pollfree+0x40/0x50 kernel/sched/wait.c:245
>>> Code: f3 ff ff 48 8d 6b 40 48 b8 00 00 00 00 00 fc ff df 48 89 ea 48 c1 ea 03 80 3c 02 00 75 11 48 8b 43 40 48 39 c5 75 03 5b 5d c3 <0f> 0b 5b 5d c3 48 89 ef e8 13 d8 69 00 eb e5 cc 48 c1 e7 06 48 63
>>> RSP: 0018:ffffc90001aaf9f8 EFLAGS: 00010083
>>> RAX: ffff88801cd623f0 RBX: ffff88801bec8048 RCX: 0000000000000000
>>> RDX: 1ffff110037d9011 RSI: 0000000000000004 RDI: 0000000000000001
>>> RBP: ffff88801bec8088 R08: 0000000000000000 R09: ffff88801bec804b
>>> R10: ffffed10037d9009 R11: 0000000000000000 R12: ffff88801bec8040
>>> R13: ffff88801e029d40 R14: dffffc0000000000 R15: ffff88807eb50000
>>> FS:  00005555573ad300(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
>>> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>>> CR2: 00000000200000c0 CR3: 000000001e5e4000 CR4: 00000000003506f0
>>> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>>> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>>> Call Trace:
>>>   <TASK>
>>>   wake_up_pollfree include/linux/wait.h:271 [inline]
>>>   signalfd_cleanup+0x42/0x60 fs/signalfd.c:38
>>>   __cleanup_sighand kernel/fork.c:1596 [inline]
>>>   __cleanup_sighand+0x72/0xb0 kernel/fork.c:1593
>>>   __exit_signal kernel/exit.c:159 [inline]
>>>   release_task+0xc02/0x17e0 kernel/exit.c:200
>>>   wait_task_zombie kernel/exit.c:1117 [inline]
>>>   wait_consider_task+0x2fa6/0x3b80 kernel/exit.c:1344
>>>   do_wait_thread kernel/exit.c:1407 [inline]
>>>   do_wait+0x6ca/0xce0 kernel/exit.c:1524
>>>   kernel_wait4+0x14c/0x260 kernel/exit.c:1687
>>>   __do_sys_wait4+0x13f/0x150 kernel/exit.c:1715
>>>   do_syscall_x64 arch/x86/entry/common.c:50 [inline]
>>>   do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
>>>   entry_SYSCALL_64_after_hwframe+0x44/0xae
>>> RIP: 0033:0x7facd6682386
>>> Code: 0f 1f 40 00 31 c9 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 49 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 11 b8 3d 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 5a c3 90 48 83 ec 28 89 54 24 14 48 89 74 24
>>> RSP: 002b:00007ffdb91adef8 EFLAGS: 00000246 ORIG_RAX: 000000000000003d
>>> RAX: ffffffffffffffda RBX: 000000000000c646 RCX: 00007facd6682386
>>> RDX: 0000000040000001 RSI: 00007ffdb91adf14 RDI: 00000000ffffffff
>>> RBP: 0000000000000f17 R08: 0000000000000032 R09: 00007ffdb91ec080
>>> R10: 0000000000000000 R11: 0000000000000246 R12: 431bde82d7b634db
>>> R13: 00007ffdb91adf14 R14: 0000000000000000 R15: 0000000000000000
>>>   </TASK>
>>>
>>>
>>> ---
>>> This report is generated by a bot. It may contain errors.
>>> See https://goo.gl/tpsmEJ for more information about syzbot.
>>> syzbot engineers can be reached at syzkaller@googlegroups.com.
>>>
>>> syzbot will keep track of this issue. See:
>>> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
>>> For information about bisection process see: https://goo.gl/tpsmEJ#bisection
>>> syzbot can test patches for this issue, for details see:
>>> https://goo.gl/tpsmEJ#testing-patches
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/CANn89iK3tP3rANSWM7_%3DimMeMcUknT0U2GyfA9W4v12ad6_PkQ%40mail.gmail.com.

-- 
Pavel Begunkov

^ permalink raw reply

* Re: [OE-core] [PATCH 2/2] package.bbclass: don't skip kernel and kernel modules
From: Richard Purdie @ 2022-01-05 17:40 UTC (permalink / raw)
  To: Bruce Ashfield
  Cc: Saul Wold, Patches and discussions about the oe-core layer,
	Joshua Watt, Bruce Ashfield
In-Reply-To: <CADkTA4Mh78Kmg_NWoS+Bm4on+D_6wzCErawALKQqWdH9OsN9pA@mail.gmail.com>

On Wed, 2022-01-05 at 12:30 -0500, Bruce Ashfield wrote:
> On Wed, Jan 5, 2022 at 12:07 PM Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > 
> > On Tue, 2022-01-04 at 14:07 -0800, Saul Wold wrote:
> > > 
> > > On 12/22/21 01:09, Richard Purdie wrote:
> > > > On Tue, 2021-12-21 at 11:08 -0800, Saul Wold wrote:
> > > > > Stop ignoring or skipping the kernel and kernel modules code in the
> > > > > split debug and striping functions, this will allow create_spdx to
> > > > > process the kernel and modules.
> > > > > 
> > > > > Signed-off-by: Saul Wold <saul.wold@windriver.com>
> > > > > ---
> > > > >   meta/classes/package.bbclass | 8 ++------
> > > > >   1 file changed, 2 insertions(+), 6 deletions(-)
> > > > > 
> > > > > diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> > > > > index 84eafbd529..4b7fe4f1e1 100644
> > > > > --- a/meta/classes/package.bbclass
> > > > > +++ b/meta/classes/package.bbclass
> > > > > @@ -390,10 +390,6 @@ def splitdebuginfo(file, dvar, debugdir, debuglibdir, debugappend, debugsrcdir,
> > > > >       dvar = d.getVar('PKGD')
> > > > >       objcopy = d.getVar("OBJCOPY")
> > > > > 
> > > > > -    # We ignore kernel modules, we don't generate debug info files.
> > > > > -    if file.find("/lib/modules/") != -1 and file.endswith(".ko"):
> > > > > -        return (file, sources)
> > > > > -
> > > > >       newmode = None
> > > > >       if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
> > > > >           origmode = os.stat(file)[stat.ST_MODE]
> > > > > @@ -1147,7 +1143,7 @@ python split_and_strip_files () {
> > > > > 
> > > > >                   if file.endswith(".ko") and file.find("/lib/modules/") != -1:
> > > > >                       kernmods.append(file)
> > > > > -                    continue
> > > > > +
> > > > >                   if oe.package.is_static_lib(file):
> > > > >                       staticlibs.append(file)
> > > > >                       continue
> > > > > @@ -1165,7 +1161,7 @@ python split_and_strip_files () {
> > > > >                       continue
> > > > >                   # Check its an executable
> > > > >                   if (s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & stat.S_IXGRP) or (s[stat.ST_MODE] & stat.S_IXOTH) \
> > > > > -                        or ((file.startswith(libdir) or file.startswith(baselibdir)) and (".so" in f or ".node" in f)):
> > > > > +                        or ((file.startswith(libdir) or file.startswith(baselibdir)) and (".so" in f or ".node" in f)) or (f.startswith('vmlinux') or ".ko" in f):
> > > > > 
> > > > >                       if cpath.islink(file):
> > > > >                           checkelflinks[file] = ltarget
> > > > 
> > > > edgerouter:
> > > > https://autobuilder.yoctoproject.org/typhoon/#/builders/62/builds/4513
> > > > https://autobuilder.yoctoproject.org/typhoon/#/builders/111/builds/2507/steps/11/logs/stdio
> > > > 
> > > So I have been digging into this and it seems that an option was added a
> > > decade ago or so to strip the kernel/vmlinux when it's too big, this was
> > > done for at least the routerstationpro according to bug #3515 [0], and
> > > persists with the edgerouter, although I am not sure if it would still
> > > actually be required as the edgerouter also uses the
> > > KERNEL_ALT_IMAGETYPE to create a smaller binary kernel image.
> > > 
> > > The change I proposed causes the all kernels to be stripped all the time
> > > as part of the split_and_strip_files(). As I see it there few different
> > > options:
> > > 
> > > 1) Set KERNEL_IMAGE_EXTRA_STRIP_SECTIONS = "" in create_spdx.bbclass
> > >    - This solves the problem with create_spdx.bbclass is in use, but not
> > > the general case
> > 
> > I don't think I like this as it is a side effect that isn't obvious or expected.
> > 
> > > 
> > > 2) Remove the KERNEL_IMAGE_EXTRA_STRIP_SECTIONS from edgerouter.conf
> > >    - Will solve the edgerouter case but may not solve other usages
> > > unknown to me.
> > >    - Does anyone know of other machines/layers usage of this variable?
> > > 
> > > 3) deprecate the kernel.bbclass:do_strip function in favor of using the
> > > split_and_strip_files() of package.bbclass
> > 
> > I know Bruce has said he doesn't like this, however stepping back, these issues
> > were from a time our stripping code was young and evolving. If we can
> > standardise and have it all work together well in one set of functions, I think
> > that is worth looking at. I'd prefer the kernel wasn't a special case if it no
> > longer needs to be.
> > 
> > That said, I don't remember the details of why we did this.
> 
> There's a middle ground of debug being possible, and some sections
> removed to keep the footprint a bit lower. There were also some
> unwinders, etc, that didn't work when everything was stripped and
> split into debug. The stripping was too aggressive, and removed some
> sections that were required.
> 
> While I can't exactly point to the use cases for it now, with the 5K
> options in the kernel, they haven't all been removed, and I'd be very
> hesitant to remove the capability completely.

What may help would be to move the kernel stripping code from kernel.bbclass to
live along with the package stripping code, which would then at least solve some
of the QA warning issues and the two code blocks not fighting with each other.
it would also allow the debug symbols to move to the linked debug files where
appropriate more easily.

I think one of the challenges in doing that is the do_deploy of the kernel image
though which may not then have the right stripping :(.

We may be able to call the strip function from do_deploy though?

Cheers,

Richard





^ permalink raw reply

* Re: [PATCH 1/3 v3] net: usb: r8152: Check used MAC passthrough address
From: Henning Schild @ 2022-01-05 17:40 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Aaron Ma, kuba, linux-usb, netdev, linux-kernel, davem, hayeswang,
	tiwai
In-Reply-To: <YdXVoNFB/Asq6bc/@lunn.ch>

Am Wed, 5 Jan 2022 18:30:08 +0100
schrieb Andrew Lunn <andrew@lunn.ch>:

> On Wed, Jan 05, 2022 at 11:14:25PM +0800, Aaron Ma wrote:
> > When plugin multiple r8152 ethernet dongles to Lenovo Docks
> > or USB hub, MAC passthrough address from BIOS should be
> > checked if it had been used to avoid using on other dongles.
> > 
> > Currently builtin r8152 on Dock still can't be identified.
> > First detected r8152 will use the MAC passthrough address.  
> 
> I do have to wonder why you are doing this in the kernel, and not
> using a udev rule? This seems to be policy, and policy does not belong
> in the kernel.

Yes, the whole pass-thru story should not be a kernel feature in the
first place, i could not agree more, udev would be the way better place!
But it is part of the driver and Aaron did not introduce it but just
extend it.

Henning

>    Andrew


^ permalink raw reply

* Re: [OE-core] [PATCH 2/2] package.bbclass: don't skip kernel and kernel modules
From: Saul Wold @ 2022-01-05 17:40 UTC (permalink / raw)
  To: Bruce Ashfield, Richard Purdie
  Cc: Patches and discussions about the oe-core layer, Joshua Watt,
	Bruce Ashfield
In-Reply-To: <CADkTA4Mh78Kmg_NWoS+Bm4on+D_6wzCErawALKQqWdH9OsN9pA@mail.gmail.com>



On 1/5/22 09:30, Bruce Ashfield wrote:
> On Wed, Jan 5, 2022 at 12:07 PM Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
>>
>> On Tue, 2022-01-04 at 14:07 -0800, Saul Wold wrote:
>>>
>>> On 12/22/21 01:09, Richard Purdie wrote:
>>>> On Tue, 2021-12-21 at 11:08 -0800, Saul Wold wrote:
>>>>> Stop ignoring or skipping the kernel and kernel modules code in the
>>>>> split debug and striping functions, this will allow create_spdx to
>>>>> process the kernel and modules.
>>>>>
>>>>> Signed-off-by: Saul Wold <saul.wold@windriver.com>
>>>>> ---
>>>>>    meta/classes/package.bbclass | 8 ++------
>>>>>    1 file changed, 2 insertions(+), 6 deletions(-)
>>>>>
>>>>> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
>>>>> index 84eafbd529..4b7fe4f1e1 100644
>>>>> --- a/meta/classes/package.bbclass
>>>>> +++ b/meta/classes/package.bbclass
>>>>> @@ -390,10 +390,6 @@ def splitdebuginfo(file, dvar, debugdir, debuglibdir, debugappend, debugsrcdir,
>>>>>        dvar = d.getVar('PKGD')
>>>>>        objcopy = d.getVar("OBJCOPY")
>>>>>
>>>>> -    # We ignore kernel modules, we don't generate debug info files.
>>>>> -    if file.find("/lib/modules/") != -1 and file.endswith(".ko"):
>>>>> -        return (file, sources)
>>>>> -
>>>>>        newmode = None
>>>>>        if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
>>>>>            origmode = os.stat(file)[stat.ST_MODE]
>>>>> @@ -1147,7 +1143,7 @@ python split_and_strip_files () {
>>>>>
>>>>>                    if file.endswith(".ko") and file.find("/lib/modules/") != -1:
>>>>>                        kernmods.append(file)
>>>>> -                    continue
>>>>> +
>>>>>                    if oe.package.is_static_lib(file):
>>>>>                        staticlibs.append(file)
>>>>>                        continue
>>>>> @@ -1165,7 +1161,7 @@ python split_and_strip_files () {
>>>>>                        continue
>>>>>                    # Check its an executable
>>>>>                    if (s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & stat.S_IXGRP) or (s[stat.ST_MODE] & stat.S_IXOTH) \
>>>>> -                        or ((file.startswith(libdir) or file.startswith(baselibdir)) and (".so" in f or ".node" in f)):
>>>>> +                        or ((file.startswith(libdir) or file.startswith(baselibdir)) and (".so" in f or ".node" in f)) or (f.startswith('vmlinux') or ".ko" in f):
>>>>>
>>>>>                        if cpath.islink(file):
>>>>>                            checkelflinks[file] = ltarget
>>>>
>>>> edgerouter:
>>>> https://autobuilder.yoctoproject.org/typhoon/#/builders/62/builds/4513
>>>> https://autobuilder.yoctoproject.org/typhoon/#/builders/111/builds/2507/steps/11/logs/stdio
>>>>
>>> So I have been digging into this and it seems that an option was added a
>>> decade ago or so to strip the kernel/vmlinux when it's too big, this was
>>> done for at least the routerstationpro according to bug #3515 [0], and
>>> persists with the edgerouter, although I am not sure if it would still
>>> actually be required as the edgerouter also uses the
>>> KERNEL_ALT_IMAGETYPE to create a smaller binary kernel image.
>>>
>>> The change I proposed causes the all kernels to be stripped all the time
>>> as part of the split_and_strip_files(). As I see it there few different
>>> options:
>>>
>>> 1) Set KERNEL_IMAGE_EXTRA_STRIP_SECTIONS = "" in create_spdx.bbclass
>>>     - This solves the problem with create_spdx.bbclass is in use, but not
>>> the general case
>>
>> I don't think I like this as it is a side effect that isn't obvious or expected.
>>
>>>
>>> 2) Remove the KERNEL_IMAGE_EXTRA_STRIP_SECTIONS from edgerouter.conf
>>>     - Will solve the edgerouter case but may not solve other usages
>>> unknown to me.
>>>     - Does anyone know of other machines/layers usage of this variable?
>>>
>>> 3) deprecate the kernel.bbclass:do_strip function in favor of using the
>>> split_and_strip_files() of package.bbclass
>>
>> I know Bruce has said he doesn't like this, however stepping back, these issues
>> were from a time our stripping code was young and evolving. If we can
>> standardise and have it all work together well in one set of functions, I think
>> that is worth looking at. I'd prefer the kernel wasn't a special case if it no
>> longer needs to be.
>>
>> That said, I don't remember the details of why we did this.
> 
> There's a middle ground of debug being possible, and some sections
> removed to keep the footprint a bit lower. There were also some
> unwinders, etc, that didn't work when everything was stripped and
> split into debug. The stripping was too aggressive, and removed some
> sections that were required.
> 
> While I can't exactly point to the use cases for it now, with the 5K
> options in the kernel, they haven't all been removed, and I'd be very
> hesitant to remove the capability completely.
> 

I think this makes the most sense after thinking about it also, having 
one place where the striping occurs in runstrip() in lib/oe/package.py, 
seems reasonable. The one neck to ring as it were.

We can extend the is_elf() types to add vmlinux and use the 
KERNEL_IMAGE_EXTRA_STRIP_SECTIONS there. So this could deprecate the 
do_strip() from the kernel.bbclass and keep the behavior.

Sau!
> Bruce
> 
>>
>>
>>>
>>> 4) Change error to warning in packaging.bbclass for the kernel only
>>>     - This would explain that a kernel image (vmlinux) is already
>>> stripped and extended package data would not be available for for SPDX
>>> creation.
>>>
>>> RP, Bruce, Joshua: Thoughts?
>>
>> If we can simplify and stop the kernel being a special case for this code (or
>> handle kernels generically) that would be worth a bit of effort IMO...
>>
>> Cheers,
>>
>> Richard
>>
>>
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#160211): https://lists.openembedded.org/g/openembedded-core/message/160211
>> Mute This Topic: https://lists.openembedded.org/mt/87884056/1050810
>> Group Owner: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [bruce.ashfield@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
> 
> 

-- 
Sau!


^ permalink raw reply

* [PATCH] doc: simplify baseband features matrix
From: Thomas Monjalon @ 2022-01-05 17:40 UTC (permalink / raw)
  To: dev; +Cc: nipun.gupta, hemant.agrawal, gakhil, nicolas.chautru

The "feature" BBDEV API is useless as all baseband drivers
must implement it by definition.

The non-implemented features should not be marked with "N".
Keeping them blank is clearer to read in the resulting matrix.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 doc/guides/bbdevs/features/acc100.ini        | 1 -
 doc/guides/bbdevs/features/default.ini       | 1 -
 doc/guides/bbdevs/features/fpga_5gnr_fec.ini | 1 -
 doc/guides/bbdevs/features/fpga_lte_fec.ini  | 1 -
 doc/guides/bbdevs/features/la12xx.ini        | 4 ----
 doc/guides/bbdevs/features/null.ini          | 1 -
 doc/guides/bbdevs/features/turbo_sw.ini      | 1 -
 7 files changed, 10 deletions(-)

diff --git a/doc/guides/bbdevs/features/acc100.ini b/doc/guides/bbdevs/features/acc100.ini
index 642cd48818..61a31065e1 100644
--- a/doc/guides/bbdevs/features/acc100.ini
+++ b/doc/guides/bbdevs/features/acc100.ini
@@ -11,4 +11,3 @@ LDPC Encoder (5G)      = Y
 LLR/HARQ Compression   = Y
 External DDR Access    = Y
 HW Accelerated         = Y
-BBDEV API              = Y
diff --git a/doc/guides/bbdevs/features/default.ini b/doc/guides/bbdevs/features/default.ini
index 5fe267a625..494be5e400 100644
--- a/doc/guides/bbdevs/features/default.ini
+++ b/doc/guides/bbdevs/features/default.ini
@@ -13,4 +13,3 @@ LDPC Encoder (5G)      =
 LLR/HARQ Compression   =
 External DDR Access    =
 HW Accelerated         =
-BBDEV API              =
diff --git a/doc/guides/bbdevs/features/fpga_5gnr_fec.ini b/doc/guides/bbdevs/features/fpga_5gnr_fec.ini
index 7a0b8d4e75..66c9139409 100644
--- a/doc/guides/bbdevs/features/fpga_5gnr_fec.ini
+++ b/doc/guides/bbdevs/features/fpga_5gnr_fec.ini
@@ -8,4 +8,3 @@ LDPC Decoder (5G)      = Y
 LDPC Encoder (5G)      = Y
 External DDR Access    = Y
 HW Accelerated         = Y
-BBDEV API              = Y
diff --git a/doc/guides/bbdevs/features/fpga_lte_fec.ini b/doc/guides/bbdevs/features/fpga_lte_fec.ini
index f1cfb924a2..c3c398312b 100644
--- a/doc/guides/bbdevs/features/fpga_lte_fec.ini
+++ b/doc/guides/bbdevs/features/fpga_lte_fec.ini
@@ -7,4 +7,3 @@
 Turbo Decoder (4G)     = Y
 Turbo Encoder (4G)     = Y
 HW Accelerated         = Y
-BBDEV API              = Y
diff --git a/doc/guides/bbdevs/features/la12xx.ini b/doc/guides/bbdevs/features/la12xx.ini
index 0aec5eecb6..70c11990b7 100644
--- a/doc/guides/bbdevs/features/la12xx.ini
+++ b/doc/guides/bbdevs/features/la12xx.ini
@@ -4,10 +4,6 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
-Turbo Decoder (4G)     = N
-Turbo Encoder (4G)     = N
 LDPC Decoder (5G)      = Y
 LDPC Encoder (5G)      = Y
-LLR/HARQ Compression   = N
 HW Accelerated         = Y
-BBDEV API              = Y
diff --git a/doc/guides/bbdevs/features/null.ini b/doc/guides/bbdevs/features/null.ini
index d9bbda9cf0..50648cdecb 100644
--- a/doc/guides/bbdevs/features/null.ini
+++ b/doc/guides/bbdevs/features/null.ini
@@ -4,4 +4,3 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
-BBDEV API              = Y
diff --git a/doc/guides/bbdevs/features/turbo_sw.ini b/doc/guides/bbdevs/features/turbo_sw.ini
index 2c7075e212..1d908d3ceb 100644
--- a/doc/guides/bbdevs/features/turbo_sw.ini
+++ b/doc/guides/bbdevs/features/turbo_sw.ini
@@ -8,4 +8,3 @@ Turbo Decoder (4G)     = Y
 Turbo Encoder (4G)     = Y
 LDPC Decoder (5G)      = Y
 LDPC Encoder (5G)      = Y
-BBDEV API              = Y
-- 
2.34.1


^ permalink raw reply related

* Re: [next] mm/shmem.c:3993:5: error: conflicting types for 'shmem_unuse'; have 'int(unsigned int, long unsigned int *)'
From: Matthew Wilcox @ 2022-01-05 17:40 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: linux-mm, open list, Linux-Next Mailing List, Hugh Dickins,
	Andrew Morton, Stephen Rothwell, Christoph Hellwig, Juergen Gross,
	Dan Streetman, Geert Uytterhoeven, Konrad Rzeszutek Wilk,
	Seth Jennings, Vitaly Wool, lkft-triage
In-Reply-To: <CA+G9fYvXfD3wS8eJV6A6GygqhJb3AUF9OROQAkBRRTN+thVo-g@mail.gmail.com>

On Wed, Jan 05, 2022 at 08:01:19PM +0530, Naresh Kamboju wrote:
> mm/shmem.c:3993:5: error: conflicting types for 'shmem_unuse'; have
> 'int(unsigned int,  long unsigned int *)'
>  3993 | int shmem_unuse(unsigned int type, unsigned long *fs_pages_to_unuse)
>       |     ^~~~~~~~~~~
> In file included from include/linux/khugepaged.h:6,
>                  from mm/shmem.c:37:
> include/linux/shmem_fs.h:86:5: note: previous declaration of
> 'shmem_unuse' with type 'int(unsigned int)'
>    86 | int shmem_unuse(unsigned int type);
>       |     ^~~~~~~~~~~

This is "mm: simplify try_to_unuse" in akpm's tree.

It needs a fix that looks something like this:

+++ b/mm/shmem.c
@@ -3990,7 +3990,7 @@ int __init shmem_init(void)
        return 0;
 }

-int shmem_unuse(unsigned int type, unsigned long *fs_pages_to_unuse)
+int shmem_unuse(unsigned int type)
 {
        return 0;
 }


^ permalink raw reply

* [RFC][PATCH] cifs: Use netfslib and fscache rewrite
From: David Howells @ 2022-01-05 17:40 UTC (permalink / raw)
  To: Steve French, Shyam Prasad N; +Cc: dhowells, jlayton, linux-cifs, linux-cachefs

Hi Steve, Shyam,

Here's an updated patch to make cifs use netfslib for reading.  It's built on
top of my fscache-rewrite branch.  It seems to work - at least for ordinary
unencrypted reads.

The xarray iov_iter is passed from cifs_req_issue_op(), which is called by
netfslib, down to sock_recvmsg() rather than populating the page array and
using readpages_fill_pages().

cifs_readpages_copy_into_pages() is more problematic - and I haven't fixed it
yet.  The problem is that I have two iterators and I need to simply copy data
from one to the other, but there's no convenient way to do that as yet.

David
---
 fs/cifs/Kconfig     |    1 
 fs/cifs/cifsglob.h  |    2 
 fs/cifs/cifsproto.h |    3 
 fs/cifs/cifssmb.c   |   16 +
 fs/cifs/connect.c   |   18 +
 fs/cifs/file.c      |  582 ++++++++++++++--------------------------------------
 fs/cifs/fscache.c   |   35 ---
 fs/cifs/fscache.h   |   52 ----
 fs/cifs/smb2pdu.c   |   10 
 9 files changed, 201 insertions(+), 518 deletions(-)

diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig
index 3b7e3b9e4fd2..c47e2d3a101f 100644
--- a/fs/cifs/Kconfig
+++ b/fs/cifs/Kconfig
@@ -2,6 +2,7 @@
 config CIFS
 	tristate "SMB3 and CIFS support (advanced network filesystem)"
 	depends on INET
+	select NETFS_SUPPORT
 	select NLS
 	select CRYPTO
 	select CRYPTO_MD5
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index ba6fbb1ad8f3..a5edae959f60 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1320,6 +1320,7 @@ struct cifs_aio_ctx {
 
 /* asynchronous read support */
 struct cifs_readdata {
+	struct netfs_read_subrequest	*subreq;
 	struct kref			refcount;
 	struct list_head		list;
 	struct completion		done;
@@ -1338,6 +1339,7 @@ struct cifs_readdata {
 	int (*copy_into_pages)(struct TCP_Server_Info *server,
 				struct cifs_readdata *rdata,
 				struct iov_iter *iter);
+	struct iov_iter			iter;
 	struct kvec			iov[2];
 	struct TCP_Server_Info		*server;
 #ifdef CONFIG_CIFS_SMB_DIRECT
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 4f5a3e857df4..99c239dca807 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -237,6 +237,9 @@ extern int cifs_read_page_from_socket(struct TCP_Server_Info *server,
 					unsigned int page_offset,
 					unsigned int to_read);
 extern int cifs_setup_cifs_sb(struct cifs_sb_info *cifs_sb);
+extern int cifs_read_iter_from_socket(struct TCP_Server_Info *server,
+				      struct iov_iter *iter,
+				      unsigned int to_read);
 extern int cifs_match_super(struct super_block *, void *);
 extern int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx);
 extern void cifs_umount(struct cifs_sb_info *);
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 243d17696f06..e068e3bda304 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -23,6 +23,7 @@
 #include <linux/swap.h>
 #include <linux/task_io_accounting_ops.h>
 #include <linux/uaccess.h>
+#include <linux/netfs.h>
 #include "cifspdu.h"
 #include "cifsglob.h"
 #include "cifsacl.h"
@@ -1332,11 +1333,11 @@ int
 cifs_discard_remaining_data(struct TCP_Server_Info *server)
 {
 	unsigned int rfclen = server->pdu_size;
-	int remaining = rfclen + server->vals->header_preamble_size -
+	size_t remaining = rfclen + server->vals->header_preamble_size -
 		server->total_read;
 
 	while (remaining > 0) {
-		int length;
+		ssize_t length;
 
 		length = cifs_discard_from_socket(server,
 				min_t(size_t, remaining,
@@ -1551,7 +1552,15 @@ cifs_readv_callback(struct mid_q_entry *mid)
 		rdata->result = -EIO;
 	}
 
-	queue_work(cifsiod_wq, &rdata->work);
+	if (rdata->subreq) {
+		netfs_subreq_terminated(rdata->subreq,
+					(rdata->result == 0 || rdata->result == -EAGAIN) ?
+					rdata->got_bytes : rdata->result,
+					false);
+		kref_put(&rdata->refcount, cifs_readdata_release);
+	} else {
+		queue_work(cifsiod_wq, &rdata->work);
+	}
 	DeleteMidQEntry(mid);
 	add_credits(server, &credits, 0);
 }
@@ -1996,7 +2005,6 @@ cifs_writev_complete(struct work_struct *work)
 		else if (wdata->result < 0)
 			SetPageError(page);
 		end_page_writeback(page);
-		cifs_readpage_to_fscache(inode, page);
 		put_page(page);
 	}
 	if (wdata->result != -EAGAIN)
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index a52fd3a30c88..f6a145301e34 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -162,7 +162,7 @@ static void cifs_resolve_server(struct work_struct *work)
 	mutex_unlock(&server->srv_mutex);
 }
 
-/**
+/*
  * Mark all sessions and tcons for reconnect.
  *
  * @server needs to be previously set to CifsNeedReconnect.
@@ -656,6 +656,22 @@ cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page,
 	return cifs_readv_from_socket(server, &smb_msg);
 }
 
+int
+cifs_read_iter_from_socket(struct TCP_Server_Info *server, struct iov_iter *iter,
+			   unsigned int to_read)
+{
+	struct msghdr smb_msg;
+	int ret;
+
+	smb_msg.msg_iter = *iter;
+	if (smb_msg.msg_iter.count > to_read)
+		smb_msg.msg_iter.count = to_read;
+	ret = cifs_readv_from_socket(server, &smb_msg);
+	if (ret > 0)
+		iov_iter_advance(iter, ret);
+	return ret;
+}
+
 static bool
 is_smb_response(struct TCP_Server_Info *server, unsigned char type)
 {
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index d872f6fe8e7d..a3b9c0ecf02c 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -21,6 +21,7 @@
 #include <linux/slab.h>
 #include <linux/swap.h>
 #include <linux/mm.h>
+#include <linux/netfs.h>
 #include <asm/div64.h>
 #include "cifsfs.h"
 #include "cifspdu.h"
@@ -2614,6 +2615,7 @@ static int cifs_write_end(struct file *file, struct address_space *mapping,
 	struct inode *inode = mapping->host;
 	struct cifsFileInfo *cfile = file->private_data;
 	struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb);
+	struct folio *folio = page_folio(page);
 	__u32 pid;
 
 	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
@@ -2624,14 +2626,14 @@ static int cifs_write_end(struct file *file, struct address_space *mapping,
 	cifs_dbg(FYI, "write_end for page %p from pos %lld with %d bytes\n",
 		 page, pos, copied);
 
-	if (PageChecked(page)) {
+	if (folio_test_checked(folio)) {
 		if (copied == len)
-			SetPageUptodate(page);
-		ClearPageChecked(page);
-	} else if (!PageUptodate(page) && copied == PAGE_SIZE)
-		SetPageUptodate(page);
+			folio_mark_uptodate(folio);
+		folio_clear_checked(folio);
+	} else if (!folio_test_uptodate(folio) && copied == PAGE_SIZE)
+		folio_mark_uptodate(folio);
 
-	if (!PageUptodate(page)) {
+	if (!folio_test_uptodate(folio)) {
 		char *page_data;
 		unsigned offset = pos & (PAGE_SIZE - 1);
 		unsigned int xid;
@@ -4110,98 +4112,6 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to)
 	return rc;
 }
 
-static ssize_t
-cifs_read(struct file *file, char *read_data, size_t read_size, loff_t *offset)
-{
-	int rc = -EACCES;
-	unsigned int bytes_read = 0;
-	unsigned int total_read;
-	unsigned int current_read_size;
-	unsigned int rsize;
-	struct cifs_sb_info *cifs_sb;
-	struct cifs_tcon *tcon;
-	struct TCP_Server_Info *server;
-	unsigned int xid;
-	char *cur_offset;
-	struct cifsFileInfo *open_file;
-	struct cifs_io_parms io_parms = {0};
-	int buf_type = CIFS_NO_BUFFER;
-	__u32 pid;
-
-	xid = get_xid();
-	cifs_sb = CIFS_FILE_SB(file);
-
-	/* FIXME: set up handlers for larger reads and/or convert to async */
-	rsize = min_t(unsigned int, cifs_sb->ctx->rsize, CIFSMaxBufSize);
-
-	if (file->private_data == NULL) {
-		rc = -EBADF;
-		free_xid(xid);
-		return rc;
-	}
-	open_file = file->private_data;
-	tcon = tlink_tcon(open_file->tlink);
-	server = cifs_pick_channel(tcon->ses);
-
-	if (!server->ops->sync_read) {
-		free_xid(xid);
-		return -ENOSYS;
-	}
-
-	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
-		pid = open_file->pid;
-	else
-		pid = current->tgid;
-
-	if ((file->f_flags & O_ACCMODE) == O_WRONLY)
-		cifs_dbg(FYI, "attempting read on write only file instance\n");
-
-	for (total_read = 0, cur_offset = read_data; read_size > total_read;
-	     total_read += bytes_read, cur_offset += bytes_read) {
-		do {
-			current_read_size = min_t(uint, read_size - total_read,
-						  rsize);
-			/*
-			 * For windows me and 9x we do not want to request more
-			 * than it negotiated since it will refuse the read
-			 * then.
-			 */
-			if (!(tcon->ses->capabilities &
-				tcon->ses->server->vals->cap_large_files)) {
-				current_read_size = min_t(uint,
-					current_read_size, CIFSMaxBufSize);
-			}
-			if (open_file->invalidHandle) {
-				rc = cifs_reopen_file(open_file, true);
-				if (rc != 0)
-					break;
-			}
-			io_parms.pid = pid;
-			io_parms.tcon = tcon;
-			io_parms.offset = *offset;
-			io_parms.length = current_read_size;
-			io_parms.server = server;
-			rc = server->ops->sync_read(xid, &open_file->fid, &io_parms,
-						    &bytes_read, &cur_offset,
-						    &buf_type);
-		} while (rc == -EAGAIN);
-
-		if (rc || (bytes_read == 0)) {
-			if (total_read) {
-				break;
-			} else {
-				free_xid(xid);
-				return rc;
-			}
-		} else {
-			cifs_stats_bytes_read(tcon, total_read);
-			*offset += bytes_read;
-		}
-	}
-	free_xid(xid);
-	return total_read;
-}
-
 /*
  * If the page is mmap'ed into a process' page tables, then we need to make
  * sure that it doesn't change while being written back.
@@ -4211,13 +4121,19 @@ cifs_page_mkwrite(struct vm_fault *vmf)
 {
 	struct page *page = vmf->page;
 
+	/* Wait for the page to be written to the cache before we allow it to
+	 * be modified.  We then assume the entire page will need writing back.
+	 */
 #ifdef CONFIG_CIFS_FSCACHE
 	if (PageFsCache(page) &&
 	    wait_on_page_fscache_killable(page) < 0)
 		return VM_FAULT_RETRY;
 #endif
 
-	lock_page(page);
+	wait_on_page_writeback(page);
+
+	if (lock_page_killable(page) < 0)
+		return VM_FAULT_RETRY;
 	return VM_FAULT_LOCKED;
 }
 
@@ -4264,40 +4180,6 @@ int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
 	return rc;
 }
 
-static void
-cifs_readv_complete(struct work_struct *work)
-{
-	unsigned int i, got_bytes;
-	struct cifs_readdata *rdata = container_of(work,
-						struct cifs_readdata, work);
-
-	got_bytes = rdata->got_bytes;
-	for (i = 0; i < rdata->nr_pages; i++) {
-		struct page *page = rdata->pages[i];
-
-		lru_cache_add(page);
-
-		if (rdata->result == 0 ||
-		    (rdata->result == -EAGAIN && got_bytes)) {
-			flush_dcache_page(page);
-			SetPageUptodate(page);
-		} else
-			SetPageError(page);
-
-		unlock_page(page);
-
-		if (rdata->result == 0 ||
-		    (rdata->result == -EAGAIN && got_bytes))
-			cifs_readpage_to_fscache(rdata->mapping->host, page);
-
-		got_bytes -= min_t(unsigned int, PAGE_SIZE, got_bytes);
-
-		put_page(page);
-		rdata->pages[i] = NULL;
-	}
-	kref_put(&rdata->refcount, cifs_readdata_release);
-}
-
 static int
 readpages_fill_pages(struct TCP_Server_Info *server,
 		     struct cifs_readdata *rdata, struct iov_iter *iter,
@@ -4372,8 +4254,7 @@ readpages_fill_pages(struct TCP_Server_Info *server,
 			result = n;
 #endif
 		else
-			result = cifs_read_page_from_socket(
-					server, page, page_offset, n);
+			result = cifs_read_iter_from_socket(server, &rdata->iter, n);
 		if (result < 0)
 			break;
 
@@ -4388,7 +4269,12 @@ static int
 cifs_readpages_read_into_pages(struct TCP_Server_Info *server,
 			       struct cifs_readdata *rdata, unsigned int len)
 {
-	return readpages_fill_pages(server, rdata, NULL, len);
+	int rc;
+
+	rc = cifs_read_iter_from_socket(server, &rdata->iter, len);
+	if (rc > 0)
+		rdata->got_bytes += rc;
+	return rc;
 }
 
 static int
@@ -4396,292 +4282,158 @@ cifs_readpages_copy_into_pages(struct TCP_Server_Info *server,
 			       struct cifs_readdata *rdata,
 			       struct iov_iter *iter)
 {
+	printk("cifs_readpages_copy_into_pages\n");
 	return readpages_fill_pages(server, rdata, iter, iter->count);
 }
 
-static int
-readpages_get_pages(struct address_space *mapping, struct list_head *page_list,
-		    unsigned int rsize, struct list_head *tmplist,
-		    unsigned int *nr_pages, loff_t *offset, unsigned int *bytes)
-{
-	struct page *page, *tpage;
-	unsigned int expected_index;
-	int rc;
-	gfp_t gfp = readahead_gfp_mask(mapping);
-
-	INIT_LIST_HEAD(tmplist);
-
-	page = lru_to_page(page_list);
-
-	/*
-	 * Lock the page and put it in the cache. Since no one else
-	 * should have access to this page, we're safe to simply set
-	 * PG_locked without checking it first.
-	 */
-	__SetPageLocked(page);
-	rc = add_to_page_cache_locked(page, mapping,
-				      page->index, gfp);
-
-	/* give up if we can't stick it in the cache */
-	if (rc) {
-		__ClearPageLocked(page);
-		return rc;
-	}
-
-	/* move first page to the tmplist */
-	*offset = (loff_t)page->index << PAGE_SHIFT;
-	*bytes = PAGE_SIZE;
-	*nr_pages = 1;
-	list_move_tail(&page->lru, tmplist);
-
-	/* now try and add more pages onto the request */
-	expected_index = page->index + 1;
-	list_for_each_entry_safe_reverse(page, tpage, page_list, lru) {
-		/* discontinuity ? */
-		if (page->index != expected_index)
-			break;
-
-		/* would this page push the read over the rsize? */
-		if (*bytes + PAGE_SIZE > rsize)
-			break;
-
-		__SetPageLocked(page);
-		rc = add_to_page_cache_locked(page, mapping, page->index, gfp);
-		if (rc) {
-			__ClearPageLocked(page);
-			break;
-		}
-		list_move_tail(&page->lru, tmplist);
-		(*bytes) += PAGE_SIZE;
-		expected_index++;
-		(*nr_pages)++;
-	}
-	return rc;
-}
-
-static int cifs_readpages(struct file *file, struct address_space *mapping,
-	struct list_head *page_list, unsigned num_pages)
+/*
+ * Issue a read operation on behalf of the netfs helper functions.  We're asked
+ * to make a read of a certain size at a point in the file.  We are permitted
+ * to only read a portion of that, but as long as we read something, the netfs
+ * helper will call us again so that we can issue another read.
+ */
+static void cifs_req_issue_op(struct netfs_read_subrequest *subreq)
 {
-	int rc;
-	int err = 0;
-	struct list_head tmplist;
-	struct cifsFileInfo *open_file = file->private_data;
-	struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file);
+	struct netfs_read_request *rreq = subreq->rreq;
 	struct TCP_Server_Info *server;
-	pid_t pid;
+	struct cifs_readdata *rdata;
+	struct cifsFileInfo *open_file = rreq->netfs_priv;
+	struct cifs_sb_info *cifs_sb = CIFS_SB(rreq->inode->i_sb);
+	struct cifs_credits credits_on_stack, *credits = &credits_on_stack;
 	unsigned int xid;
+	pid_t pid;
+	int rc = 0;
+	unsigned int rsize;
 
 	xid = get_xid();
-	/*
-	 * Reads as many pages as possible from fscache. Returns -ENOBUFS
-	 * immediately if the cookie is negative
-	 *
-	 * After this point, every page in the list might have PG_fscache set,
-	 * so we will need to clean that up off of every page we don't use.
-	 */
-	rc = cifs_readpages_from_fscache(mapping->host, mapping, page_list,
-					 &num_pages);
-	if (rc == 0) {
-		free_xid(xid);
-		return rc;
-	}
 
 	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
 		pid = open_file->pid;
 	else
-		pid = current->tgid;
+		pid = current->tgid; // Ummm...  This may be a workqueue
 
-	rc = 0;
 	server = cifs_pick_channel(tlink_tcon(open_file->tlink)->ses);
 
-	cifs_dbg(FYI, "%s: file=%p mapping=%p num_pages=%u\n",
-		 __func__, file, mapping, num_pages);
+	cifs_dbg(FYI, "%s: op=%08x[%x] mapping=%p len=%zu/%zu\n",
+		 __func__, rreq->debug_id, subreq->debug_index, rreq->mapping,
+		 subreq->transferred, subreq->len);
 
-	/*
-	 * Start with the page at end of list and move it to private
-	 * list. Do the same with any following pages until we hit
-	 * the rsize limit, hit an index discontinuity, or run out of
-	 * pages. Issue the async read and then start the loop again
-	 * until the list is empty.
-	 *
-	 * Note that list order is important. The page_list is in
-	 * the order of declining indexes. When we put the pages in
-	 * the rdata->pages, then we want them in increasing order.
-	 */
-	while (!list_empty(page_list) && !err) {
-		unsigned int i, nr_pages, bytes, rsize;
-		loff_t offset;
-		struct page *page, *tpage;
-		struct cifs_readdata *rdata;
-		struct cifs_credits credits_on_stack;
-		struct cifs_credits *credits = &credits_on_stack;
-
-		if (open_file->invalidHandle) {
+	if (open_file->invalidHandle) {
+		do {
 			rc = cifs_reopen_file(open_file, true);
-			if (rc == -EAGAIN)
-				continue;
-			else if (rc)
-				break;
-		}
-
-		rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize,
-						   &rsize, credits);
+		} while (rc == -EAGAIN);
 		if (rc)
-			break;
-
-		/*
-		 * Give up immediately if rsize is too small to read an entire
-		 * page. The VFS will fall back to readpage. We should never
-		 * reach this point however since we set ra_pages to 0 when the
-		 * rsize is smaller than a cache page.
-		 */
-		if (unlikely(rsize < PAGE_SIZE)) {
-			add_credits_and_wake_if(server, credits, 0);
-			free_xid(xid);
-			return 0;
-		}
-
-		nr_pages = 0;
-		err = readpages_get_pages(mapping, page_list, rsize, &tmplist,
-					 &nr_pages, &offset, &bytes);
-		if (!nr_pages) {
-			add_credits_and_wake_if(server, credits, 0);
-			break;
-		}
-
-		rdata = cifs_readdata_alloc(nr_pages, cifs_readv_complete);
-		if (!rdata) {
-			/* best to give up if we're out of mem */
-			list_for_each_entry_safe(page, tpage, &tmplist, lru) {
-				list_del(&page->lru);
-				lru_cache_add(page);
-				unlock_page(page);
-				put_page(page);
-			}
-			rc = -ENOMEM;
-			add_credits_and_wake_if(server, credits, 0);
-			break;
-		}
+			goto out;
+	}
 
-		rdata->cfile = cifsFileInfo_get(open_file);
-		rdata->server = server;
-		rdata->mapping = mapping;
-		rdata->offset = offset;
-		rdata->bytes = bytes;
-		rdata->pid = pid;
-		rdata->pagesz = PAGE_SIZE;
-		rdata->tailsz = PAGE_SIZE;
-		rdata->read_into_pages = cifs_readpages_read_into_pages;
-		rdata->copy_into_pages = cifs_readpages_copy_into_pages;
-		rdata->credits = credits_on_stack;
+	rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize, &rsize, credits);
+	if (rc)
+		goto out;
 
-		list_for_each_entry_safe(page, tpage, &tmplist, lru) {
-			list_del(&page->lru);
-			rdata->pages[rdata->nr_pages++] = page;
-		}
+	rdata = cifs_readdata_alloc(0, NULL);
+	if (!rdata) {
+		add_credits_and_wake_if(server, credits, 0);
+		rc = -ENOMEM;
+		goto out;
+	}
 
-		rc = adjust_credits(server, &rdata->credits, rdata->bytes);
+	rdata->subreq = subreq;
+	rdata->cfile = cifsFileInfo_get(open_file);
+	rdata->server = server;
+	rdata->mapping = rreq->mapping;
+	rdata->offset = subreq->start + subreq->transferred;
+	rdata->bytes = subreq->len   - subreq->transferred;
+	rdata->pid = pid;
+	rdata->pagesz = PAGE_SIZE;
+	rdata->tailsz = PAGE_SIZE;
+	rdata->read_into_pages = cifs_readpages_read_into_pages;
+	rdata->copy_into_pages = cifs_readpages_copy_into_pages;
+	rdata->credits = credits_on_stack;
 
-		if (!rc) {
-			if (rdata->cfile->invalidHandle)
-				rc = -EAGAIN;
-			else
-				rc = server->ops->async_readv(rdata);
-		}
+	iov_iter_xarray(&rdata->iter, READ, &rreq->mapping->i_pages,
+			rdata->offset, rdata->bytes);
 
-		if (rc) {
-			add_credits_and_wake_if(server, &rdata->credits, 0);
-			for (i = 0; i < rdata->nr_pages; i++) {
-				page = rdata->pages[i];
-				lru_cache_add(page);
-				unlock_page(page);
-				put_page(page);
-			}
-			/* Fallback to the readpage in error/reconnect cases */
-			kref_put(&rdata->refcount, cifs_readdata_release);
-			break;
-		}
+	rc = adjust_credits(server, &rdata->credits, rdata->bytes);
+	if (!rc) {
+		if (rdata->cfile->invalidHandle)
+			rc = -EAGAIN;
+		else
+			rc = server->ops->async_readv(rdata);
+	}
 
+	if (rc) {
+		add_credits_and_wake_if(server, &rdata->credits, 0);
+		/* Fallback to the readpage in error/reconnect cases */
 		kref_put(&rdata->refcount, cifs_readdata_release);
 	}
 
+	kref_put(&rdata->refcount, cifs_readdata_release);
+
+out:
 	free_xid(xid);
-	return rc;
+	if (rc)
+		netfs_subreq_terminated(subreq, rc, false);
+}
+
+static void cifs_init_rreq(struct netfs_read_request *rreq, struct file *file)
+{
+	rreq->netfs_priv = file->private_data;
 }
 
 /*
- * cifs_readpage_worker must be called with the page pinned
+ * Expand the size of a readahead to the size of the rsize, if at least as
+ * large as a page, allowing for the possibility that rsize is not pow-2
+ * aligned.
  */
-static int cifs_readpage_worker(struct file *file, struct page *page,
-	loff_t *poffset)
+static void cifs_expand_readahead(struct netfs_read_request *rreq)
 {
-	char *read_data;
-	int rc;
-
-	/* Is the page cached? */
-	rc = cifs_readpage_from_fscache(file_inode(file), page);
-	if (rc == 0)
-		goto read_complete;
-
-	read_data = kmap(page);
-	/* for reads over a certain size could initiate async read ahead */
-
-	rc = cifs_read(file, read_data, PAGE_SIZE, poffset);
+	struct cifs_sb_info *cifs_sb = CIFS_SB(rreq->inode->i_sb);
+	unsigned int rsize = cifs_sb->ctx->rsize;
+	loff_t misalignment, i_size = i_size_read(rreq->inode);
 
-	if (rc < 0)
-		goto io_error;
-	else
-		cifs_dbg(FYI, "Bytes read %d\n", rc);
+	if (rsize < PAGE_SIZE)
+		return;
 
-	/* we do not want atime to be less than mtime, it broke some apps */
-	file_inode(file)->i_atime = current_time(file_inode(file));
-	if (timespec64_compare(&(file_inode(file)->i_atime), &(file_inode(file)->i_mtime)))
-		file_inode(file)->i_atime = file_inode(file)->i_mtime;
+	if (rsize < INT_MAX)
+		rsize = roundup_pow_of_two(rsize);
 	else
-		file_inode(file)->i_atime = current_time(file_inode(file));
-
-	if (PAGE_SIZE > rc)
-		memset(read_data + rc, 0, PAGE_SIZE - rc);
-
-	flush_dcache_page(page);
-	SetPageUptodate(page);
-
-	/* send this page to the cache */
-	cifs_readpage_to_fscache(file_inode(file), page);
-
-	rc = 0;
+		rsize = ((unsigned int)INT_MAX + 1) / 2;
 
-io_error:
-	kunmap(page);
-	unlock_page(page);
+	misalignment = rreq->start & (rsize - 1);
+	if (misalignment) {
+		rreq->start -= misalignment;
+		rreq->len += misalignment;
+	}
 
-read_complete:
-	return rc;
+	rreq->len = round_up(rreq->len, rsize);
+	if (rreq->start < i_size && rreq->len > i_size - rreq->start)
+		rreq->len = i_size - rreq->start;
 }
 
-static int cifs_readpage(struct file *file, struct page *page)
+static void cifs_rreq_done(struct netfs_read_request *rreq)
 {
-	loff_t offset = page_file_offset(page);
-	int rc = -EACCES;
-	unsigned int xid;
-
-	xid = get_xid();
-
-	if (file->private_data == NULL) {
-		rc = -EBADF;
-		free_xid(xid);
-		return rc;
-	}
-
-	cifs_dbg(FYI, "readpage %p at offset %d 0x%x\n",
-		 page, (int)offset, (int)offset);
+	struct inode *inode = rreq->inode;
 
-	rc = cifs_readpage_worker(file, page, &offset);
+	/* we do not want atime to be less than mtime, it broke some apps */
+	inode->i_atime = current_time(inode);
+	if (timespec64_compare(&inode->i_atime, &inode->i_mtime))
+		inode->i_atime = inode->i_mtime;
+	else
+		inode->i_atime = current_time(inode);
+}
 
-	free_xid(xid);
-	return rc;
+static void cifs_req_cleanup(struct address_space *mapping, void *netfs_priv)
+{
 }
 
+const struct netfs_read_request_ops cifs_req_ops = {
+	.init_rreq		= cifs_init_rreq,
+	.expand_readahead	= cifs_expand_readahead,
+	.issue_op		= cifs_req_issue_op,
+	.done			= cifs_rreq_done,
+	.cleanup		= cifs_req_cleanup,
+};
+
 static int is_inode_writable(struct cifsInodeInfo *cifs_inode)
 {
 	struct cifsFileInfo *open_file;
@@ -4731,34 +4483,21 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping,
 			loff_t pos, unsigned len, unsigned flags,
 			struct page **pagep, void **fsdata)
 {
-	int oncethru = 0;
-	pgoff_t index = pos >> PAGE_SHIFT;
-	loff_t offset = pos & (PAGE_SIZE - 1);
-	loff_t page_start = pos & PAGE_MASK;
-	loff_t i_size;
-	struct page *page;
-	int rc = 0;
+	struct folio *folio;
+	int rc;
 
 	cifs_dbg(FYI, "write_begin from %lld len %d\n", (long long)pos, len);
 
-start:
-	page = grab_cache_page_write_begin(mapping, index, flags);
-	if (!page) {
-		rc = -ENOMEM;
-		goto out;
-	}
-
-	if (PageUptodate(page))
-		goto out;
-
-	/*
-	 * If we write a full page it will be up to date, no need to read from
-	 * the server. If the write is short, we'll end up doing a sync write
-	 * instead.
+	/* Prefetch area to be written into the cache if we're caching this
+	 * file.  We need to do this before we get a lock on the page in case
+	 * there's more than one writer competing for the same cache block.
 	 */
-	if (len == PAGE_SIZE)
-		goto out;
+	rc = netfs_write_begin(file, mapping, pos, len, flags, &folio, fsdata,
+			       &cifs_req_ops, NULL);
+	if (rc < 0)
+		return rc;
 
+#if 0
 	/*
 	 * optimize away the read when we have an oplock, and we're not
 	 * expecting to use any of the data we'd be reading in. That
@@ -4773,34 +4512,17 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping,
 					   offset + len,
 					   PAGE_SIZE);
 			/*
-			 * PageChecked means that the parts of the page
-			 * to which we're not writing are considered up
-			 * to date. Once the data is copied to the
-			 * page, it can be set uptodate.
+			 * Marking a folio checked means that the parts of the
+			 * page to which we're not writing are considered up to
+			 * date. Once the data is copied to the page, it can be
+			 * set uptodate.
 			 */
-			SetPageChecked(page);
+			folio_set_checked(folio);
 			goto out;
 		}
 	}
-
-	if ((file->f_flags & O_ACCMODE) != O_WRONLY && !oncethru) {
-		/*
-		 * might as well read a page, it is fast enough. If we get
-		 * an error, we don't need to return it. cifs_write_end will
-		 * do a sync write instead since PG_uptodate isn't set.
-		 */
-		cifs_readpage_worker(file, page, &page_start);
-		put_page(page);
-		oncethru = 1;
-		goto start;
-	} else {
-		/* we could try using another file handle if there is one -
-		   but how would we lock it to prevent close of that handle
-		   racing with this read? In any case
-		   this will be written out by write_end so is fine */
-	}
-out:
-	*pagep = page;
+#endif
+	*pagep = folio_page(folio, pos / PAGE_SIZE);
 	return rc;
 }
 
@@ -5010,9 +4732,19 @@ static int cifs_set_page_dirty(struct page *page)
 #define cifs_set_page_dirty __set_page_dirty_nobuffers
 #endif
 
+static int cifs_readpage(struct file *file, struct page *page)
+{
+	return netfs_readpage(file, page_folio(page), &cifs_req_ops, NULL);
+}
+
+static void cifs_readahead(struct readahead_control *ractl)
+{
+	netfs_readahead(ractl, &cifs_req_ops, NULL);
+}
+
 const struct address_space_operations cifs_addr_ops = {
 	.readpage = cifs_readpage,
-	.readpages = cifs_readpages,
+	.readahead = cifs_readahead,
 	.writepage = cifs_writepage,
 	.writepages = cifs_writepages,
 	.write_begin = cifs_write_begin,
diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c
index efaac4d5ff55..76e1edc99aec 100644
--- a/fs/cifs/fscache.c
+++ b/fs/cifs/fscache.c
@@ -133,38 +133,3 @@ void cifs_fscache_release_inode_cookie(struct inode *inode)
 		cifsi->fscache = NULL;
 	}
 }
-
-/*
- * Retrieve a page from FS-Cache
- */
-int __cifs_readpage_from_fscache(struct inode *inode, struct page *page)
-{
-	cifs_dbg(FYI, "%s: (fsc:%p, p:%p, i:0x%p\n",
-		 __func__, CIFS_I(inode)->fscache, page, inode);
-	return -ENOBUFS; // Needs conversion to using netfslib
-}
-
-/*
- * Retrieve a set of pages from FS-Cache
- */
-int __cifs_readpages_from_fscache(struct inode *inode,
-				struct address_space *mapping,
-				struct list_head *pages,
-				unsigned *nr_pages)
-{
-	cifs_dbg(FYI, "%s: (0x%p/%u/0x%p)\n",
-		 __func__, CIFS_I(inode)->fscache, *nr_pages, inode);
-	return -ENOBUFS; // Needs conversion to using netfslib
-}
-
-void __cifs_readpage_to_fscache(struct inode *inode, struct page *page)
-{
-	struct cifsInodeInfo *cifsi = CIFS_I(inode);
-
-	WARN_ON(!cifsi->fscache);
-
-	cifs_dbg(FYI, "%s: (fsc: %p, p: %p, i: %p)\n",
-		 __func__, cifsi->fscache, page, inode);
-
-	// Needs conversion to using netfslib
-}
diff --git a/fs/cifs/fscache.h b/fs/cifs/fscache.h
index 0fc3f9252c84..9718feac1d68 100644
--- a/fs/cifs/fscache.h
+++ b/fs/cifs/fscache.h
@@ -58,46 +58,11 @@ void cifs_fscache_fill_coherency(struct inode *inode,
 }
 
 
-extern int cifs_fscache_release_page(struct page *page, gfp_t gfp);
-extern int __cifs_readpage_from_fscache(struct inode *, struct page *);
-extern int __cifs_readpages_from_fscache(struct inode *,
-					 struct address_space *,
-					 struct list_head *,
-					 unsigned *);
-extern void __cifs_readpage_to_fscache(struct inode *, struct page *);
-
 static inline struct fscache_cookie *cifs_inode_cookie(struct inode *inode)
 {
 	return CIFS_I(inode)->fscache;
 }
 
-static inline int cifs_readpage_from_fscache(struct inode *inode,
-					     struct page *page)
-{
-	if (CIFS_I(inode)->fscache)
-		return __cifs_readpage_from_fscache(inode, page);
-
-	return -ENOBUFS;
-}
-
-static inline int cifs_readpages_from_fscache(struct inode *inode,
-					      struct address_space *mapping,
-					      struct list_head *pages,
-					      unsigned *nr_pages)
-{
-	if (CIFS_I(inode)->fscache)
-		return __cifs_readpages_from_fscache(inode, mapping, pages,
-						     nr_pages);
-	return -ENOBUFS;
-}
-
-static inline void cifs_readpage_to_fscache(struct inode *inode,
-					    struct page *page)
-{
-	if (PageFsCache(page))
-		__cifs_readpage_to_fscache(inode, page);
-}
-
 #else /* CONFIG_CIFS_FSCACHE */
 static inline
 void cifs_fscache_fill_coherency(struct inode *inode,
@@ -113,23 +78,6 @@ static inline void cifs_fscache_release_inode_cookie(struct inode *inode) {}
 static inline void cifs_fscache_unuse_inode_cookie(struct inode *inode, bool update) {}
 static inline struct fscache_cookie *cifs_inode_cookie(struct inode *inode) { return NULL; }
 
-static inline int
-cifs_readpage_from_fscache(struct inode *inode, struct page *page)
-{
-	return -ENOBUFS;
-}
-
-static inline int cifs_readpages_from_fscache(struct inode *inode,
-					      struct address_space *mapping,
-					      struct list_head *pages,
-					      unsigned *nr_pages)
-{
-	return -ENOBUFS;
-}
-
-static inline void cifs_readpage_to_fscache(struct inode *inode,
-			struct page *page) {}
-
 #endif /* CONFIG_CIFS_FSCACHE */
 
 #endif /* _CIFS_FSCACHE_H */
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 8b3670388cda..ea2f8a2d9e57 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -23,6 +23,7 @@
 #include <linux/uuid.h>
 #include <linux/pagemap.h>
 #include <linux/xattr.h>
+#include <linux/netfs.h>
 #include "cifsglob.h"
 #include "cifsacl.h"
 #include "cifsproto.h"
@@ -4084,7 +4085,14 @@ smb2_readv_callback(struct mid_q_entry *mid)
 				     tcon->tid, tcon->ses->Suid,
 				     rdata->offset, rdata->got_bytes);
 
-	queue_work(cifsiod_wq, &rdata->work);
+	if (rdata->subreq) {
+		netfs_subreq_terminated(rdata->subreq,
+					(rdata->result == 0 || rdata->result == -EAGAIN) ?
+					rdata->got_bytes : rdata->result, false);
+		kref_put(&rdata->refcount, cifs_readdata_release);
+	} else {
+		queue_work(cifsiod_wq, &rdata->work);
+	}
 	DeleteMidQEntry(mid);
 	add_credits(server, &credits, 0);
 }


^ permalink raw reply related

* Re: [PATCH] drm/bridge: Add missing pm_runtime_disable() in __dw_mipi_dsi_probe
From: Robert Foss @ 2022-01-05 17:41 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Archit Taneja, Jonas Karlman, David Airlie, Tomi Valkeinen,
	dri-devel, Neil Armstrong, Philippe CORNU, Jernej Skrabec,
	linux-kernel, Andrzej Hajda, Laurent Pinchart, Jagan Teki
In-Reply-To: <20220105104113.31415-1-linmq006@gmail.com>

Hey,

Thanks for submitting this fix.

On Wed, 5 Jan 2022 at 11:41, Miaoqian Lin <linmq006@gmail.com> wrote:
>
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
> Add missing pm_runtime_disable() for __dw_mipi_dsi_probe.
>
> Fixes: 46fc515 ("drm/bridge/synopsys: Add MIPI DSI host controller bridge")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> index e44e18a0112a..56c3fd08c6a0 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> @@ -1199,6 +1199,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
>         ret = mipi_dsi_host_register(&dsi->dsi_host);
>         if (ret) {
>                 dev_err(dev, "Failed to register MIPI host: %d\n", ret);
> +               pm_runtime_disable(dev);
>                 dw_mipi_dsi_debugfs_remove(dsi);
>                 return ERR_PTR(ret);
>         }
> --
> 2.17.1
>

Added r-b tag and applied to drm-misc-next

Reviewed-by: Robert Foss <robert.foss@linaro.org>

^ permalink raw reply

* Re: [PATCH] drm/bridge: Add missing pm_runtime_disable() in __dw_mipi_dsi_probe
From: Robert Foss @ 2022-01-05 17:41 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Andrzej Hajda, Neil Armstrong, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec, David Airlie, Daniel Vetter, Tomi Valkeinen,
	Jagan Teki, Philippe CORNU, Archit Taneja, dri-devel,
	linux-kernel
In-Reply-To: <20220105104113.31415-1-linmq006@gmail.com>

Hey,

Thanks for submitting this fix.

On Wed, 5 Jan 2022 at 11:41, Miaoqian Lin <linmq006@gmail.com> wrote:
>
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
> Add missing pm_runtime_disable() for __dw_mipi_dsi_probe.
>
> Fixes: 46fc515 ("drm/bridge/synopsys: Add MIPI DSI host controller bridge")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> index e44e18a0112a..56c3fd08c6a0 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> @@ -1199,6 +1199,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
>         ret = mipi_dsi_host_register(&dsi->dsi_host);
>         if (ret) {
>                 dev_err(dev, "Failed to register MIPI host: %d\n", ret);
> +               pm_runtime_disable(dev);
>                 dw_mipi_dsi_debugfs_remove(dsi);
>                 return ERR_PTR(ret);
>         }
> --
> 2.17.1
>

Added r-b tag and applied to drm-misc-next

Reviewed-by: Robert Foss <robert.foss@linaro.org>

^ permalink raw reply

* Re: [PATCH 06/13] media: davinci: vpif: Use platform_get_irq_optional() to get the interrupt
From: Lad, Prabhakar @ 2022-01-05 17:41 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Lad Prabhakar, Linux Media Mailing List, Mauro Carvalho Chehab,
	Hans Verkuil, Rob Herring, Linux Kernel Mailing List,
	Linux-Renesas
In-Reply-To: <CAHp75Vck43wj650k70MsUNvmb+_-PUCd5mSy=dvmuX7MaAwr2w@mail.gmail.com>

Hi Andy,

On Wed, Jan 5, 2022 at 9:43 AM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Tue, Jan 4, 2022 at 7:23 PM Lad, Prabhakar
> <prabhakar.csengg@gmail.com> wrote:
> > On Sat, Dec 25, 2021 at 5:32 PM Andy Shevchenko
> > <andy.shevchenko@gmail.com> wrote:
> > > On Sat, Dec 25, 2021 at 3:04 AM Lad Prabhakar
> > > <prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
>
> ...
>
> > > > +       res_irq->flags = IORESOURCE_IRQ | irq_get_trigger_type(irq);
> > > > +       res_irq->start = irq;
> > > > +       res_irq->end = irq;
> > > > +       res_irq->name = dev_of_node(&pdev->dev) ? of_node_full_name(pdev->dev.of_node) : NULL;
> > >
> > > If you convert DEFINE_RES_NAMED() to return a compound literal, then
> > > you may use it here like
> > >
> > > res_irq = DEFINE_RES_NAMED(...);
> > >
> > > or even do like this
> > >
> > > if (dev_of_node(...))
> > >   res_irq = DEFINE_RES_IRQ_NAMED(...)
> > > else
> > >   res_irq = DEFINE_RES_IRQ(...);
> > > res_irq->flags |= irq_get_trigger_type(irq);
> > >
> > There are quite a few users of DEFINE_RES_IRQ_NAMED()/DEFINE_RES_IRQ()
> > changing this macos just for this single user tree wide doesn't make
> > sense. Let me know if you think otherwise.
>
> Converting them to produce compound literal is straightforward and
> does not require changes in the users. But on the other hand it allows
> you to use it and convert existing users to use that form directly.
> You may conduct research on how macros in the property.h were morphing
> towards that.
>
Thank you for the pointer. I did the below change for this.

diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 8359c50f9988..da1208e8f164 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -153,7 +153,7 @@ enum {

 /* helpers to define resources */
 #define DEFINE_RES_NAMED(_start, _size, _name, _flags)                 \
-       {                                                               \
+       (struct resource) {                                     \
                .start = (_start),                                      \
                .end = (_start) + (_size) - 1,                          \
                .name = (_name),                                        \

But there are some instances which need to be touched, for example
vexpress-sysreg.c [1]. Are you OK with files to be changed?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mfd/vexpress-sysreg.c?h=v5.16-rc8#n65

Cheers,
Prabhakar

^ permalink raw reply related

* [Intel-wired-lan] [RFC 01/32] Kconfig: introduce and depend on LEGACY_PCI
From: John Garry @ 2022-01-05 17:42 UTC (permalink / raw)
  To: intel-wired-lan
In-Reply-To: <e0877e91d7d50299ea5a3ffcee2cf1016458ce10.camel@linux.ibm.com>

On 29/12/2021 16:55, Niklas Schnelle wrote:
> On Wed, 2021-12-29 at 10:03 -0600, Bjorn Helgaas wrote:
>> On Wed, Dec 29, 2021 at 01:12:07PM +0100, Mauro Carvalho Chehab wrote:
>>> Em Wed, 29 Dec 2021 12:45:38 +0100
>>> Niklas Schnelle<schnelle@linux.ibm.com>  escreveu:
>>>> ...
>>>> I do think we agree that once done correctly there is value in
>>>> such an option independent of HAS_IOPORT only gating inb() etc uses.
>> I'm not sure I'm convinced about this.  For s390, you could do this
>> patch series, where you don't define inb() at all, and you add new
>> dependencies to prevent compile errors.  Or you could define inb() to
>> return ~0, which is what happens on other platforms when the device is
>> not present.
>>
>>> Personally, I don't see much value on a Kconfig var for legacy PCI I/O
>>> space. From maintenance PoV, bots won't be triggered if someone use
>>> HAS_IOPORT instead of the PCI specific one - or vice-versa. So, we
>>> could end having a mix of both at the wrong places, in long term.
>>>
>>> Also, assuming that PCIe hardware will some day abandon support for
>>> "legacy" PCI I/O space, I guess some runtime logic would be needed,
>>> in order to work with both kinds of PCIe controllers. So, having a
>>> Kconfig option won't help much, IMO.
>>>
>>> So, my personal preference would be to have just one Kconfig var, but
>>> I'm ok if the PCI maintainers decide otherwise.
>> I don't really like the "LEGACY_PCI" Kconfig option.  "Legacy" just
>> means something old and out of favor; it doesn't say*what*  that
>> something is.
>>
>> I think you're specifically interested in I/O port space usage, and it
>> seems that you want all PCI drivers that*only*  use I/O port space to
>> depend on LEGACY_PCI?  Drivers that can use either I/O or memory
>> space or both would not depend on LEGACY_PCI?  This seems a little
>> murky and error-prone.
> I'd like to hear Arnd's opinion on this but you're the PCI maintainer
> so of course your buy-in would be quite important for such an option.
> 

Hi Niklas,

I can't see the value in the LEGACY_PCI config - however I don't really 
understand Arnd's original intention.

It was written that it would allow us to control "whether we have any 
pre-PCIe devices or those PCIe drivers that need PIO accessors other 
than ioport_map()/pci_iomap()".

However I just don't see why CONFIG_PCI=y and CONFIG_HAS_IOPORT=y aren't 
always the gating factor here. Arnd?

Thanks,
John

^ permalink raw reply

* Re: [RFC 01/32] Kconfig: introduce and depend on LEGACY_PCI
From: John Garry @ 2022-01-05 17:42 UTC (permalink / raw)
  To: Niklas Schnelle, Bjorn Helgaas, Mauro Carvalho Chehab,
	Arnd Bergmann
  Cc: Hans Verkuil, Ettore Chimenti, Greg Kroah-Hartman, Arnd Bergmann,
	Bjorn Helgaas, Nick Hu, Greentime Hu, Vincent Chen, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Guo Ren, Damien Le Moal, Ian Abbott,
	H Hartley Sweeten, Linus Walleij, Bartosz Golaszewski,
	Jean Delvare, Guenter Roeck, Dmitry Torokhov, Karsten Keil,
	Sathya Prakash, Sreekanth Reddy, Suganath Prabu Subramani,
	Michael Grzeschik, David S. Miller, Jakub Kicinski,
	Jesse Brandeburg, Tony Nguyen, Kalle Valo, Jouni Malinen,
	James E.J. Bottomley, Martin K. Petersen, Hannes Reinecke,
	Kashyap Desai, Sumit Saxena, Shivasharan S, Nilesh Javali,
	GR-QLogic-Storage-Upstream, Mark Brown, Sudip Mukherjee,
	Teddy Wang, Forest Bond, Jiri Slaby, Wim Van Sebroeck,
	Jaroslav Kysela, Takashi Iwai, linux-kernel, linux-arch,
	linux-pci, linux-riscv, linux-csky, linux-ide, linux-gpio,
	linux-hwmon, linux-i2c, linux-input, netdev, linux-media,
	MPT-FusionLinux.pdl, linux-scsi, intel-wired-lan, linux-wireless,
	megaraidlinux.pdl, linux-spi, linux-fbdev, linux-serial,
	dri-devel, linux-watchdog
In-Reply-To: <e0877e91d7d50299ea5a3ffcee2cf1016458ce10.camel@linux.ibm.com>

On 29/12/2021 16:55, Niklas Schnelle wrote:
> On Wed, 2021-12-29 at 10:03 -0600, Bjorn Helgaas wrote:
>> On Wed, Dec 29, 2021 at 01:12:07PM +0100, Mauro Carvalho Chehab wrote:
>>> Em Wed, 29 Dec 2021 12:45:38 +0100
>>> Niklas Schnelle<schnelle@linux.ibm.com>  escreveu:
>>>> ...
>>>> I do think we agree that once done correctly there is value in
>>>> such an option independent of HAS_IOPORT only gating inb() etc uses.
>> I'm not sure I'm convinced about this.  For s390, you could do this
>> patch series, where you don't define inb() at all, and you add new
>> dependencies to prevent compile errors.  Or you could define inb() to
>> return ~0, which is what happens on other platforms when the device is
>> not present.
>>
>>> Personally, I don't see much value on a Kconfig var for legacy PCI I/O
>>> space. From maintenance PoV, bots won't be triggered if someone use
>>> HAS_IOPORT instead of the PCI specific one - or vice-versa. So, we
>>> could end having a mix of both at the wrong places, in long term.
>>>
>>> Also, assuming that PCIe hardware will some day abandon support for
>>> "legacy" PCI I/O space, I guess some runtime logic would be needed,
>>> in order to work with both kinds of PCIe controllers. So, having a
>>> Kconfig option won't help much, IMO.
>>>
>>> So, my personal preference would be to have just one Kconfig var, but
>>> I'm ok if the PCI maintainers decide otherwise.
>> I don't really like the "LEGACY_PCI" Kconfig option.  "Legacy" just
>> means something old and out of favor; it doesn't say*what*  that
>> something is.
>>
>> I think you're specifically interested in I/O port space usage, and it
>> seems that you want all PCI drivers that*only*  use I/O port space to
>> depend on LEGACY_PCI?  Drivers that can use either I/O or memory
>> space or both would not depend on LEGACY_PCI?  This seems a little
>> murky and error-prone.
> I'd like to hear Arnd's opinion on this but you're the PCI maintainer
> so of course your buy-in would be quite important for such an option.
> 

Hi Niklas,

I can't see the value in the LEGACY_PCI config - however I don't really 
understand Arnd's original intention.

It was written that it would allow us to control "whether we have any 
pre-PCIe devices or those PCIe drivers that need PIO accessors other 
than ioport_map()/pci_iomap()".

However I just don't see why CONFIG_PCI=y and CONFIG_HAS_IOPORT=y aren't 
always the gating factor here. Arnd?

Thanks,
John

^ permalink raw reply


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.