Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1434876

Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Andrew Honig <ahonig@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map
Date Fri, 01 Jul 2016 00:20:01 +0200
Message-ID <rPStr-6J4-13@gated-at.bofh.it> (permalink)
References <rPRe1-5Ou-3@gated-at.bofh.it> <rPRe2-5Ou-13@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=mWUqlj9F9iLBy0u7KMRPzzGuujSUsZH+RKeJPaQlsoc=; b=EIVjxppff/cNUWQ/cGPfpKRUICAO99e9mrt3xzQXIZ36YoYrGLKuY5cFs/L/PMFRBo 0ozlLAgm9Ry4mritW7D7OMgOhNyCE9biI5yp+2/8KTMpFh8+/BbOnCcC3qsxvGXKI7bq sAMB1p4b65qeVRlEneFvsy8c9/Sv3VkAhLphro9vGc9etFQmlXqkOfrGFn9Fn7FWjs/F QKdsRm6lfoMiFX4HucPOkogo2XUCk7LiVB5Qc1p1EgPqSPccoBdK5VF6W4jcC2WwkJPQ U1Gfcq/+5ysPA/QMCvjwE6nVA9PFxl5fkt+YQHPdREzY/bb8pkzdF7ucW+JcBrLazw7m ZdRw==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=mWUqlj9F9iLBy0u7KMRPzzGuujSUsZH+RKeJPaQlsoc=; b=KzK+1YShQo5pYCr1db53YmmGjIbsddSCM68abCwXFjzg+vOLW9t/QbwPC2OFbCh9Is 1Un82HTwWHAKDlvVgI2pkyNgmqNRJBFNADY9/usXT/kOMQMHz2PTV+P96+7qQCxpcxjq om1qQteYsjHlRD4K0+RMFRM6HStGKzHL7bCO5WSrlThhtofsQP615dAd/QWkxkWCRZsg A0JE8SCwLf/1vezJ8PO/b8ilVfDUiwkLO5thMRlS+eaKseMT4oGpf9ytpL4KmlJ4Fz5q qO9jYwhWVBCYi24c7WPA0X4EuazB/liY+JM5PZo0UQlv1q/vbT0aqZnjrgASi7ESXLfF CcNw==
X-Gm-Message-State ALyK8tKfC2ucG9K5+Nv5gCJ9ZP4MjD5AWdahx0dMF0LzIR7y5Yec/+H+DvUipwfUelmG6jATVeyTIQGMIOli00+L
X-Received by 10.36.2.2 with SMTP id 2mr17684505itu.34.1467324930242; Thu, 30 Jun 2016 15:15:30 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 22
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, kvm <kvm@vger.kernel.org>, Paolo Bonzini <pbonzini@redhat.com>, "Lan, Tianyu" <tianyu.lan@intel.com>, Igor Mammedov <imammedo@redhat.com>, Jan Kiszka <jan.kiszka@web.de>, Peter Xu <peterx@redhat.com>
X-Original-Date Thu, 30 Jun 2016 15:15:10 -0700
X-Original-Message-ID <CAKB9nXt0N8-asM46ERcRr5Q53LJfqyGa8jBSXoFo1dru-kjwEw@mail.gmail.com>
X-Original-References <20160630205429.16480-1-rkrcmar@redhat.com> <20160630205429.16480-4-rkrcmar@redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1434876

Show key headers only | View raw


> -
> -       new = kzalloc(sizeof(struct kvm_apic_map), GFP_KERNEL);
> +       u32 size, max_id = 255;
>
>         mutex_lock(&kvm->arch.apic_map_lock);
>
> +       kvm_for_each_vcpu(i, vcpu, kvm)
> +               if (kvm_apic_present(vcpu))
> +                       max_id = max(max_id, kvm_apic_id(vcpu->arch.apic));
> +
> +       /* kvm_apic_map_get_logical_dest() expects multiples of 16 */
> +       size = round_up(max_id + 1, 16);

Now that you're using the full range of apic_id values, could this
calculation overflow?  Perhaps max_id could be u64?

> +       new = kzalloc(sizeof(struct kvm_apic_map) +
> +                     sizeof(struct kvm_lapic) * size, GFP_KERNEL);
> +
>         if (!new)
>                 goto out;
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v1 00/11] KVM: x86: break the xAPIC barrier Radim Krčmář <rkrcmar@redhat.com> - 2016-06-30 23:00 +0200
  [PATCH v1 06/11] KVM: x86: use hardware-compatible format for APIC ID register Radim Krčmář <rkrcmar@redhat.com> - 2016-06-30 23:00 +0200
    Re: [PATCH v1 06/11] KVM: x86: use hardware-compatible format for  APIC ID register Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 10:40 +0200
      Re: [PATCH v1 06/11] KVM: x86: use hardware-compatible format for  APIC ID register Radim Krčmář <rkrcmar@redhat.com> - 2016-07-01 15:20 +0200
        Re: [PATCH v1 06/11] KVM: x86: use hardware-compatible format for  APIC ID register Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 16:20 +0200
          Re: [PATCH v1 06/11] KVM: x86: use hardware-compatible format for  APIC ID register Radim Krčmář <rkrcmar@redhat.com> - 2016-07-01 17:00 +0200
            Re: [PATCH v1 06/11] KVM: x86: use hardware-compatible format for  APIC ID register Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 17:10 +0200
              Re: [PATCH v1 06/11] KVM: x86: use hardware-compatible format for  APIC ID register Radim Krčmář <rkrcmar@redhat.com> - 2016-07-01 18:00 +0200
                Re: [PATCH v1 06/11] KVM: x86: use hardware-compatible format for  APIC ID register Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 18:40 +0200
  [PATCH v1 10/11] KVM: x86: add KVM_CAP_X2APIC_API Radim Krčmář <rkrcmar@redhat.com> - 2016-06-30 23:00 +0200
    Re: [PATCH v1 10/11] KVM: x86: add KVM_CAP_X2APIC_API Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 10:30 +0200
      Re: [PATCH v1 10/11] KVM: x86: add KVM_CAP_X2APIC_API Radim Krčmář <rkrcmar@redhat.com> - 2016-07-01 15:30 +0200
    Re: [PATCH v1 10/11] KVM: x86: add KVM_CAP_X2APIC_API David Matlack <dmatlack@google.com> - 2016-07-01 20:20 +0200
      Re: [PATCH v1 10/11] KVM: x86: add KVM_CAP_X2APIC_API Radim Krčmář <rkrcmar@redhat.com> - 2016-07-01 20:40 +0200
  [PATCH v1 04/11] KVM: x86: use u16 for logical VCPU mask in lapic Radim Krčmář <rkrcmar@redhat.com> - 2016-06-30 23:00 +0200
    Re: [PATCH v1 04/11] KVM: x86: use u16 for logical VCPU mask in lapic Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 10:20 +0200
      Re: [PATCH v1 04/11] KVM: x86: use u16 for logical VCPU mask in lapic Radim Krčmář <rkrcmar@redhat.com> - 2016-07-01 14:50 +0200
        Re: [PATCH v1 04/11] KVM: x86: use u16 for logical VCPU mask in lapic Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 16:20 +0200
  [PATCH v1 07/11] KVM: VMX: optimize APIC ID read with APICv Radim Krčmář <rkrcmar@redhat.com> - 2016-06-30 23:00 +0200
  [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map Radim Krčmář <rkrcmar@redhat.com> - 2016-06-30 23:00 +0200
    Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map Andrew Honig <ahonig@google.com> - 2016-07-01 00:20 +0200
      Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 10:50 +0200
        Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map Radim Krčmář <rkrcmar@redhat.com> - 2016-07-01 14:50 +0200
          Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 16:10 +0200
            Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map Radim Krčmář <rkrcmar@redhat.com> - 2016-07-01 16:40 +0200
              Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 17:10 +0200
                Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 17:20 +0200
                Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map Radim Krčmář <rkrcmar@redhat.com> - 2016-07-01 18:00 +0200
                Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 18:40 +0200
                Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map Radim Krčmář <rkrcmar@redhat.com> - 2016-07-01 17:40 +0200
    Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 09:40 +0200
  [PATCH v1 01/11] KVM: x86: bump KVM_SOFT_MAX_VCPUS to 240 Radim Krčmář <rkrcmar@redhat.com> - 2016-06-30 23:00 +0200
    Re: [PATCH v1 01/11] KVM: x86: bump KVM_SOFT_MAX_VCPUS to 240 Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 10:50 +0200
  [PATCH v1 05/11] KVM: x86: use generic function for MSI parsing Radim Krčmář <rkrcmar@redhat.com> - 2016-06-30 23:00 +0200
  [PATCH v1 11/11] KVM: x86: bump MAX_VCPUS to 288 Radim Krčmář <rkrcmar@redhat.com> - 2016-06-30 23:00 +0200
    Re: [PATCH v1 11/11] KVM: x86: bump MAX_VCPUS to 288 Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 10:50 +0200
  [PATCH v1 09/11] KVM: x86: reset lapic base in kvm_lapic_reset Radim Krčmář <rkrcmar@redhat.com> - 2016-06-30 23:00 +0200
    Re: [PATCH v1 09/11] KVM: x86: reset lapic base in kvm_lapic_reset Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 10:50 +0200
  [PATCH v1 02/11] KVM: x86: add kvm_apic_map_get_dest_lapic Radim Krčmář <rkrcmar@redhat.com> - 2016-06-30 23:00 +0200
    Re: [PATCH v1 02/11] KVM: x86: add kvm_apic_map_get_dest_lapic Paolo Bonzini <pbonzini@redhat.com> - 2016-07-01 10:00 +0200
      Re: [PATCH v1 02/11] KVM: x86: add kvm_apic_map_get_dest_lapic Radim Krčmář <rkrcmar@redhat.com> - 2016-07-01 14:50 +0200
  [PATCH v1 08/11] KVM: x86: directly call recalculate_apic_map on lapic restore Radim Krčmář <rkrcmar@redhat.com> - 2016-06-30 23:00 +0200

csiph-web