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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211029071608.GA28997@gofer.mess.org>
Date:   Fri, 29 Oct 2021 08:16:08 +0100
From:   Sean Young <sean@...s.org>
To:     Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
Cc:     Maíra Canal <maira.canal@....br>, lkp@...el.com,
        mchehab@...nel.org, thierry.reding@...il.com, lee.jones@...aro.org,
        llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-pwm@...r.kernel.org
Subject: Re: [PATCH v4] media: rc: pwm-ir-tx: Switch to atomic PWM API

On Thu, Oct 28, 2021 at 08:05:16PM +0200, Uwe Kleine-König wrote:
> On Thu, Oct 28, 2021 at 01:26:10PM +0100, Sean Young wrote:
> > > bloat-o-meter reports (for an arm allmodconfig build)
> > > 
> > > 	add/remove: 0/0 grow/shrink: 3/1 up/down: 644/-396 (248)
> > > 	Function                                     old     new   delta
> > > 	pwm_ir_probe                                 372     676    +304
> > > 	pwm_ir_set_carrier                           108     292    +184
> > > 	pwm_ir_set_duty_cycle                         68     224    +156
> > > 	pwm_ir_tx                                    908     512    -396
> > > 	Total: Before=2302, After=2550, chg +10.77%
> > 
> > So 248 bytes more after your changes.
> 
> ack. This is because the compiler inlines the division which accounts
> for > 100 bytes.

I'm surprised it's that large. This is on 32 bit?

> > > struct pwm_ir increases from 12 bytes to 40 bytes.
> > > 
> > > The stack space required by pwm_ir_tx decreases from 60 to 36
> > > 
> > > I don't know exactly how kmalloc works internally. Maybe allocating a
> > > structure of size 40 bytes doesn't need more memory than a structure of
> > > size 12?
> > > 
> > > I didn't check how runtimes change, but the size decrease of pwm_ir_tx()
> > > is nice and might save a bit of runtime.
> > 
> > I'm not following, how is this decreasing runtime? 
> 
> With my changes pwm_ir_tx got smaller and { pwm_ir_probe,
> pwm_ir_set_carrier, pwm_ir_set_duty_cycle } got bigger. Now if for a
> typical runtime pattern pwm_ir_probe and pwm_ir_set_carrier run once and
> pwm_ir_set_duty_cycle 100 times and pwm_ir_tx 1000 times (no idea if
> that is realistic) it might be a net win in sum.

The two most common programs for sending IR are

ir-ctl: https://git.linuxtv.org/v4l-utils.git/tree/utils/ir-ctl/ir-ctl.c#n1041
lircd: https://sourceforge.net/p/lirc/git/ci/master/tree/lib/transmit.c

For each transmission, the carrier is set. If the duty cyle is specified,
then that is set too. Then the transmit itself is done. Both of them
set the carrier and duty cycle (if required) for every transmission: setting
the carrier and duty cycle is a cheap operation, and it is device property
which can be overriden by another process. 

This means with your changes, if the carrier and duty cycle are both set
for each transmission, then we're doing more work. If only the carrier
is set for each transmission, then there is no net gain/loss (I think),
but the code size has increased.


Thanks for prototyping this.

Sean

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ