dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/mst: Fix up u64 division
@ 2019-11-06 17:36 Sean Paul
  2019-11-06 18:28 ` Ville Syrjälä
  0 siblings, 1 reply; 5+ messages in thread
From: Sean Paul @ 2019-11-06 17:36 UTC (permalink / raw)
  To: dri-devel
  Cc: Sean Paul, David Airlie, Daniel Vetter, Sean Paul, Juston Li,
	Harry Wentland

From: Sean Paul <seanpaul@chromium.org>

Use do_div to divide rem_nsec instead of /.

Fixes: 12a280c72868 ("drm/dp_mst: Add topology ref history tracking for debugging")
Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sean Paul <sean@poorly.run>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 11adc4b6ccfe..d2da5f113f16 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1512,10 +1512,10 @@ __dump_topology_ref_history(struct drm_dp_mst_topology_ref_history *history,
 		nr_entries = stack_depot_fetch(entry->backtrace, &entries);
 		stack_trace_snprint(buf, PAGE_SIZE, entries, nr_entries, 4);
 
-		drm_printf(&p, "  %d %ss (last at %5llu.%06llu):\n%s",
+		drm_printf(&p, "  %d %ss (last at %5llu.%06u):\n%s",
 			   entry->count,
 			   topology_ref_type_to_str(entry->type),
-			   ts_nsec, rem_nsec / 1000, buf);
+			   ts_nsec, do_div(rem_nsec, 1000), buf);
 	}
 
 	/* Now free the history, since this is the only time we expose it */
-- 
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/mst: Fix up u64 division
  2019-11-06 17:36 [PATCH] drm/mst: Fix up u64 division Sean Paul
@ 2019-11-06 18:28 ` Ville Syrjälä
  2019-11-06 19:41   ` Sean Paul
  0 siblings, 1 reply; 5+ messages in thread
From: Ville Syrjälä @ 2019-11-06 18:28 UTC (permalink / raw)
  To: Sean Paul
  Cc: David Airlie, Daniel Vetter, dri-devel, Sean Paul, Harry Wentland,
	Juston Li

On Wed, Nov 06, 2019 at 12:36:15PM -0500, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> Use do_div to divide rem_nsec instead of /.
> 
> Fixes: 12a280c72868 ("drm/dp_mst: Add topology ref history tracking for debugging")
> Cc: Juston Li <juston.li@intel.com>
> Cc: Imre Deak <imre.deak@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Harry Wentland <hwentlan@amd.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 11adc4b6ccfe..d2da5f113f16 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -1512,10 +1512,10 @@ __dump_topology_ref_history(struct drm_dp_mst_topology_ref_history *history,
>  		nr_entries = stack_depot_fetch(entry->backtrace, &entries);
>  		stack_trace_snprint(buf, PAGE_SIZE, entries, nr_entries, 4);
>  
> -		drm_printf(&p, "  %d %ss (last at %5llu.%06llu):\n%s",
> +		drm_printf(&p, "  %d %ss (last at %5llu.%06u):\n%s",
>  			   entry->count,
>  			   topology_ref_type_to_str(entry->type),
> -			   ts_nsec, rem_nsec / 1000, buf);
> +			   ts_nsec, do_div(rem_nsec, 1000), buf);

Or just change rem_nsec to u32 since that's what do_div() gives you.

>  	}
>  
>  	/* Now free the history, since this is the only time we expose it */
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] drm/mst: Fix up u64 division
  2019-11-06 18:28 ` Ville Syrjälä
@ 2019-11-06 19:41   ` Sean Paul
  2019-11-06 20:14     ` Ville Syrjälä
  0 siblings, 1 reply; 5+ messages in thread
From: Sean Paul @ 2019-11-06 19:41 UTC (permalink / raw)
  To: dri-devel
  Cc: Sean Paul, David Airlie, Daniel Vetter, Sean Paul, Juston Li,
	Harry Wentland

From: Sean Paul <seanpaul@chromium.org>

Change rem_nsec to u32 since that's what do_div returns, this avoids the
u64 divide in the drm_print args.

Changes in v2:
- Instead of doing do_div in drm_print, make rem_nsec u32 (Ville)

Link to v1: https://patchwork.freedesktop.org/patch/msgid/20191106173622.15573-1-sean@poorly.run

Fixes: 12a280c72868 ("drm/dp_mst: Add topology ref history tracking for debugging")
Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sean Paul <sean@poorly.run>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 11adc4b6ccfe..ae5809a1f19a 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1507,12 +1507,12 @@ __dump_topology_ref_history(struct drm_dp_mst_topology_ref_history *history,
 		ulong *entries;
 		uint nr_entries;
 		u64 ts_nsec = entry->ts_nsec;
-		u64 rem_nsec = do_div(ts_nsec, 1000000000);
+		u32 rem_nsec = do_div(ts_nsec, 1000000000);
 
 		nr_entries = stack_depot_fetch(entry->backtrace, &entries);
 		stack_trace_snprint(buf, PAGE_SIZE, entries, nr_entries, 4);
 
-		drm_printf(&p, "  %d %ss (last at %5llu.%06llu):\n%s",
+		drm_printf(&p, "  %d %ss (last at %5llu.%06u):\n%s",
 			   entry->count,
 			   topology_ref_type_to_str(entry->type),
 			   ts_nsec, rem_nsec / 1000, buf);
-- 
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/mst: Fix up u64 division
  2019-11-06 19:41   ` Sean Paul
@ 2019-11-06 20:14     ` Ville Syrjälä
  2019-11-06 20:22       ` Sean Paul
  0 siblings, 1 reply; 5+ messages in thread
From: Ville Syrjälä @ 2019-11-06 20:14 UTC (permalink / raw)
  To: Sean Paul
  Cc: David Airlie, Daniel Vetter, dri-devel, Sean Paul, Harry Wentland,
	Juston Li

On Wed, Nov 06, 2019 at 02:41:15PM -0500, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> Change rem_nsec to u32 since that's what do_div returns, this avoids the
> u64 divide in the drm_print args.
> 
> Changes in v2:
> - Instead of doing do_div in drm_print, make rem_nsec u32 (Ville)
> 
> Link to v1: https://patchwork.freedesktop.org/patch/msgid/20191106173622.15573-1-sean@poorly.run
> 
> Fixes: 12a280c72868 ("drm/dp_mst: Add topology ref history tracking for debugging")
> Cc: Juston Li <juston.li@intel.com>
> Cc: Imre Deak <imre.deak@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Harry Wentland <hwentlan@amd.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

lgtm
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 11adc4b6ccfe..ae5809a1f19a 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -1507,12 +1507,12 @@ __dump_topology_ref_history(struct drm_dp_mst_topology_ref_history *history,
>  		ulong *entries;
>  		uint nr_entries;
>  		u64 ts_nsec = entry->ts_nsec;
> -		u64 rem_nsec = do_div(ts_nsec, 1000000000);
> +		u32 rem_nsec = do_div(ts_nsec, 1000000000);
>  
>  		nr_entries = stack_depot_fetch(entry->backtrace, &entries);
>  		stack_trace_snprint(buf, PAGE_SIZE, entries, nr_entries, 4);
>  
> -		drm_printf(&p, "  %d %ss (last at %5llu.%06llu):\n%s",
> +		drm_printf(&p, "  %d %ss (last at %5llu.%06u):\n%s",
>  			   entry->count,
>  			   topology_ref_type_to_str(entry->type),
>  			   ts_nsec, rem_nsec / 1000, buf);
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/mst: Fix up u64 division
  2019-11-06 20:14     ` Ville Syrjälä
@ 2019-11-06 20:22       ` Sean Paul
  0 siblings, 0 replies; 5+ messages in thread
From: Sean Paul @ 2019-11-06 20:22 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: David Airlie, Sean Paul, dri-devel, Sean Paul, Daniel Vetter,
	Harry Wentland, Juston Li

On Wed, Nov 06, 2019 at 10:14:34PM +0200, Ville Syrjälä wrote:
> On Wed, Nov 06, 2019 at 02:41:15PM -0500, Sean Paul wrote:
> > From: Sean Paul <seanpaul@chromium.org>
> > 
> > Change rem_nsec to u32 since that's what do_div returns, this avoids the
> > u64 divide in the drm_print args.
> > 
> > Changes in v2:
> > - Instead of doing do_div in drm_print, make rem_nsec u32 (Ville)
> > 
> > Link to v1: https://patchwork.freedesktop.org/patch/msgid/20191106173622.15573-1-sean@poorly.run
> > 
> > Fixes: 12a280c72868 ("drm/dp_mst: Add topology ref history tracking for debugging")
> > Cc: Juston Li <juston.li@intel.com>
> > Cc: Imre Deak <imre.deak@intel.com>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Cc: Harry Wentland <hwentlan@amd.com>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Cc: Sean Paul <sean@poorly.run>
> > Cc: Lyude Paul <lyude@redhat.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <mripard@kernel.org>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Sean Paul <seanpaul@chromium.org>
> 
> lgtm
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Thanks for the quick reviews, I've pushed this to drm-misc-next-fixes.

Sean

> 
> > ---
> >  drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> > index 11adc4b6ccfe..ae5809a1f19a 100644
> > --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> > @@ -1507,12 +1507,12 @@ __dump_topology_ref_history(struct drm_dp_mst_topology_ref_history *history,
> >  		ulong *entries;
> >  		uint nr_entries;
> >  		u64 ts_nsec = entry->ts_nsec;
> > -		u64 rem_nsec = do_div(ts_nsec, 1000000000);
> > +		u32 rem_nsec = do_div(ts_nsec, 1000000000);
> >  
> >  		nr_entries = stack_depot_fetch(entry->backtrace, &entries);
> >  		stack_trace_snprint(buf, PAGE_SIZE, entries, nr_entries, 4);
> >  
> > -		drm_printf(&p, "  %d %ss (last at %5llu.%06llu):\n%s",
> > +		drm_printf(&p, "  %d %ss (last at %5llu.%06u):\n%s",
> >  			   entry->count,
> >  			   topology_ref_type_to_str(entry->type),
> >  			   ts_nsec, rem_nsec / 1000, buf);
> > -- 
> > Sean Paul, Software Engineer, Google / Chromium OS
> 
> -- 
> Ville Syrjälä
> Intel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-06 20:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-06 17:36 [PATCH] drm/mst: Fix up u64 division Sean Paul
2019-11-06 18:28 ` Ville Syrjälä
2019-11-06 19:41   ` Sean Paul
2019-11-06 20:14     ` Ville Syrjälä
2019-11-06 20:22       ` Sean Paul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox