From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754486AbcGVOJJ (ORCPT ); Fri, 22 Jul 2016 10:09:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39652 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754390AbcGVOJH (ORCPT ); Fri, 22 Jul 2016 10:09:07 -0400 Subject: Re: [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe To: Thomas Gleixner References: <1468933367-23159-1-git-send-email-eric.auger@redhat.com> <1468933367-23159-7-git-send-email-eric.auger@redhat.com> <3f188661-1d68-199b-3fcc-4da432bae633@redhat.com> Cc: eric.auger.pro@gmail.com, marc.zyngier@arm.com, christoffer.dall@linaro.org, andre.przywara@arm.com, robin.murphy@arm.com, alex.williamson@redhat.com, will.deacon@arm.com, joro@8bytes.org, jason@lakedaemon.net, linux-arm-kernel@lists.infradead.org, drjones@redhat.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, pbonzini@redhat.com, linux-kernel@vger.kernel.org, Bharat.Bhushan@freescale.com, pranav.sawargaonkar@gmail.com, p.fedin@samsung.com, iommu@lists.linux-foundation.org, Jean-Philippe.Brucker@arm.com, yehuday@marvell.com, Manish.Jaggi@caviumnetworks.com, robert.richter@caviumnetworks.com From: Auger Eric Message-ID: <20646d2e-b75f-b088-3ead-2aca039cde79@redhat.com> Date: Fri, 22 Jul 2016 16:08:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 22 Jul 2016 14:09:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thomas, On 22/07/2016 14:44, Thomas Gleixner wrote: > On Thu, 21 Jul 2016, Auger Eric wrote: >> On 20/07/2016 10:12, Thomas Gleixner wrote: >>> On Tue, 19 Jul 2016, Eric Auger wrote: >>>> +bool msi_doorbell_safe(void) >>>> +{ >>>> + struct irqchip_doorbell *db; >>>> + bool irq_remapping = true; >>>> + >>>> + mutex_lock(&irqchip_doorbell_mutex); >>>> + list_for_each_entry(db, &irqchip_doorbell_list, next) { >>>> + irq_remapping &= db->info.irq_remapping; >>> >>> db->info.irq_remapping is set in msi_doorbell_register(). So you can keep book >>> about that there. No need to iterate here. >> Yes makes sense to store the info at registration time. Currently this >> function is not in any fast path but that's cleaner from a general >> perspective. I will need to do such iteration at un-registration though. > > Two simple counter should be sufficient. > > nr_registered_bells; > nr_remapped_bells; Yes definitively smarter to use counters! mental viscosity. Thanks Eric > > .... > > Thanks, > > tglx >