Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp1183979ybh; Sat, 3 Aug 2019 20:02:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLy1K7ra1lrOsG7rNNzAlTw3qNOQI9tKxwPA4EZTF5ClCUK4THmrMyw4u68hQvIRINOST2 X-Received: by 2002:aa7:90d8:: with SMTP id k24mr66543172pfk.115.1564887743042; Sat, 03 Aug 2019 20:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564887743; cv=none; d=google.com; s=arc-20160816; b=SRGKy4lONbLXWG3PoxqeUC3Oqk56Ws//qtBZjgZRyRyFSfiCX6+UePuypJ2lMOkLV8 q0z7gEJbX9Ic7ewfhD7HmF7GShDJZfc8ptMtpY5TZnHpp4KYPd0YjqmAv6i8KtVzcLF6 2IyPR0RCHVJ84Wa/QjDIQZGSr+NP2vURdw/FJ7wVV/pTO90hNim6+p2GrC5Xl0lbde9m tBR+1320aaH5dXGTczbCR/jBCHDIGlkn375ZN6L4EVzGY24p4dclhqHhPLiSW6maCpV1 oTV5wHExnF79I2yg/fDp/cnY6pZX6EC1qvykFTBR/pptc2nsnZa9RX4Inarv83ltTWgS DTrQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject; bh=nAdpsMp0JwteBK+W0fAmX6K6NSq1AjtuMfd/ePK3wqA=; b=EzyjcaLB8Z8xN5T/rSNPngqvaU9sWn13SGbTqR4eLOdjJpX0vTLxy5inOnnoga1SxN 9vGRABf2uFj+3A37C0A9CbPo447GwJP5zk2Ll4XJMPyOPgDbE14i/Yrw8gS2y91g+pZy kNiqU8cPpx96d0CXamo8+nJKmMXdO0z0Ac4ee9IqH1rNWHr+H9xE9D4AqJKVhNFri84t exoXluzl6GRx0WYG2wYb4nVpUWk0hcTijl8oUkXopNXDFMOiGOSVEy33djVuk7YpRo9y rrVxYWSfgwzs+xdKxrPnD6X8STqtMzRC798oACshQPO109op/2An6Lw7M0mvSFNOb5qF kpAg== 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 h63si10000038pje.79.2019.08.03.20.02.08; Sat, 03 Aug 2019 20:02:23 -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 S2392238AbfHBVfk (ORCPT + 99 others); Fri, 2 Aug 2019 17:35:40 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:51091 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392168AbfHBVfj (ORCPT ); Fri, 2 Aug 2019 17:35:39 -0400 Received: by mail-wm1-f66.google.com with SMTP id v15so69239140wml.0 for ; Fri, 02 Aug 2019 14:35:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=nAdpsMp0JwteBK+W0fAmX6K6NSq1AjtuMfd/ePK3wqA=; b=AqXiSWMMowI13WnPKu7rOP5N2dnHQGrjCSQqKnw0wb/H4PqfBOQl2DbS9syzgVU3J7 U/fpCXLl28gyKfMXz8oh2NKMDwqYfohNaj8NAtLidfaZZbVR8COcaWJLLX4Vs3MVrp3z Fek5ODHD3dEaxOdAV+8RmXBuB0CFj6r7lWADwksY7/t7w8nRp06Xzviu9nxgojKve0hi y3QO3rIUj3UlMFj8cnABQ9wu3jhOiMcNP7N7wETj+S71yc2EYY4xyXp44l40erYkUWtG R6Uoxiw/4YcVAEYcTe6xE5TWtE0wwyZunbT3ICIWWJh/h6TLMax/2j/u3VXOQ3h2F3FQ 83HQ== X-Gm-Message-State: APjAAAXM+Il+B4bi6d78BSdyup8ifcsBzO7U+aGc1bga4WBiOXaYvSG+ +AZFCUHEWHEkYNUCUR5n5GanGA== X-Received: by 2002:a05:600c:240e:: with SMTP id 14mr5682450wmp.30.1564781737472; Fri, 02 Aug 2019 14:35:37 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:4013:e920:9388:c3ff? ([2001:b07:6468:f312:4013:e920:9388:c3ff]) by smtp.gmail.com with ESMTPSA id r123sm72240591wme.7.2019.08.02.14.35.36 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 02 Aug 2019 14:35:36 -0700 (PDT) Subject: Re: [patch 2/5] x86/kvm: Handle task_work on VMENTER/EXIT To: Thomas Gleixner , Sean Christopherson Cc: Oleg Nesterov , LKML , x86@kernel.org, Peter Zijlstra , Ingo Molnar , Sebastian Siewior , Anna-Maria Gleixner , Steven Rostedt , Julia Cartwright , Paul McKenney , Frederic Weisbecker , kvm@vger.kernel.org, Radim Krcmar , John Stultz , Andy Lutomirski , "Paul E. McKenney" References: <20190801143250.370326052@linutronix.de> <20190801143657.887648487@linutronix.de> <20190801162451.GE31538@redhat.com> <20190801213550.GE6783@linux.intel.com> From: Paolo Bonzini Openpgp: preference=signencrypt Message-ID: Date: Fri, 2 Aug 2019 23:35:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/08/19 23:47, Thomas Gleixner wrote: > Right you are about cond_resched() being called, but for SRCU this does not > matter unless there is some way to do a synchronize operation on that SRCU > entity. It might have some other performance side effect though. I would use srcu_read_unlock/lock around the call. However, I'm wondering if the API can be improved because basically we have six functions for three checks of TIF flags. Does it make sense to have something like task_has_request_flags and task_do_requests (names are horrible I know) that can be used like if (task_has_request_flags()) { int err; ...srcu_read_unlock... // return -EINTR if signal_pending err = task_do_requests(); if (err < 0) goto exit_no_srcu_read_unlock; ...srcu_read_lock... } taking care of all three cases with a single hook? This is important especially because all these checks are done by all KVM architectures in slightly different ways, and a unified API would be a good reason to make all architectures look the same. (Of course I could also define this unified API in virt/kvm/kvm_main.c, so this is not blocking the series in any way!). Paolo