Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp658997imm; Thu, 5 Jul 2018 06:53:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpenI7WAQi9FtEsBKCN6PrxZUF2KGjk3tOHWTcxgKkeDYbLz+7y7VDraUov+2rXlxu0D+Vf7 X-Received: by 2002:a62:9b57:: with SMTP id r84-v6mr6518177pfd.6.1530798839374; Thu, 05 Jul 2018 06:53:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530798839; cv=none; d=google.com; s=arc-20160816; b=be4v5LChuAmrK27HWr8eq/1ksV8IC1G7udBR8mFtsFis93CNxonndhKcw3GFSjrHeB Ks9Y1/O9aZ+tI3wptZSH8ZKtlChU+oA1pmNhJA5+23SNu1T7+eXtVB6Ps+LRuHbruTUJ rRP9tJE1l9B3kTnJFsKwaCQullokAUR9JfR+9LV7upkFjzWnzs2dCEnWmjcb/Px2m/yv QbuqYcql/6YzeeOstQ5CKb3HCsSAX87wVNw2Rd1kdhFoQ2elOaaCuNLni0p6E6kNjODG 4r5x5kE0pQ+C2/rJ0N34nYgIJIzM0h2EXT6Q61H3wvn2MxbD9ONd4tJQ5yqZH7S9M2FK efSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=veUtwpaXpYTDYpsfnUyWoeSokNc8NMeTIPFy5IyLnRE=; b=TvIz9ZWOOIkw8MdzncscPnfsl/ZYmdqDiUopPNjku/mP2vF/rOBg+FwjU5X+mt3aBL OyNyZYMifRfygYJ6+Z7corRU9dbNsCLlOkgnKi0c++BkfLrgxM33cWrnTbyj3SwKVJzt 7iDkDzde+XeK03LvAyYOjLYlW4y6vXO/MFVdPW11Fn+FYntGkJL1F7FHDjZVmns3nJd6 YvM0ndG7Q4lr182PJaR7F27hPAKFAI+imR87omtLsPI4R02ExRzVXmDHC1M4hq8OUnVl CAYzwXUG65PJLDnKFqspqatclRBY3OOOsTHiketp50oPDc50RHu94bK5YQ3brbyQn2BE o6hQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u123-v6si5612795pgb.414.2018.07.05.06.53.44; Thu, 05 Jul 2018 06:53:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753756AbeGENvp (ORCPT + 99 others); Thu, 5 Jul 2018 09:51:45 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50032 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753290AbeGENvn (ORCPT ); Thu, 5 Jul 2018 09:51:43 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 27A4C18A; Thu, 5 Jul 2018 06:51:43 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 19A393F5BA; Thu, 5 Jul 2018 06:51:41 -0700 (PDT) Date: Thu, 5 Jul 2018 14:51:39 +0100 From: Mark Rutland To: KarimAllah Ahmed Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH] KVM: Switch 'requests' to be 64-bit (explicitly) Message-ID: <20180705135139.orifhe4mag7p6zj3@lakrids.cambridge.arm.com> References: <1523744804-8220-1-git-send-email-karahmed@amazon.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1523744804-8220-1-git-send-email-karahmed@amazon.de> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 15, 2018 at 12:26:44AM +0200, KarimAllah Ahmed wrote: > Switch 'requests' to be explicitly 64-bit and update BUILD_BUG_ON check to > use the size of "requests" instead of the hard-coded '32'. > > That gives us a bit more room again for arch-specific requests as we > already ran out of space for x86 due to the hard-coded check. > > Cc: Paolo Bonzini > Cc: Radim Krčmář > Cc: kvm@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: KarimAllah Ahmed > --- > include/linux/kvm_host.h | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > index 6930c63..fe4f46b 100644 > --- a/include/linux/kvm_host.h > +++ b/include/linux/kvm_host.h > @@ -129,7 +129,7 @@ static inline bool is_error_page(struct page *page) > #define KVM_REQUEST_ARCH_BASE 8 > > #define KVM_ARCH_REQ_FLAGS(nr, flags) ({ \ > - BUILD_BUG_ON((unsigned)(nr) >= 32 - KVM_REQUEST_ARCH_BASE); \ > + BUILD_BUG_ON((unsigned)(nr) >= (sizeof(((struct kvm_vcpu *)0)->requests) * 8) - KVM_REQUEST_ARCH_BASE); \ > (unsigned)(((nr) + KVM_REQUEST_ARCH_BASE) | (flags)); \ > }) > #define KVM_ARCH_REQ(nr) KVM_ARCH_REQ_FLAGS(nr, 0) > @@ -223,7 +223,7 @@ struct kvm_vcpu { > int vcpu_id; > int srcu_idx; > int mode; > - unsigned long requests; > + u64 requests; The usual thing to do for bitmaps is something like: #define KVM_REQUEST_NR (KVM_REQUEST_ARCH_BASE + KVM_REQUEST_ARCH_NR) unsigned long requests[BITS_TO_LONGS(NR_KVM_REQUESTS)]; > unsigned long guest_debug; > > int pre_pcpu; > @@ -1122,7 +1122,7 @@ static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu) > * caller. Paired with the smp_mb__after_atomic in kvm_check_request. > */ > smp_wmb(); > - set_bit(req & KVM_REQUEST_MASK, &vcpu->requests); > + set_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->requests); ... which wouldn't require a void cast to make the bit API functions happy (as these expect a pointer to the first unsigned long in the bitmap). Thanks, Mark.