Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp719865pxm; Fri, 25 Feb 2022 18:15:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCn/UQ/JGbEgZPSCuxrqh1voe+j3YL5crr7qRVf+jClJE434n53u0QTtvsGXf7cUmbPNDG X-Received: by 2002:a65:5386:0:b0:375:ec6f:667f with SMTP id x6-20020a655386000000b00375ec6f667fmr6526105pgq.543.1645841703853; Fri, 25 Feb 2022 18:15:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645841703; cv=none; d=google.com; s=arc-20160816; b=py9Al4jYzP4hLWiA/0Awng7uA1sGwWf2xCqm2HROH3D0R3OLOV7+hiNP2zaqIXuqeQ 2dD7Y+qqbVsyl7a0/OrYsS+jFzkTZ20K0z4IXfYiBztFrtqfJkrspNqeY1Wf/ATRpamF WnLgLKuZBsjrfWxqO+BirLkEgh4AJBcO9rjhSPPg2UY8x4eT2qUSJOaC89VHV3KZ01gK ryF5O+BAVXWR5JnHMIXQmn+0KGBORlWZC6sIVHHtp7zsqQnIs19qnzk07s0SrnQGoxUI xqSYEJVtLNi9CjcLnyndNI9xYcMXRuWMhxnC/11fJtQHlFWcC/rDcJP9ddWCrlg3FA8d RGaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=GY0iFUW9uJV4Vgn8uP3pu0/kxNIDCy02Hy0asV7edUo=; b=FOrFzCi2ke0ymCL/LI9AsHZFkAufwFjYUY6yfpTVT5O9+9marWIzgiVBp9KhpD+E6m IrRWN8sulsKL8XE0XJkmrn8Nwezji38Ezs4wdXba54maaIVYHIGELaBTTwDK8KOEPHHw FFcX2vCJVb549EZN/buXEF0u/xm8xStavu/v1J1EsY91mJLWp53jeFt9KXJOi0NXT9x3 AE4AaGWs0I/cWa7A+46SJrTZIw3BEm37tZ1qN4c2neO3I9fzDDKcFFkhe4rKVC7bG7aw J51eXpAUQHKG5dtQ8gZJgnqABdKcZ7MgeO6TSdiWdC7z1iO7IowRZqjYHin0c626JBU5 Pt3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=TXIXb+dw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v22-20020a637a16000000b0036c3394f0e0si3384080pgc.685.2022.02.25.18.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 18:15:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=TXIXb+dw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F0EDD25C515; Fri, 25 Feb 2022 17:48:31 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243914AbiBYRiR (ORCPT + 99 others); Fri, 25 Feb 2022 12:38:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243873AbiBYRiN (ORCPT ); Fri, 25 Feb 2022 12:38:13 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BF5D25C41; Fri, 25 Feb 2022 09:37:38 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B9F6B210E1; Fri, 25 Feb 2022 17:37:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1645810656; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GY0iFUW9uJV4Vgn8uP3pu0/kxNIDCy02Hy0asV7edUo=; b=TXIXb+dwDLgXu7FYESoUdvIw3WVo04Tn7lfRoljMYCviwhHmW1InDMG9ZQjzhXih8TqnNI ES+6S6tUSmYt1b2swWoy9lcUJ69gLBkQP4/kolRUjgAXtxWkGHRG+fNa8+fQejAvYGAu+U AhFlb6bQkB59K5/cvejRsALjZ6OA0UI= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9594513C00; Fri, 25 Feb 2022 17:37:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eev8I+ATGWLCOwAAMHmgww (envelope-from ); Fri, 25 Feb 2022 17:37:36 +0000 Date: Fri, 25 Feb 2022 18:37:35 +0100 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Vipin Sharma Cc: Paolo Bonzini , Tejun Heo , seanjc@google.com, lizefan.x@bytedance.com, hannes@cmpxchg.org, dmatlack@google.com, jiangshanlai@gmail.com, kvm@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] KVM: Move VM's worker kthreads back to the original cgroups before exiting. Message-ID: <20220225173734.GA26252@blackbody.suse.cz> References: <20211222225350.1912249-1-vipinsh@google.com> <20220105180420.GC6464@blackbody.suse.cz> <7a0bc562-9f25-392d-5c05-9dbcd350d002@redhat.com> <20220120150502.GC27269@blackbody.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi Vipin. On Wed, Feb 16, 2022 at 09:37:45AM -0800, Vipin Sharma wrote: > On Thu, Jan 20, 2022 at 7:05 AM Michal Koutn? wrote: > > Have I missed an obstacle? Aha... [ > I used few other combination where I put kernel_wait() call after > put_task_struct(k) call. > > Every time during the module exit, kernel was crashing like: Thanks for trying this out. ] > Do you have any suggestions what might be the right way to use this API? ...it has occured to me now -- the KVM kthread is not a child of the wanna-wait user task. So the kernel_wait() silently errs with -ECHILD and task_struct is released too early and that (probably) brings about the crash. I'm sorry for not realizing that initially. (Generally, any kthread_create'd task would be affected by this. I guess the KVM worker threads can't be forked from the kvm_create_vm() callers? (It could prevent the double migration to and from caller's cgroup though.)) Michal