Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4199302imw; Tue, 19 Jul 2022 01:40:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uy56flEskwsbv7QjEb+KfeyxxIZN8nsotr83JbYNrilRU9iOWM/BthtYJjsbIwldxcfQl3 X-Received: by 2002:a17:90b:3811:b0:1ef:d704:24cf with SMTP id mq17-20020a17090b381100b001efd70424cfmr36401320pjb.14.1658220020267; Tue, 19 Jul 2022 01:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658220020; cv=none; d=google.com; s=arc-20160816; b=vhhdXXELeKOtSVSZf+F7pxVuo8Oi4axmIZGbbHgS/24BQWKuMkP/gtCpHA0Qj4K++n 1HN5K7ZHQmiI/BfD1eT6cUgUOYKEdxNAWswiXHWrzUK3Ld+jTNfsKQRlw0YvmO7LTFiz Qwcpnqengz68iHqy8JitfVKdsyNxwh99xNC5U4+XyVj9SdzehfCj719G8FK/w03G3hy6 dBoIDf3YQp/JfPPHiZ4AIVypabiALJBF8T3xAtOO8YkfGg6RlUzR+4Ww8abijskSq1FL w0Bi6A/CXQkUSFtE/WjHScLqAv9N09K287aG6tPxuRICC1BDBD6plSnEX8rdyERwp/zz F5aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9jQa4lckmC1txse64a4KZrgV685FAd7K2JK2UP4N6c4=; b=UlUnL+41ZTtD5LZcVIjDk/rEAtp4LLTPWnOVWmE3F7p2rhIodVQ/Hg/uJ0bam87wYD bOU7dbpfc9T2uArP9AK+NSS0QHb1yTmw+ogNlsZxQ+TvF/kJmKS7gY5aQxpLydmm8dzF Tq8+IH1sxw0L3qUUpBfxuajxYZtiQGiZv1foZt1n3WQ3SCZb6gOmA2tb1KbihEzYCYR4 mem/1ivNMqCYygb6XBrf4IbG3d3M1+X8w7hC3Jrl27odqr2+UAKjwZLCBupiVrcYzkYd e+4wioAhZfg7XeHkLxy5aNLTcIGsAz+lCeAsAYLMHJpQNX+CNDrBxwSS3i+/3GafSs5y brRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FwKxrFSV; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q20-20020a170902789400b0016c41400ed6si17123114pll.41.2022.07.19.01.40.04; Tue, 19 Jul 2022 01:40:20 -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=@kernel.org header.s=k20201202 header.b=FwKxrFSV; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234416AbiGSIcj (ORCPT + 99 others); Tue, 19 Jul 2022 04:32:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbiGSIch (ORCPT ); Tue, 19 Jul 2022 04:32:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D882C220D1; Tue, 19 Jul 2022 01:32:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 91E3DB81893; Tue, 19 Jul 2022 08:32:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB0F3C341C6; Tue, 19 Jul 2022 08:32:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658219554; bh=pplzxYz6sIF7Mjy2044C1CiT3gW+EWOdS76ev7aFkFE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FwKxrFSVQL3hlswBw4lRRBHWH90KbD1z2uO1coRHKpavqBkt+9nh3n0GtVERzfPc6 2orAVr7dY8eJGmGWVSVuCLTk6Ot/5ycingm10rYQGCNOgGe7Wpv9VH8fBDB+l+jG+p evypO8rjE60vG4OhVd9PuZOD1lpv5dT2Q9YeCVwLkEOfgfN1/objmmgwMMxJHifuOc cBNIs743ctJu0UmjVd8O1EnHTemThPNu6vD6imLNjUdzY0AZdlAVMJDyx9rpMtzsGl aQQhwgSRaFCIdUVpipsARyiuYboLM1lfvOZG0up8ex3fHmgEDquXiHFdMgzKbFqhp7 W2NK4/VcUFMNQ== Date: Tue, 19 Jul 2022 10:32:29 +0200 From: Christian Brauner To: "lizhijian@fujitsu.com" Cc: Shuah Khan , "linux-kernel@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , Philip Li , kernel test robot Subject: Re: [PATCH] ksefltest: pidfd: Fix wait_states: Test terminated by timeout Message-ID: <20220719083229.b2yn2msrklmo2nb5@wittgenstein> References: <20220718025826.29148-1-lizhijian@fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220718025826.29148-1-lizhijian@fujitsu.com> X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Mon, Jul 18, 2022 at 02:58:39AM +0000, lizhijian@fujitsu.com wrote: > 0Day/LKP observed that the kselftest blocks forever since one of the > pidfd_wait doesn't terminate in 1 of 30 runs. After digging into > the source, we found that it blocks at: > ASSERT_EQ(sys_waitid(P_PIDFD, pidfd, &info, WCONTINUED, NULL), 0); > > wait_states has below testing flow: > CHILD PARENT > ---------------+-------------- > 1 STOP itself > 2 WAIT for CHILD STOPPED > 3 SIGNAL CHILD to CONT > 4 CONT > 5 STOP itself > 5' WAIT for CHILD CONT > 6 WAIT for CHILD STOPPED > > The problem is that the kernel cannot ensure the order of 5 and 5', once > 5's goes first, the test will fail. > > we can reproduce it by: > $ while true; do make run_tests -C pidfd; done > > Introduce a blocking read in child process to make sure the parent can > check its WCONTINUED. > > CC: Philip Li > Reported-by: kernel test robot > Signed-off-by: Li Zhijian > --- > I have almost forgotten this patch since the former version post over 6 months > ago. This time I just do a rebase and update the comments. > V2: rewrite with pipe to avoid usleep > --- Thanks for sticking with this! Reviewed-by: Christian Brauner (Microsoft)