Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp1188580ybh; Sat, 3 Aug 2019 20:08:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDBMLeM3J3oUL+n0IwvPDz7JYVVLePcPJwmq3b1EsPPqjj486OuNwV6wr0Vsprb4rNrWdJ X-Received: by 2002:a17:90b:8c8:: with SMTP id ds8mr12050972pjb.89.1564888131049; Sat, 03 Aug 2019 20:08:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564888131; cv=none; d=google.com; s=arc-20160816; b=iHzQ/aQvfFX3yVt2eIoV2Y29dj061za9ec56Fe3BDmwBEpWGV6/cqhUtNKuEiDbA9x eUvYIzYFVI533cGOnwAjbuTtOjM1vdGkQLzTyHz4qpxobxlC7e7tBwK9jFUCVn94oC2U sT7wguGVII6e+KammueNc7FIgjl2R9JfGJ/NC/gJEasdmRjj6d4iaEPsTZh7QfVTAC/r MbFC1ANYbJ6izor/s2ZLsYKP5X5eJRWH4VwyHFglO0wkhWrhPPP7C4e/PO7rCLknDxiu VQzW0+wuEbXkis+Ujer8RIAvB3khjDfeS8Qznepq2qWEnAEeCv2CM89PU/8J+cjfE2PQ I6GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=OsBT79YuTMNXNYFgPa6QgtCi941kNass7zYwJw3VItM=; b=NrWKL7EMbfAdb5VtuGdZ70F1mml+MFHy/twvd6vtDdN/gg01zWKqY+jzaum2YKwPM7 2U8W/w/laIAJM2y184/aoCkmVs4302DbZ1vv5Hb+FXZWrD15Z4dHKVoEEFJdlQ4Uecxn ys3hEoTFFb++2iRx/8McwJOcEo1m3JkImXlba1zosFjBjmPhvOM+7K4ZsZv8o9fPz25P bWOjWhl43fNvsuekMAwPmyjmJQmy2j+VJWklQ8KCIYFXaVWLznB6v657WJnGKMu1CB5f tgpplqBPmZOlLqTwN627NKEQQIca+XGA3FxL5Q370Rk2WhRfxzd2ugxLOh8GuwsbxRcq nndA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l102si9597657pje.78.2019.08.03.20.08.36; Sat, 03 Aug 2019 20:08:51 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388789AbfHBWXX (ORCPT + 99 others); Fri, 2 Aug 2019 18:23:23 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:40613 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730633AbfHBWXX (ORCPT ); Fri, 2 Aug 2019 18:23:23 -0400 Received: from pd9ef1cb8.dip0.t-ipconnect.de ([217.239.28.184] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1htfwv-0002gc-Jk; Sat, 03 Aug 2019 00:22:57 +0200 Date: Sat, 3 Aug 2019 00:22:54 +0200 (CEST) From: Thomas Gleixner To: Paolo Bonzini cc: Sean Christopherson , 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" Subject: Re: [patch 2/5] x86/kvm: Handle task_work on VMENTER/EXIT In-Reply-To: Message-ID: References: <20190801143250.370326052@linutronix.de> <20190801143657.887648487@linutronix.de> <20190801162451.GE31538@redhat.com> <20190801213550.GE6783@linux.intel.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2 Aug 2019, Paolo Bonzini wrote: > 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!). You're not holding up something. Having a common function for this is definitely the right approach. As this is virt specific because it only checks for non arch specific bits (TIF_NOTIFY_RESUME should be available for all KVM archs) and the TIF bits are a subset of the available TIF bits because all others do not make any sense there, this really should be a common function for KVM so that all other archs which obviously lack a TIF_NOTIFY_RESUME check, can be fixed up and consolidated. If we add another TIF check later then we only have to do it in one place. Thanks, tglx