Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8197129rwi; Tue, 25 Oct 2022 03:52:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6MdFWxWZGaosHR2dTfchikAzV/vg7QpapjysALY3QMuxXbhvSst3ipPiYu3fAOUEyHQ1kx X-Received: by 2002:a17:90a:fab:b0:213:1431:86d0 with SMTP id 40-20020a17090a0fab00b00213143186d0mr10733484pjz.154.1666695131194; Tue, 25 Oct 2022 03:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666695131; cv=none; d=google.com; s=arc-20160816; b=DKfBvQKrp4StuRbUwK0tGfxLHpoIJGaOXOrCjWfgygp0Uy1nrPJ12xZB01xRlvvqOL k/cd+esWe9vNScO2ICalf3QUzawrT3YBYMiZ980ozJM+wIVjsmvWqpLzIXoU2t5IxmWw 9s0M6p3tYnoB3yXFOLEyLuhwsnZ2XevURO3tyL5xUhcP0W+tUuCfjo2TMqV+kwK9zlH8 37MKQ4mFmTqAHwrxK4gEGWX4O7nROUli7rEq5ZMgcSeTrgzLWKFmbhDEI48OlPNhf/u1 G1ine7gYc7ukmdnRkVeey3QBUma8D8SZfEDkYWhvVeLH8iIAQ6owG9+MRcidZ1dZklds pgSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=knqQPG7pPxcHsfRxnyxJXNLDn4XFV6zEBhTCEqjUpIc=; b=K3oWuGebNtPVKYmvLXqeS70jTNe/w/dcMQhmwCUATXI2dPiTdvHhyif6cMkCXm/3P1 yFERSDG7s2d/525YBat1InykBIYpwXUltPt++I6FlXHdT/hf2slrJXGUiXHQ/5HYon9H /sDQ5ZTzYLdW/+qu3hm4w4EgSoJZbcMMDTIgL2MLkR4AiGayzxEK7Pumc5YJeVjW8Nuc E/1g9oXDWvxP0BD+tdrLJevJTO5a/ltClPElkZleQNY+ObHetP/BMx6M6CMvqOWYEaVj uW6G6N4Lpk+JN7c5wpkE4wvxc2IynNmOQHOKo1XVMd85UFxBdoJhgBYKyoGLViPGs4f/ +DOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DjoIoNkn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v1-20020a632f01000000b0043a061cc079si2482917pgv.358.2022.10.25.03.51.58; Tue, 25 Oct 2022 03:52:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DjoIoNkn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232231AbiJYKIs (ORCPT + 99 others); Tue, 25 Oct 2022 06:08:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232163AbiJYKIG (ORCPT ); Tue, 25 Oct 2022 06:08:06 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D17A121265 for ; Tue, 25 Oct 2022 03:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666692094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=knqQPG7pPxcHsfRxnyxJXNLDn4XFV6zEBhTCEqjUpIc=; b=DjoIoNkniVxFFlkc+x7vcIm0UffHjQZJa5yXVOVL4kSdRjKLAdGZ1cFrISGiopGihN9fjS S7zfPimfJBnGKcChHTOuN2EM5MYSXzgRKv0y3mZE/qydLFXl3s7Fsgc/Cud9cvtNXT/nGe K4XG3TzHQCcEDKl/jxogdX+APrNCFPQ= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-299-u4x3RZdNOjaAMkKLfrIprg-1; Tue, 25 Oct 2022 06:01:33 -0400 X-MC-Unique: u4x3RZdNOjaAMkKLfrIprg-1 Received: by mail-qk1-f200.google.com with SMTP id x16-20020a05620a449000b006eecf2d621eso11058143qkp.16 for ; Tue, 25 Oct 2022 03:01:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=knqQPG7pPxcHsfRxnyxJXNLDn4XFV6zEBhTCEqjUpIc=; b=A/VD1UQ22uxFhG0PIePZq2tmQQoq4QgVUPqw220CHW3CFTtagAcZkETOkpb00EerxW i94DBLDRsP7Eazl8cK4gxoROj18bCAQGobZ2RpdvxEFa/btFSY64RzNnCqD+ZDxj8BRc dyBQ7nQ2damDETXFwk4om8WN1L2ttU8uKnzpojVtgwEZJBSm6oHda9kGY/e+UCQclZLH IITulA56ujS56N1t+PfJYV5PDEx3vLAlHeBJkijXCdO5ArOZjTFsHcki3pCfHV9wX/9o EbIiIYGE7gO2In0G7RfHSJfb00lhf1+iu35HDfvETjT8irMq7LxW2N3/kqhkBvGC/PvA LFvQ== X-Gm-Message-State: ACrzQf0BBv3myfvx6iA3Iw2hYINrVvfnWOEQxnznC6rpvQmWRS6DmKsU 55wb4FRsn5tc6KLl+pkIrmYjKCKDrKskb1Kq+711Cr69rTVjmpLVjTjfBf5BBhfT4E6Hjigbmk8 N42HFk37Q6hKH3ceM3NKrJv0E X-Received: by 2002:a0c:e28a:0:b0:4b9:e578:1581 with SMTP id r10-20020a0ce28a000000b004b9e5781581mr8746741qvl.102.1666692092759; Tue, 25 Oct 2022 03:01:32 -0700 (PDT) X-Received: by 2002:a0c:e28a:0:b0:4b9:e578:1581 with SMTP id r10-20020a0ce28a000000b004b9e5781581mr8746715qvl.102.1666692092521; Tue, 25 Oct 2022 03:01:32 -0700 (PDT) Received: from [10.201.49.36] (nat-pool-mxp-u.redhat.com. [149.6.153.187]) by smtp.googlemail.com with ESMTPSA id ay37-20020a05620a17a500b006eeb3165565sm1755740qkb.80.2022.10.25.03.01.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Oct 2022 03:01:32 -0700 (PDT) Message-ID: Date: Tue, 25 Oct 2022 12:01:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH 3/4] KVM: introduce memory transaction semaphore Content-Language: en-US To: Emanuele Giuseppe Esposito , kvm@vger.kernel.org Cc: Jonathan Corbet , Maxim Levitsky , Sean Christopherson , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , David Hildenbrand , x86@kernel.org, "H. Peter Anvin" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221022154819.1823133-1-eesposit@redhat.com> <20221022154819.1823133-4-eesposit@redhat.com> <62500f94-b95b-1e16-4aa2-f67905fab01a@redhat.com> From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/24/22 14:57, Emanuele Giuseppe Esposito wrote: > > > Am 23/10/2022 um 19:50 schrieb Paolo Bonzini: >> On 10/22/22 17:48, Emanuele Giuseppe Esposito wrote: >>> +static DECLARE_RWSEM(memory_transaction); >> >> This cannot be global, it must be per-struct kvm.  Otherwise one VM can >> keep the rwsem indefinitely while a second VM hangs in >> KVM_KICK_ALL_RUNNING_VCPUS. >> >> It can also be changed to an SRCU (with the down_write+up_write sequence >> changed to synchronize_srcu_expedited) which has similar characteristics >> to your use of the rwsem. >> > > Makes sense, but why synchronize_srcu_expedited and not synchronize_srcu? Because (thanks to the kick) you expect the grace period to end almost immediately, and synchronize_srcu() will slow down sensibly the changes to the memory map. Paolo