From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoffer Dall Subject: Re: [Android-virt] [PATCH v5 05/13] ARM: KVM: Inject IRQs and FIQs from userspace Date: Sun, 11 Dec 2011 15:07:06 -0500 Message-ID: <-4744042178058961854@unknownmsgid> References: <20111211102403.21693.6887.stgit@localhost> <20111211102449.21693.12265.stgit@localhost> <4EE4C9D8.1010601@web.de> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=ISO-8859-1 Cc: Christoffer Dall , "kvm@vger.kernel.org" , "Marc.Zyngier@arm.com" , Jan Kiszka , "avi@redhat.com" , "android-virt@lists.cs.columbia.edu" , "tech@virtualopensystems.com" To: Peter Maydell Return-path: Received: from mail-vw0-f46.google.com ([209.85.212.46]:50352 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752223Ab1LKUGF (ORCPT ); Sun, 11 Dec 2011 15:06:05 -0500 Received: by vbbfc26 with SMTP id fc26so3324074vbb.19 for ; Sun, 11 Dec 2011 12:06:03 -0800 (PST) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Dec 11, 2011, at 2:48 PM, Peter Maydell wrote: > On 11 December 2011 19:30, Christoffer Dall > wrote: >> On Sun, Dec 11, 2011 at 11:03 AM, Peter Maydell >> wrote: >>> Removing the mask would be wrong since the irq field here >>> is encoding both cpu number and irq-vs-fiq. The default is >>> just an unreachable condition. (Why are we using % here >>> rather than the obvious bit operation, incidentally?) >>> >> right, I will remove the default case. >> >> I highly doubt that the difference in using a bitop will be measurably >> more efficient, but if you feel strongly about it, I can change it to >> a shift and bitwise and, which I assume is what you mean by the >> obvious bit operation? I think my CS background speaks for using %, >> but whatever. > > Certainly the compiler ought to be able to figure out the > two are the same thing; I just think "irq & 1" is more readable > than "irq % 2" (because it's being clear that it's treating the > variable as a pile of bits rather than an integer). This is > bikeshedding rather, though, and style issues in kernel code > are a matter for the kernel folk. So you can ignore me :-) > Well, if it was just "irq & 1", then I hear you, but it would be "(irq >> cpu_idx) & 1" which I don't think is more clear. But yes let's see what the kernel folks say.