From patchwork Thu Feb 26 13:03:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 8922 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1QD6tAZ015977 for ; Thu, 26 Feb 2009 13:06:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753406AbZBZNGw (ORCPT ); Thu, 26 Feb 2009 08:06:52 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752858AbZBZNGw (ORCPT ); Thu, 26 Feb 2009 08:06:52 -0500 Received: from mx2.redhat.com ([66.187.237.31]:49578 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753406AbZBZNGv (ORCPT ); Thu, 26 Feb 2009 08:06:51 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n1QD6mLI005328; Thu, 26 Feb 2009 08:06:48 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n1QD6mse017196; Thu, 26 Feb 2009 08:06:48 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n1QD6ljB003532; Thu, 26 Feb 2009 08:06:47 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 587) id AFA4818D41C; Thu, 26 Feb 2009 15:03:39 +0200 (IST) Date: Thu, 26 Feb 2009 15:03:39 +0200 From: Gleb Natapov To: avi@redhat.com Cc: Sheng Yang , kvm@vger.kernel.org Subject: [PATCH] use bitmap ops on a bitmap instead of bit ops Message-ID: <20090226130339.GG8810@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org And don't zero bitmap twice. Assume that caller zeros it. Signed-off-by: Gleb Natapov --- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index 7c2cb2b..21627b9 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c @@ -170,12 +170,11 @@ void kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, ioapic_debug("dest %d dest_mode %d\n", dest, dest_mode); - *mask = 0; if (dest_mode == 0) { /* Physical mode. */ if (dest == 0xFF) { /* Broadcast. */ for (i = 0; i < KVM_MAX_VCPUS; ++i) if (kvm->vcpus[i] && kvm->vcpus[i]->arch.apic) - *mask |= 1 << i; + __set_bit(i, *mask); return; } for (i = 0; i < KVM_MAX_VCPUS; ++i) { @@ -184,7 +183,7 @@ void kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, continue; if (kvm_apic_match_physical_addr(vcpu->arch.apic, dest)) { if (vcpu->arch.apic) - *mask = 1 << i; + __set_bit(i, *mask); break; } } @@ -195,7 +194,7 @@ void kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, continue; if (vcpu->arch.apic && kvm_apic_match_logical_addr(vcpu->arch.apic, dest)) - *mask |= 1 << vcpu->vcpu_id; + __set_bit(i, *mask); } ioapic_debug("mask %x\n", *mask); }