Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1477698imm; Tue, 10 Jul 2018 02:28:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfRCHB8s5v09D7uXXa9k56DlQwBE13QPOFb2ixXSnysFNa4dSyl/1qi6Dar1jfOA91fdceg X-Received: by 2002:a65:4c87:: with SMTP id m7-v6mr15480789pgt.98.1531214917919; Tue, 10 Jul 2018 02:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531214917; cv=none; d=google.com; s=arc-20160816; b=Avx3wFc2meaW7uCnpRtaUoHvzHgmE6AnNmS5IvvOUx8Zm0dtOmUksH9q1Bl1OAb7Zn ww/KPgRVoNoN2Je0f5+0FTgCm6qT0S60wHIrAZtMdmF/xmaJlOozdFD8GRonjw4y4q8r AnHsdi+LvKjtydBTc+tf4ccpdqJjwhqaF8XRzxYLWsHqKq85+DrtATEHv76/GbdvpweW rExZH+qSQqTMt9CiSiZQLeqOSCkTb+IqmBAjqD+3StfCjCp/2ck/HwwxFCIJTqbDUpPQ GGrbvFcoHgHGqZk9/jdIvDVuFyhsuql63rPBdhG6RQqcsnpPI7jUSatWq75B11RzBPDG Tjyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=wHvoDS8E2GkRTDdrYrjWXyfHo5TDODH56BUf1Q//WFs=; b=pQigP5QHfqonmdsxMh3DPvzOIZ/YlblSUgcbeVfeWjIbD0X1Mxr81OCkOkqpy3ZIkP viOFu8eiwAsWvLssZDgdbXFVIlNsegE3wJWTvfFX/WnP5a48RB9S2uRxJmZ97gNt8omM FagrDfbLTtUd9cKNrKTN1gFZNdwhhGAhtDFsibpiRzeAJuw/FwbjNHZKWt85Tim1sduc wXfu0KIxkK+xWmfXcncPFjdyozV9WTC3AvI6QnFGfi2heESVLAuK7uDVeygnAc9IWAph TBc22CChYyDTlBBOyL+9AR3rjmZ396bRT4loNeias4FGXZ7cYNdiqnNvjVb90h3S+RrN IEKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=jMW7cZ7k; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4-v6si15925253pgn.90.2018.07.10.02.28.22; Tue, 10 Jul 2018 02:28:37 -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; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=jMW7cZ7k; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752029AbeGJJ1g (ORCPT + 99 others); Tue, 10 Jul 2018 05:27:36 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:28039 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751332AbeGJJ1e (ORCPT ); Tue, 10 Jul 2018 05:27:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1531214854; x=1562750854; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=wHvoDS8E2GkRTDdrYrjWXyfHo5TDODH56BUf1Q//WFs=; b=jMW7cZ7kUN99K3+qtZKJ/RKc/5wv5xJRDDoUC+Y6nHYntwh9s4Wzk1DR ZQ+UIFP0OqvAJlLdCM27taXTVcBHTR4jCPSkFcnVL4yoYWX0j4K1b6n4V cEMPUc7yjP09XfZrUC3Yg52+TQqJakhjLu7aCJfblGAyf7FMpslnO6ULT 0=; X-IronPort-AV: E=Sophos;i="5.51,333,1526342400"; d="scan'208";a="351902121" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1a-821c648d.us-east-1.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Jul 2018 09:27:33 +0000 Received: from u54e1ad5160425a4b64ea.ant.amazon.com (iad7-ws-svc-lb50-vlan3.amazon.com [10.0.93.214]) by email-inbound-relay-1a-821c648d.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id w6A9RTI5007752 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Jul 2018 09:27:31 GMT Received: from u54e1ad5160425a4b64ea.ant.amazon.com (localhost [127.0.0.1]) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id w6A9RSon024913; Tue, 10 Jul 2018 11:27:28 +0200 Received: (from karahmed@localhost) by u54e1ad5160425a4b64ea.ant.amazon.com (8.15.2/8.15.2/Submit) id w6A9RR6p024912; Tue, 10 Jul 2018 11:27:27 +0200 From: KarimAllah Ahmed To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: KarimAllah Ahmed , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PATCH v5 1/2] KVM: Switch 'requests' to be 64-bit (explicitly) Date: Tue, 10 Jul 2018 11:27:19 +0200 Message-Id: <1531214840-24686-1-git-send-email-karahmed@amazon.de> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. The only exception here is ARM32 as it is still 32-bits. Cc: Paolo Bonzini Cc: Radim Krčmář Cc: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Jim Mattson Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Use FIELD_SIZEOF --- 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 4ee7bc5..64518a1 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -130,7 +130,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) >= (FIELD_SIZEOF(struct kvm_vcpu, requests) * 8) - KVM_REQUEST_ARCH_BASE); \ (unsigned)(((nr) + KVM_REQUEST_ARCH_BASE) | (flags)); \ }) #define KVM_ARCH_REQ(nr) KVM_ARCH_REQ_FLAGS(nr, 0) @@ -224,7 +224,7 @@ struct kvm_vcpu { int vcpu_id; int srcu_idx; int mode; - unsigned long requests; + u64 requests; unsigned long guest_debug; int pre_pcpu; @@ -1124,7 +1124,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); } static inline bool kvm_request_pending(struct kvm_vcpu *vcpu) @@ -1134,12 +1134,12 @@ static inline bool kvm_request_pending(struct kvm_vcpu *vcpu) static inline bool kvm_test_request(int req, struct kvm_vcpu *vcpu) { - return test_bit(req & KVM_REQUEST_MASK, &vcpu->requests); + return test_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->requests); } static inline void kvm_clear_request(int req, struct kvm_vcpu *vcpu) { - clear_bit(req & KVM_REQUEST_MASK, &vcpu->requests); + clear_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->requests); } static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) -- 2.7.4