From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762666AbbA3RJT (ORCPT ); Fri, 30 Jan 2015 12:09:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41953 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751062AbbA3RJS (ORCPT ); Fri, 30 Jan 2015 12:09:18 -0500 Date: Fri, 30 Jan 2015 18:09:10 +0100 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Nadav Amit , Gleb Natapov Subject: Re: [PATCH 7/8] KVM: x86: avoid logical_map when it is invalid Message-ID: <20150130170909.GE27414@potion.redhat.com> References: <1422568135-28402-1-git-send-email-rkrcmar@redhat.com> <1422568135-28402-8-git-send-email-rkrcmar@redhat.com> <54CB5101.4010701@redhat.com> <20150130145631.GB27414@potion.redhat.com> <54CB9EE3.3030804@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <54CB9EE3.3030804@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2015-01-30 16:10+0100, Paolo Bonzini: > On 30/01/2015 15:56, Radim Krčmář wrote: > > Do you know of a difference with it? > > new->mode & (new->mode - 1) | hweight8(new->mode) != 1 > > lea -0x1(%rax),%edi | popcnt %edi,%eax > > test %eax,%edi | cmp $1,%eax > > x & (x - 1) is really hweight8(new->mode) > 1. So if new->mode == 0 it > would have a different result. (I was thinking if execution profile of those two instructions isn't vastly different. ">" in this check works too ... later it seemed like it was pushing lucky coincidence too far, so it ended as "!=" :) > >> Please add a comment to kvm_irq_delivery_to_apic_fast to explain what > >> you are doing. > > > > Would naming it kvm_apic_need_slow_delivery(), or something, be enough? > > Or kvm_apic_map_valid() perhaps? Sure, thanks.