Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752097AbdIMUIg (ORCPT ); Wed, 13 Sep 2017 16:08:36 -0400 Received: from smtp2.provo.novell.com ([137.65.250.81]:54933 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751494AbdIMUIe (ORCPT ); Wed, 13 Sep 2017 16:08:34 -0400 From: Davidlohr Bueso To: mingo@kernel.org, peterz@infradead.org, pbonzini@redhat.com Cc: npiggin@gmail.com, paulmck@linux.vnet.ibm.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, dave@stgolabs.net Subject: [PATCH v2 0/7] swait: Introduce and use swq_has_sleeper() Date: Wed, 13 Sep 2017 13:08:17 -0700 Message-Id: <20170913200824.28067-1-dave@stgolabs.net> X-Mailer: git-send-email 2.12.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1288 Lines: 36 Changes from v1: https://lkml.org/lkml/2017/9/5/622 - Added patch 7 (mips) - Small comment fixlets in patch 1. Hi, Recently[1] Nick mentioned that a lot of swait_active() callers look fishy. This is because it inherited bad habits from regular waitqueues. Other than rcu, kvm is one of the main callers, which I audited. The following patches fix and/or justify (in baby steps) some of the callers. The main exception is s390, which I didn't follow how ->valid_wakeup can get hoisted as kvm_vcpu_block does not use that in the wait loop. Thanks! Davidlohr Bueso (7): sched/wait: Add swq_has_sleepers() kvm,async_pf: Use swq_has_sleepers() kvm,lapic: Justify use of swait_activate() kvm,x86: Fix apf_task_wake_one() wq serialization kvm: Serialize wq active checks in kvm_vcpu_wake_up() kvm,powerpc: Serialize wq active checks in ops->vcpu_kick kvm,mips: Fix potential swait_active() races arch/mips/kvm/mips.c | 4 +-- arch/powerpc/kvm/book3s_hv.c | 2 +- arch/x86/kernel/kvm.c | 2 +- arch/x86/kvm/lapic.c | 4 +++ include/linux/swait.h | 58 ++++++++++++++++++++++++++++++++++++++++++-- virt/kvm/async_pf.c | 6 +---- virt/kvm/kvm_main.c | 2 +- 7 files changed, 66 insertions(+), 12 deletions(-) -- 2.12.0