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: <20230725215101.GA667452@bhelgaas>
Date:   Tue, 25 Jul 2023 16:51:01 -0500
From:   Bjorn Helgaas <helgaas@...nel.org>
To:     suijingfeng <suijingfeng@...ngson.cn>
Cc:     Sui Jingfeng <sui.jingfeng@...ux.dev>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <mripard@...nel.org>,
        Thomas Zimmermann <tzimmermann@...e.de>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        loongson-kernel@...ts.loongnix.cn
Subject: Re: [PATCH 4/6] PCI/VGA: Move the new_state assignment out the loop

On Mon, Jul 24, 2023 at 09:02:14PM +0800, suijingfeng wrote:
> PING, please !

Don't worry, these are not forgotten.  Your other series seems more
important, so that's what I've been paying attention to.

> On 2023/7/11 21:43, Sui Jingfeng wrote:
> > From: Sui Jingfeng <suijingfeng@...ngson.cn>
> > 
> > In the vga_arbiter_notify_clients() function, the value of the 'new_state'
> > variable will be 'false' on systems that have more than one PCI VGA card.
> > Its value will be 'true' on systems that have one or no PCI VGA compatible
> > card. In other words, its value is not relevant to the iteration, so move
> > the assignment () out of the loop.
> > 
> > For a system with multiple video cards, this patch saves the redundant
> > assignment.
> > 
> > Signed-off-by: Sui Jingfeng <suijingfeng@...ngson.cn>
> > ---
> >   drivers/pci/vgaarb.c | 16 +++++++---------
> >   1 file changed, 7 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c
> > index 668139f7c247..4c448c758bab 100644
> > --- a/drivers/pci/vgaarb.c
> > +++ b/drivers/pci/vgaarb.c
> > @@ -1468,22 +1468,20 @@ static void vga_arbiter_notify_clients(void)
> >   {
> >   	struct vga_device *vgadev;
> >   	unsigned long flags;
> > -	uint32_t new_decodes;
> > -	bool new_state;
> > +	bool state;
> >   	if (!vga_arbiter_used)
> >   		return;
> > +	state = (vga_count > 1) ? false : true;
> > +
> >   	spin_lock_irqsave(&vga_lock, flags);
> >   	list_for_each_entry(vgadev, &vga_list, list) {
> > -		if (vga_count > 1)
> > -			new_state = false;
> > -		else
> > -			new_state = true;
> >   		if (vgadev->set_decode) {
> > -			new_decodes = vgadev->set_decode(vgadev->pdev,
> > -							 new_state);
> > -			vga_update_device_decodes(vgadev, new_decodes);
> > +			unsigned int decodes;
> > +
> > +			decodes = vgadev->set_decode(vgadev->pdev, state);
> > +			vga_update_device_decodes(vgadev, decodes);
> >   		}
> >   	}
> >   	spin_unlock_irqrestore(&vga_lock, flags);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ