Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1067947rwr; Thu, 4 May 2023 13:41:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5d4WoqDb40QVYO1GD9LVoITto4Z+r2w6I5qa0mEbAcXL2Gh8+V3vgWkNUbpZqdVxnbiKDQ X-Received: by 2002:a17:903:48e:b0:1a6:cb66:681f with SMTP id jj14-20020a170903048e00b001a6cb66681fmr4592127plb.46.1683232907690; Thu, 04 May 2023 13:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683232907; cv=none; d=google.com; s=arc-20160816; b=hpSanF411rCOcbVGsjJQdmhYnSDE1s3XlSMo90WpEXqIG4/4QBuXxACeJVzRpckwI3 MlwrfY+4m2RmgGwEYxJbOjJh4wz88aMcn6zIHHOKmtSBwhku3iJ8RrgPTG1o4EbcBbD0 wed42zdWqRXzv0w3IUF9govpp0hk+u23V+hCRLrqAUIMqMOySl2rwSjIX2ZqSBSSrqZl Kh6FSS1XViX8sn3k7eG48hqqdTd0IcMeaB1r8apKljE5de7vpx/bFKF8CvPEGwnRGr/6 1REDdRPS0U7O/4YxvkHtARWZzoD3/wH7TMn/LZE2p9cRPG1FDmLKtpO4cbGeLZO99/N5 T10A== 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=XFbEcKjEgJv3LtDT74dBDeEmFhugrifR5vJkWRmgzQU=; b=p3O0T0rJZnrHlby7g4sj6spXfn3x9s9akW+m8R0h7/+6LKX/NPSzxYJKCIa08Ftaoy 76WhXJSGo++If4TbECP1m6yiJHN+SKZxWxwiEI3YcB2DKjmfar6Ggs6FLtVKty4X+OU9 Ep1MUNqzkTcsgeDqJAUjxU5GbgK8jy2xmklhcireTPSYeI7Ojfa4bziTgf0dTjW+h5yM m8gtJgZv6AReVZb4xcY7xHWWDGB5eVjRxvG/Hh2Y7Svbgv0s1OffD77cyJWKo1agF9ol w4rzHd2hUYSh3TqnkBdsu3rgOB8i0zURQlgLSkupqXeKWt2lJO1XMLeym7G3pNhXhwHo 1G4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T8t5m3rV; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bi12-20020a170902bf0c00b001a2445dd0fasi33913732plb.381.2023.05.04.13.41.34; Thu, 04 May 2023 13:41:47 -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=@redhat.com header.s=mimecast20190719 header.b=T8t5m3rV; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229717AbjEDTYJ (ORCPT + 99 others); Thu, 4 May 2023 15:24:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbjEDTYH (ORCPT ); Thu, 4 May 2023 15:24:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6B607AB4 for ; Thu, 4 May 2023 12:23:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683228199; h=from:from:reply-to:subject:subject: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=XFbEcKjEgJv3LtDT74dBDeEmFhugrifR5vJkWRmgzQU=; b=T8t5m3rVub9Ky7u4zHEmiMbL3zLAgAbQBM4TwdrBAsFko1uqDegGs3+CqqjBnECpTK1bBh qcSS6IYlAq3fPh/uQGJWV8SN9Cm+rzK0HdzP2xNlv4GwvBQsesfIO1q8FxQO8HiRiq/o6R hCCMMPMdx4sIV/TtDZ1MN4/0ygYw7Zk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-297-qpEGbL5kMAaJrY1g8mktYw-1; Thu, 04 May 2023 15:23:17 -0400 X-MC-Unique: qpEGbL5kMAaJrY1g8mktYw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 763C110AFA77; Thu, 4 May 2023 19:23:06 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.225.24]) by smtp.corp.redhat.com (Postfix) with SMTP id 7CC171121339; Thu, 4 May 2023 19:22:59 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 4 May 2023 21:22:54 +0200 (CEST) Date: Thu, 4 May 2023 21:22:46 +0200 From: Oleg Nesterov To: Wander Lairson Costa Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Will Deacon , Waiman Long , Boqun Feng , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , "Eric W. Biederman" , Brian Cain , Kefeng Wang , Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , Christian Brauner , Andrei Vagin , Shakeel Butt , open list , "open list:PERFORMANCE EVENTS SUBSYSTEM" , Hu Chunyu , Paul McKenney , Thomas Gleixner Subject: Re: [PATCH v7 2/3] sched/task: Add the put_task_struct_atomic_safe() function Message-ID: <20230504192246.GA4164@redhat.com> References: <20230425114307.36889-1-wander@redhat.com> <20230425114307.36889-3-wander@redhat.com> <20230504084229.GI1734100@hirez.programming.kicks-ass.net> <20230504122945.GA28757@redhat.com> <20230504143303.GA1744142@hirez.programming.kicks-ass.net> <20230504152306.GA1135@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 05/04, Wander Lairson Costa wrote: > > On Thu, May 4, 2023 at 12:23 PM Oleg Nesterov wrote: > > > > Yes, but as Sebastian explained CONFIG_PROVE_RAW_LOCK_NESTING won't like it. > > > > https://lore.kernel.org/all/Y+zFNrCjBn53%2F+Q2@linutronix.de/ > > > > I think that was my confusion in that thread. My understanding is that > CONFIG_PROVE_RAW_LOCK_NESTING will check lock ordering but not > context. Sorry, I don't understand... perhaps I missed something. But iiuc the problem is simple. So, this code raw_spin_lock(one); spin_lock(two); is obviously wrong if CONFIG_PREEMPT_RT. Without PREEMPT_RT this code is fine because raw_spinlock_t and spinlock_t are the same thing. Except they have different lockdep annotations if CONFIG_PROVE_RAW_LOCK_NESTING is true, LD_WAIT_SPIN and LD_WAIT_CONFIG. So if CONFIG_PROVE_RAW_LOCK_NESTING is set, lockdep will complain even on the !PREEMPT_RT kernel, iow it checks the nesting as if the code runs on with PREEMPT_RT. Cough... not sure my explanation can help ;) It looks very confusing when I read it. Oleg.