Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2872945imm; Fri, 20 Jul 2018 06:28:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcmFNvm9hkpAMZ2aPYic5/NK/7eoX27HmG0QSVZnJ3jrCtbMJ3haQQcuYNFsEhq0Q5E+Yj6 X-Received: by 2002:a62:748:: with SMTP id b69-v6mr2183497pfd.177.1532093293431; Fri, 20 Jul 2018 06:28:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532093293; cv=none; d=google.com; s=arc-20160816; b=iEUy/FWqzFIJV9APfAbMGd/ZQ9TWMtkhmlFjDFWQUzXhejMJwzbE7zHuNxjkp8O7E2 snokSaMHJICsE7cicsOw4Kcs+1vUxgZm6fiUTNcH6q+PiXFfQuqbezDIsgCzJDh/8Xrg IuF9T0Ml7Sv6DojqSH43d7YAj4JHc8cNGhuZEO0KNpYP3H8lNKkrBCgQzMeVJXwHH9dT yb7AI0n9T3+RPWQpD+D+tpWr3M53Po5I8zhfP4+BFL1qLDzzRG6CkB/gdPYmq03LElHa 6ebs4GJXIRxdgYe58Pc1AMCIURmSwi6J7pbCfnTkOJl41nAo6pu54VoGPhAIKeAqmzFT SUXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=SsWLOmTLAoE2qBEgp9si/BqmJYjq6ioM2krYr47QReQ=; b=rWaGaYfX9CFTD5YR+cOvsJg76JzZCn4JaaOnzjAHB6KyMzlQuUyYVuZymRcNzbSB63 6hPWbrkesbH007JzXRHuU+fFnR5fqbcAYpuGQEDLCgVulEY+YmuiLDOrQt9Klq9lsSgx l1wYtux9YtCOri7o39AUj53SDQy8zDTsAKOT8/CiNSBCuBcMNHTrpa9rUywmO6LgTWx0 tDahYKkVib1n8NOhIH0Rk5rzKE4I0x4VNB2s5x8iPqDNT20eAgavth1H9qXI3ozcUnTX BPyu3CP7fos/SGMXA8s03aR4EaMB4Ztdxmj94pkMFLndP997X36w2zv671sxegthZ7RG XC4A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3-v6si1708926pld.114.2018.07.20.06.27.58; Fri, 20 Jul 2018 06:28:13 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732087AbeGTOPT (ORCPT + 99 others); Fri, 20 Jul 2018 10:15:19 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42874 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731176AbeGTOPR (ORCPT ); Fri, 20 Jul 2018 10:15:17 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B26B840704BB; Fri, 20 Jul 2018 13:26:59 +0000 (UTC) Received: from flask (unknown [10.43.2.80]) by smtp.corp.redhat.com (Postfix) with SMTP id C90A62026D69; Fri, 20 Jul 2018 13:26:57 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Fri, 20 Jul 2018 15:26:56 +0200 Date: Fri, 20 Jul 2018 15:26:56 +0200 From: Radim Krcmar To: Paolo Bonzini Cc: Wanpeng Li , LKML , kvm , Vitaly Kuznetsov Subject: Re: [PATCH v3 5/6] KVM: X86: Add NMI support to PV IPIs Message-ID: <20180720132656.GB8330@flask> References: <1530598891-21370-1-git-send-email-wanpengli@tencent.com> <1530598891-21370-6-git-send-email-wanpengli@tencent.com> <20180719163138.GC11749@flask> <825c953c-ec48-84cf-f1ca-bdee5d327427@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <825c953c-ec48-84cf-f1ca-bdee5d327427@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 20 Jul 2018 13:26:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 20 Jul 2018 13:26:59 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'rkrcmar@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-07-20 10:04+0200, Paolo Bonzini: > On 20/07/2018 05:53, Wanpeng Li wrote: > >>> - ret = kvm_hypercall3(KVM_HC_SEND_IPI, ipi_bitmap_low, ipi_bitmap_high, vector); > >>> + switch (vector) { > >>> + default: > >>> + icr = APIC_DM_FIXED | vector; > >>> + break; > >>> + case NMI_VECTOR: > >>> + icr = APIC_DM_NMI; > >> I think it would be better to say that KVM interprets NMI_VECTOR and > >> sends the interrupt as APIC_DM_NMI. > > It's not KVM, this is arch/x86/kernel/kvm.c so the guest side. Yes, I was preparing to drop the delivery mode bits as they are not needed for NMI_VECTOR: real APIC can't send nor receive vectors 0-15, so we could just say that NMI_VECTOR is sendable through this interface and is delivered as APIC_DM_NMI. I didn't realize that this allows the other delivery modes. They are not useful [1], but we don't really have a better use for the three bits. The only other option so far is extending the cluster index to increase addressability ... I'm starting to reconsider as addressing another few millions VCPUs would probably be even more useless. Wanpeng, sorry for the confusion, feel free to use any version. Document the hypercall layout, though, thanks. --- 1: I think that OSes will use unicast INIT+SIPI as it's easier to call it after preparing structures for the new CPU; SMI is pointless; LowestPriority shouldn't be supported; and Reserved (APIC_DM_REMRD) is reused for KVM unhalt, where unicast is most likely.