Received: by 10.192.165.148 with SMTP id m20csp4774874imm; Tue, 1 May 2018 03:41:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrxI5rKqtBziK26ZDmrGodUf76cxej/8hW4xoiCOQCKGLEwFojljDQN+N7OTPuGVFauX4ld X-Received: by 2002:a17:902:b60b:: with SMTP id b11-v6mr15956806pls.330.1525171277029; Tue, 01 May 2018 03:41:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525171276; cv=none; d=google.com; s=arc-20160816; b=Qp1+WdLwNZC0fMISjar6+lSXELAbxbrNLde4BKYpYYHohCg8T7hDy0IS3LO7IyKtTz yOLgaeQSGcxoZyAUxpuaHFpYCPbdYjN8td0dt/HLJ8+1sBbaJPCtVfgXNJATItctC+39 2nWHXqc3Mc3LeDHCLFIQ7IVLXxmNRZYX17j9ZSjdMIDEBacLgfiEJ0TqFH26iQN1K69Y XiF+BtWS2AlhQnjB0zDLvsP0FEhe6+Hw3flRLGeqc2r3MZfYF5ltw2GYxW3wCHEBoyJl +cZN5v1bN6ORPp3MLr9btHABJx8x48iigrJWND/5YME0ZT2a5IK2gmYQxAay+xNYLBTW kN/w== 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:dkim-signature:arc-authentication-results; bh=9bRB/B65J87jvQ4vsvmLoPxIPbIcgjtwa92US+nwh7k=; b=BRlyScMVHIhyB9XOH5M4y6g2JAG+ZltR83CF8Afh78n/fsO0O+2FXvYsTF1eQHKdZM Bm56kMu0gVEq+JJV5ESU2sL15GnUrP6CTKlWzFIh8D6WiSuVzSBYqvLBzlOZzsS6dOym BQvZnyfkplOOFUt7MjfrBDXPuBhRSdwT6hGmMtrCk2oUNOjWd+GeitOS6Q7kLuMWr/O4 6L8E9N/rRj4wxTEuDgEeSspzN1fzYa7y5GWBAHxs/TUKCOzZHkYf2tGh08/T5q7CCVMM 2C/zeOoTabhwEkeId+tNiwB6X0Wddl9VNkf387Od9tMzVQQIQRfgM36zLYBvzhQHun2r yR1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BJHen7DI; 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 e3-v6si7408002pgr.400.2018.05.01.03.41.03; Tue, 01 May 2018 03:41:16 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BJHen7DI; 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 S1755037AbeEAKka (ORCPT + 99 others); Tue, 1 May 2018 06:40:30 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58580 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754511AbeEAKk2 (ORCPT ); Tue, 1 May 2018 06:40:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=9bRB/B65J87jvQ4vsvmLoPxIPbIcgjtwa92US+nwh7k=; b=BJHen7DILfERWuiq6NAPDHnj6 DZM9fSa9FhH9shqOLnYCaPI0fFbONntFqS3vwhZ7Nt0z3JBBhF5lPzzltIAlAvQ+RlttLwf4ixNEx yxzweO1hSrhuZr2DAlw7cJjq9521iu8fiEH17qK52P8TYlguKR6TIE7LMhq4ERElLc0W6wmqZ9c16 6RXlMvM1U4zW4bmA663YIDinkKfeZ0aqNnejypDDCUUAVg+1A9VnmdBi4Z4hjKPnNy6p+MmP/ZHLG MBZGOKaXfDj+b1/5Dh9gNpQw0bHgvAEtxc7+evEDumJiYNX5WcKU0XgSqSZEcAy4A3nHCEUsL+isL w9xmzwATA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fDShl-0002cC-PU; Tue, 01 May 2018 10:40:17 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 819CD2029FA14; Tue, 1 May 2018 12:40:15 +0200 (CEST) Date: Tue, 1 May 2018 12:40:15 +0200 From: Peter Zijlstra To: "Kohli, Gaurav" Cc: tglx@linutronix.de, mpe@ellerman.id.au, mingo@kernel.org, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Neeraj Upadhyay , Will Deacon , Oleg Nesterov Subject: Re: [PATCH v1] kthread/smpboot: Serialize kthread parking against wakeup Message-ID: <20180501104015.GE12235@hirez.programming.kicks-ass.net> References: <1524645199-5596-1-git-send-email-gkohli@codeaurora.org> <20180425200917.GZ4082@hirez.programming.kicks-ass.net> <20180426084131.GV4129@hirez.programming.kicks-ass.net> <20180426085719.GW4129@hirez.programming.kicks-ass.net> <4d3f68f8-e599-6b27-a2e8-9e96b401d57a@codeaurora.org> <20180430111744.GE4082@hirez.programming.kicks-ass.net> <3af3365b-4e3f-e388-8e90-45a3bd4120fd@codeaurora.org> <20180501101845.GE12217@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180501101845.GE12217@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 01, 2018 at 12:18:45PM +0200, Peter Zijlstra wrote: > Aaaah... I think I've spotted a problem there. We clear SHOULD_PARK > before we rebind, so if the thread lost the first PARKED store, > does the completion, gets migrated, cycles through the loop and now > observes !SHOULD_PARK and bails the wait-loop, then __kthread_bind() > will forever wait. > > Is that what you had in mind? Another possible problem is concurrent thread_park(), if both observe !IS_PARKED, we'll end up with 2 threads waiting on the completion, but we only do a single complete(). Of course, this might not be a suppored use of the API, and I don't think this will ever actually happen. But the whole !test_bit(IS_PARKED) thing seems to suggest it is fine calling this on an already parked thread. Confusing stuff that should be cleared up in any case.