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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAObsKC9d17jh1xOfGGSo6ULesYFAENYSNEFrr4ee4h_JgahYw@mail.gmail.com>
Date:	Wed, 6 Apr 2016 09:45:46 +0200
From:	Tomeu Vizoso <tomeu.vizoso@...labora.com>
To:	Heiko Stuebner <heiko@...ech.de>
Cc:	John Keeping <john@...anate.com>, Joerg Roedel <joro@...tes.org>,
	iommu@...ts.linux-foundation.org,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"open list:ARM/Rockchip SoC..." <linux-rockchip@...ts.infradead.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iommu/rockchip: Fix "is stall active" check

On 5 April 2016 at 21:10, Heiko Stuebner <heiko@...ech.de> wrote:
> Am Dienstag, 5. April 2016, 18:28:58 schrieb John Keeping:
>> On Tue, 05 Apr 2016 10:21:27 -0700, Heiko Stuebner wrote:
>> > Am Dienstag, 5. April 2016, 15:05:46 schrieb John Keeping:
>> > > Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support
>> > > multi
>> > > slaves") rk_iommu_is_stall_active() always returns false because the
>> > > bitwise AND operates on the boolean flag promoted to an integer and a
>> > > value that is either zero or BIT(2).
>> > >
>> > > Explicitly convert the right-hand value to a boolean so that both
>> > > sides
>> > > are guaranteed to be either zero or one.
>> > >
>> > > rk_iommu_is_paging_enabled() does not suffer from the same problem
>> > > since
>> > > RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same
>> > > change
>> > > for consistency and to make it clear that it's correct without needing
>> > > to lookup the value.
>> > >
>> > > Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
>> > > slaves") Signed-off-by: John Keeping <john@...anate.com>
>> >
>> > Nice catch, thanks.
>> >
>> > Reviewed-by: Heiko Stuebner <heiko@...ech.de>
>> >
>> > John, out of curiosity, how did you find that problem? Excess stall
>> > error
>> > messages or something else?
>>
>> I was testing the drm iommu patches I posted today [1] and noticed an
>> "Enable stall request timed out" error when unbinding the
>> display-subsystem, but the RK_MMU_STATUS value printed in the error
>> message indicated that stall active was set.
>>
>> [1] http://article.gmane.org/gmane.comp.video.dri.devel/150721
>
> So it seems both you and Tomeu were working to resolve the same issue [2].
>
> And John's patch seems to actually fix the underlying problem.

Indeed, I don't get spurious messages any more with this patch.

Tested-by: Tomeu Vizoso <tomeu.vizoso@...labora.com>

Thanks,

Tomeu

>
> [2] https://lkml.org/lkml/2016/3/22/493
>
>
>> > > ---
>> > >
>> > >  drivers/iommu/rockchip-iommu.c | 8 ++++----
>> > >  1 file changed, 4 insertions(+), 4 deletions(-)
>> > >
>> > > diff --git a/drivers/iommu/rockchip-iommu.c
>> > > b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049
>> > > 100644
>> > > --- a/drivers/iommu/rockchip-iommu.c
>> > > +++ b/drivers/iommu/rockchip-iommu.c
>> > > @@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct
>> > > rk_iommu
>> > > *iommu) int i;
>> > >
>> > >   for (i = 0; i < iommu->num_mmu; i++)
>> > >
>> > > -         active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > -                                 RK_MMU_STATUS_STALL_ACTIVE;
>> > > +         active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > +                                    RK_MMU_STATUS_STALL_ACTIVE);
>> > >
>> > >   return active;
>> > >
>> > >  }
>> > >
>> > > @@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct
>> > > rk_iommu *iommu) int i;
>> > >
>> > >   for (i = 0; i < iommu->num_mmu; i++)
>> > >
>> > > -         enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > -                                 RK_MMU_STATUS_PAGING_ENABLED;
>> > > +         enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > +                                    RK_MMU_STATUS_PAGING_ENABLED);
>> > >
>> > >   return enable;
>> > >
>> > >  }
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ