Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp429682ybg; Tue, 28 Jul 2020 09:26:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXwAgvjpW6dQUx09k4nFgQn53fNwJxk6QwiwE+4AsU0AtYud55Jh7S0Z9YYjQkvWbv60zF X-Received: by 2002:a17:906:1589:: with SMTP id k9mr10461928ejd.320.1595953569723; Tue, 28 Jul 2020 09:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595953569; cv=none; d=google.com; s=arc-20160816; b=MKE2TSychSSdrDkWtp70NFJfBgvocvXTt/Nm/TDg8smqAcWvGVx2LqzgwJVeSilUuN 60TH1NutPorBtEDrDT2OG5QcIXMUD/ySdG9HzuS5SDYY5HeceYPVNJ7IvgPrA6dcXNsr FY0S237uI1X+4n8e8IZR6tVSPF4kp2bV1ak4Bug9I4nYbS5LxpTTi01MgcDRyGbwMSZ6 DEnSmWtBzNNusCOPjeCqtpG0cKIZKnDv6v9EMHJ7aLAugkOi6HdVxZZcB1AF7whRVH+S L6VaP+DNSuIaVV1eSLZ9O5WybyiWv83RX3RdqpIVH4VUGsNQXq3jqyzAu/N0wx6e8zrq n+6g== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=Y5bQmMxqNH0eYHqn7oAAHSQk45aCvXvdbzlgHVQcRzw=; b=U+BqhmDVb7nrriUvKieBZ9GzB8/zKmCF0xA5q8D53RcJYu8eTvct7TLZTqiJs0dqTY Qpl9wORgjg5mT+5KIGTU0U5IYbsGpqMC+8cn13hwKXkXR/Qwoa+YDrq2Herr7235CWa3 Q9bFpVVlK7ijvU9LLb2ztapKV1lMd2BEpsRmqXf/m/koe2S/lg8+pjgRECnDLjCH8J0Y pLHflBK9ZyuRQF/WDj5F3gzg9fKJr6m7WvvMMKH3KeW/0RYp6uD/MmZUzNfiA9j7AWUu Lbg49UJMKeLmbSj8zzjtv2n9x3oJLv4xgpIis+7v9cvo+FJ99iDwZK3LXIXirc+ldtpC bDxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gs14si4447174ejb.615.2020.07.28.09.25.47; Tue, 28 Jul 2020 09:26:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731233AbgG1QZ2 (ORCPT + 99 others); Tue, 28 Jul 2020 12:25:28 -0400 Received: from mga18.intel.com ([134.134.136.126]:2871 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730679AbgG1QZ2 (ORCPT ); Tue, 28 Jul 2020 12:25:28 -0400 IronPort-SDR: j9HYufdvPC8mybHGZP8sBdzH6L4Slak0UVRx6JOXTtbl+5/yIs+MJNYyDe/f28L5WaSfEAMIJn BEdk0X8Db0jA== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="138772585" X-IronPort-AV: E=Sophos;i="5.75,406,1589266800"; d="scan'208";a="138772585" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2020 09:25:28 -0700 IronPort-SDR: YAW0CaxbxjIeOA9o7ZaCbA5yvLUgv88BYxvkLjskK3Y4+SilGEzhvrR8BL2HdV5/HfpcSnkpiB nEQiVb0Gabcw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,406,1589266800"; d="scan'208";a="290231385" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by orsmga006.jf.intel.com with ESMTP; 28 Jul 2020 09:25:24 -0700 Date: Tue, 28 Jul 2020 09:25:24 -0700 From: Sean Christopherson To: Xiaoyao Li Cc: Vitaly Kuznetsov , Chenyi Qiang , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , Wanpeng Li , Jim Mattson , Joerg Roedel Subject: Re: [RFC 2/2] KVM: VMX: Enable bus lock VM exit Message-ID: <20200728162524.GE5300@linux.intel.com> References: <20200628085341.5107-1-chenyi.qiang@intel.com> <20200628085341.5107-3-chenyi.qiang@intel.com> <878sg3bo8b.fsf@vitty.brq.redhat.com> <0159554d-82d5-b388-d289-a5375ca91323@intel.com> <87366bbe1y.fsf@vitty.brq.redhat.com> <87zh8j9to2.fsf@vitty.brq.redhat.com> <20200723012114.GP9114@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 27, 2020 at 12:38:53PM +0800, Xiaoyao Li wrote: > On 7/23/2020 9:21 AM, Sean Christopherson wrote: > >On Wed, Jul 01, 2020 at 04:49:49PM +0200, Vitaly Kuznetsov wrote: > >>Xiaoyao Li writes: > >>>So you want an exit to userspace for every bus lock and leave it all to > >>>userspace. Yes, it's doable. > >> > >>In some cases we may not even want to have a VM exit: think > >>e.g. real-time/partitioning case when even in case of bus lock we may > >>not want to add additional latency just to count such events. > > > >Hmm, I suspect this isn't all that useful for real-time cases because they'd > >probably want to prevent the split lock in the first place, e.g. would prefer > >to use the #AC variant in fatal mode. Of course, the availability of split > >lock #AC is a whole other can of worms. > > > >But anyways, I 100% agree that this needs either an off-by-default module > >param or an opt-in per-VM capability. > > > > Maybe on-by-default or an opt-out per-VM capability? > Turning it on introduces no overhead if no bus lock happens in guest but > gives KVM the capability to track every potential bus lock. If user doesn't > want the extra latency due to bus lock VM exit, it's better try to fix the > bus lock, which also incurs high latency. Except that I doubt the physical system owner and VM owner are the same entity in the vast majority of KVM use cases. So yeah, in a perfect world the guest application that's causing bus locks would be fixed, but in practice there is likely no sane way for the KVM owner to inform the guest application owner that their application is broken, let alone fix said application. The caveat would be that we may need to enable this by default if the host kernel policy mandates it. > >>I'd suggest we make the new capability tri-state: > >>- disabled (no vmexit, default) > >>- stats only (what this patch does) > >>- userspace exit > >>But maybe this is an overkill, I'd like to hear what others think. > > > >Userspace exit would also be interesting for debug. Another throttling > >option would be schedule() or cond_reched(), though that's probably getting > >into overkill territory. > > > > We're going to leverage host's policy, i.e., calling handle_user_bus_lock(), > for throttling, as proposed in https://lkml.kernel.org/r/1595021700-68460-1-git-send-email-fenghua.yu@intel.com >