Skip to contentSkip to conversation

drm/radeon: reduce memory footprint for debugging

PATCH Superseded Andy Shevchenko 2 participants 4 messages Sep 4, 2014 – Sep 9, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon: reduce memory footprint for debugging

There is no need to use hex_dump_to_buffer() since we have a kernel helper to dump up to 64 bytes just via printk(). In our case the actual size is 15 bytes.

---
 drivers/gpu/drm/radeon/atombios_dp.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +2 -5
index 95ea276..4e75c48 100644
@@ -405,16 +405,13 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector)
 	u8 msg[DP_DPCD_SIZE];
 	int ret;
 
-	char dpcd_hex_dump[DP_DPCD_SIZE * 3];
-
 	ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg,
 			       DP_DPCD_SIZE);
 	if (ret > 0) {
 		memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE);
 
-		hex_dump_to_buffer(dig_connector->dpcd, sizeof(dig_connector->dpcd),
-				   32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false);
-		DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump);
+		DRM_DEBUG_KMS("DPCD: %*ph\n", dig_connector->dpcd,
+			      (int)sizeof(dig_connector->dpcd));
 
 		radeon_dp_probe_oui(radeon_connector);
 
Signature · 1 line
2.1.0
#1 lore raw
Quoted 4 lines · Andy Shevchenko

There is no need to use hex_dump_to_buffer() since we have a kernel helper to dump up to 64 bytes just via printk(). In our case the actual size is 15 bytes.

Patch generates the following warning:
CC [M] drivers/gpu/drm/radeon/atombios_dp.o
drivers/gpu/drm/radeon/atombios_dp.c: In function ‘radeon_dp_getdpcd’:
drivers/gpu/drm/radeon/atombios_dp.c:413:3: warning: field width specifier ‘*’ expects argument of type ‘int’, but argument 3 has type ‘u8 *’ [-Wformat=]
DRM_DEBUG_KMS("DPCD: %*ph\n", dig_connector->dpcd,
^
drivers/gpu/drm/radeon/atombios_dp.c:413:3: warning: format ‘%p’ expects argument of type ‘void *’, but argument 4 has type ‘int’ [-Wformat=]
LD [M] drivers/gpu/drm/radeon/radeon.o
Building modules, stage 2.
MODPOST 2485 modules
LD [M] drivers/gpu/drm/radeon/radeon.ko

Quoted 30 lines
---
 drivers/gpu/drm/radeon/atombios_dp.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +2 -6
index 95ea276..4e75c48 100644
@@ -405,16 +405,13 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector)
        u8 msg[DP_DPCD_SIZE];
        int ret;
 
-       char dpcd_hex_dump[DP_DPCD_SIZE * 3];
-
        ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg,
                               DP_DPCD_SIZE);
        if (ret > 0) {
                memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE);
 
-               hex_dump_to_buffer(dig_connector->dpcd, sizeof(dig_connector->dpcd),
-                                  32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false);
-               DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump);
+               DRM_DEBUG_KMS("DPCD: %*ph\n", dig_connector->dpcd,
+                             (int)sizeof(dig_connector->dpcd));
 
                radeon_dp_probe_oui(radeon_connector);
 
--

2.1.0

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
Quoted 7 lines · Alex Deucher
Quoted 4 lines · Andy Shevchenko

There is no need to use hex_dump_to_buffer() since we have a kernel helper to dump up to 64 bytes just via printk(). In our case the actual size is 15 bytes.

Quoted 15 lines

Patch generates the following warning:
CC [M] drivers/gpu/drm/radeon/atombios_dp.o
drivers/gpu/drm/radeon/atombios_dp.c: In function ‘radeon_dp_getdpcd’:
drivers/gpu/drm/radeon/atombios_dp.c:413:3: warning: field width specifier ‘*’ expects argument of type ‘int’, but argument 3 has type ‘u8 *’ [-Wformat=]
DRM_DEBUG_KMS("DPCD: %*ph\n", dig_connector->dpcd,
^
drivers/gpu/drm/radeon/atombios_dp.c:413:3: warning: format ‘%p’ expects argument of type ‘void *’, but argument 4 has type ‘int’ [-Wformat=]
LD [M] drivers/gpu/drm/radeon/radeon.o
Building modules, stage 2.
MODPOST 2485 modules
LD [M] drivers/gpu/drm/radeon/radeon.ko

There is a patch v2.

http://www.spinics.net/lists/dri-devel/msg67407.html

Quoted 37 lines
Quoted 37 lines


---
 drivers/gpu/drm/radeon/atombios_dp.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +2 -6
index 95ea276..4e75c48 100644
@@ -405,16 +405,13 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector)
        u8 msg[DP_DPCD_SIZE];
        int ret;
 
-       char dpcd_hex_dump[DP_DPCD_SIZE * 3];
-
        ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg,
                               DP_DPCD_SIZE);
        if (ret > 0) {
                memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE);
 
-               hex_dump_to_buffer(dig_connector->dpcd, sizeof(dig_connector->dpcd),
-                                  32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false);
-               DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump);
+               DRM_DEBUG_KMS("DPCD: %*ph\n", dig_connector->dpcd,
+                             (int)sizeof(dig_connector->dpcd));
 
                radeon_dp_probe_oui(radeon_connector);
 
--

2.1.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw
Quoted 24 lines · Andy Shevchenko
Quoted 7 lines · Alex Deucher
Quoted 4 lines · Andy Shevchenko

There is no need to use hex_dump_to_buffer() since we have a kernel helper to dump up to 64 bytes just via printk(). In our case the actual size is 15 bytes.

Quoted 15 lines

Patch generates the following warning:
CC [M] drivers/gpu/drm/radeon/atombios_dp.o
drivers/gpu/drm/radeon/atombios_dp.c: In function ‘radeon_dp_getdpcd’:
drivers/gpu/drm/radeon/atombios_dp.c:413:3: warning: field width specifier ‘*’ expects argument of type ‘int’, but argument 3 has type ‘u8 *’ [-Wformat=]
DRM_DEBUG_KMS("DPCD: %*ph\n", dig_connector->dpcd,
^
drivers/gpu/drm/radeon/atombios_dp.c:413:3: warning: format ‘%p’ expects argument of type ‘void *’, but argument 4 has type ‘int’ [-Wformat=]
LD [M] drivers/gpu/drm/radeon/radeon.o
Building modules, stage 2.
MODPOST 2485 modules
LD [M] drivers/gpu/drm/radeon/radeon.ko

Quoted 3 lines

There is a patch v2.

http://www.spinics.net/lists/dri-devel/msg67407.html

Thanks. Applied.

Alex

Quoted 34 lines
Quoted 34 lines
Quoted 34 lines



---
 drivers/gpu/drm/radeon/atombios_dp.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +2 -6
index 95ea276..4e75c48 100644
@@ -405,16 +405,13 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector)
        u8 msg[DP_DPCD_SIZE];
        int ret;
 
-       char dpcd_hex_dump[DP_DPCD_SIZE * 3];
-
        ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg,
                               DP_DPCD_SIZE);
        if (ret > 0) {
                memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE);
 
-               hex_dump_to_buffer(dig_connector->dpcd, sizeof(dig_connector->dpcd),
-                                  32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false);
-               DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump);
+               DRM_DEBUG_KMS("DPCD: %*ph\n", dig_connector->dpcd,
+                             (int)sizeof(dig_connector->dpcd));
 
                radeon_dp_probe_oui(radeon_connector);
 
--

2.1.0

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Andy Shevchenko <[email protected]>
Intel Finland Oy

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel