lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3c173bbe-c74a-5817-c9c5-f3364c628240@189.cn>
Date:   Tue, 4 Apr 2023 10:55:28 +0800
From:   Sui Jingfeng <15330273260@....cn>
To:     Thomas Zimmermann <tzimmermann@...e.de>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <mripard@...nel.org>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        suijingfeng <suijingfeng@...ngson.cn>, liyi <liyi@...ngson.cn>,
        Lucas De Marchi <lucas.demarchi@...el.com>
Cc:     dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/fbdev-generic: optimize out a redundant assignment
 clause


On 2023/3/29 17:04, Thomas Zimmermann wrote:
> (cc'ing Lucas)
>
> Hi
>
> Am 25.03.23 um 08:46 schrieb Sui Jingfeng:
>>   The assignment already done in drm_client_buffer_vmap(),
>>   just trival clean, no functional change.
>>
>> Signed-off-by: Sui Jingfeng <15330273260@....cn>
>> ---
>>   drivers/gpu/drm/drm_fbdev_generic.c | 5 ++---
>>   1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_fbdev_generic.c 
>> b/drivers/gpu/drm/drm_fbdev_generic.c
>> index 4d6325e91565..1da48e71c7f1 100644
>> --- a/drivers/gpu/drm/drm_fbdev_generic.c
>> +++ b/drivers/gpu/drm/drm_fbdev_generic.c
>> @@ -282,7 +282,7 @@ static int drm_fbdev_damage_blit(struct 
>> drm_fb_helper *fb_helper,
>>                    struct drm_clip_rect *clip)
>>   {
>>       struct drm_client_buffer *buffer = fb_helper->buffer;
>> -    struct iosys_map map, dst;
>> +    struct iosys_map map;
>>       int ret;
>>         /*
>> @@ -302,8 +302,7 @@ static int drm_fbdev_damage_blit(struct 
>> drm_fb_helper *fb_helper,
>>       if (ret)
>>           goto out;
>>   -    dst = map;
>> -    drm_fbdev_damage_blit_real(fb_helper, clip, &dst);
>> +    drm_fbdev_damage_blit_real(fb_helper, clip, &map);
>
> I see what you're doing and it's probably correct in this case.
>
> But there's a larger issue with this iosys interfaces. Sometimes the 
> address has to be modified (see calls of iosys_map_incr()). That can 
> prevent incorrect uses of the mapping in other places, especially in 
> unmap code.
>
Yes, I just realized that.

iosys_map_incr() change the internal state of a opaque structure, this 
is somewhat evil.

if it is non-opaque, then this is abstract failure.

You have to worry about that if it is changed by a accident call 
iosys_map_incr() from other place.

The map should be const, I guess most programmer expect  the map be a const.

making it const please, copy on demand, modify the copy only, leave the 
original mapping untouched.

Hope this could eliminate the embarrassing.

Sorry for missing the point.

> I think it would make sense to consider a separate structure for the 
> I/O location. The buffer as a whole would still be represented by 
> struct iosys_map.  And that new structure, let's call it struct 
> iosys_ptr, would point to an actual location within the buffer's 
> memory range. A few locations and helpers would need changes, but 
> there are not so many callers that it's an issue.  This would also 
> allow for a few debugging tests that ensure that iosys_ptr always 
> operates within the bounds of an iosys_map.
>
> I've long considered this idea, but there was no pressure to work on 
> it. Maybe now.
>
I have also get some idea from you idea.
> Best regards
> Thomas
>
>>         drm_client_buffer_vunmap(buffer);
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ