Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933630AbdDGM3Y (ORCPT ); Fri, 7 Apr 2017 08:29:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56224 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932317AbdDGM3P (ORCPT ); Fri, 7 Apr 2017 08:29:15 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 41FC7D1FE2 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=rkrcmar@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 41FC7D1FE2 Date: Fri, 7 Apr 2017 14:29:11 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Marc Zyngier Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Christoffer Dall , Andrew Jones , Paolo Bonzini , Christian Borntraeger , Cornelia Huck , James Hogan , Paul Mackerras Subject: Re: [PATCH RFC 5/6] KVM: mark requests that do not need a wakeup Message-ID: <20170407122910.GD23559@potion> References: <20170406202056.18379-1-rkrcmar@redhat.com> <20170406202056.18379-6-rkrcmar@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 07 Apr 2017 12:29:15 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1265 Lines: 32 2017-04-07 09:27+0100, Marc Zyngier: > On 06/04/17 21:20, Radim Krčmář wrote: >> Some operations must ensure that the guest is not running with stale >> data, but if the guest is halted, then the update can wait until another >> event happens. kvm_make_all_requests() currently doesn't wake up, so we >> can mark all requests used with it. >> >> First 8 bits were arbitrarily reserved for request numbers. >> >> Most uses of requests have the request type as a constant, so a compiler >> will optimize the '&'. >> >> An alternative would be to have an inline function that would return >> whether the request needs a wake-up or not, but I like this one better >> even though it might produce worse assembly. >> >> Suggested-by: Christoffer Dall >> Signed-off-by: Radim Krčmář >> --- >> Btw. do you recall which macro allowed to define bitmasks? (It has >> two arguments, FROM and TO.) > > GENMASK (and its _ULL variant), defined in include/linux/bitops.h. Thank you, it is under BIT() ... I am blind. > +#define KVM_REQUEST_MASK 0xff The 0xff should be "GENMASK(7,0)". First 8 bits is plenty and should be fast even if the compiler doesn't optimize the masking because request is not constant.