Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1335354rwb; Thu, 10 Nov 2022 14:48:44 -0800 (PST) X-Google-Smtp-Source: AMsMyM4wz0HMHcGtJggUwPQpR//bDp5E9P6v1D1rkueb4TcmPdliXtXkZoaCOFF6LOSzFeNt0HPX X-Received: by 2002:a17:907:d082:b0:7ad:f8e2:ff0a with SMTP id vc2-20020a170907d08200b007adf8e2ff0amr3992856ejc.275.1668120524385; Thu, 10 Nov 2022 14:48:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668120524; cv=none; d=google.com; s=arc-20160816; b=Kmk+zp1LR5MLMN2dUNiicLVPAZxrCLhwe+Ax0npJxjSxEYKy6LrKUm0zaui1+9XSxh NftPI+offlnr2IS+qNVZIlGGg8R3gl/00X3QoCpND+PQnlXAcpuIotm5szkZk/20EKpv TJPinWaCyk20sumhDZujU0JOg223zPHXGmAleRAPN+DxgJCYQYws421k6RH5GyugFWmS 3GuaUW2Lz69aGcGBfOiHECMmKMRoCLHN1xfDS7ZaU8ZNlv89kcvS6qTES3C+GwkVG0f4 KTlf+ayJ4R4ikEnFqxcjbW2/GaUVeeJzbDSaC0MhXYOCnpDHBilpRdLTy8PJ/erITSqm /E7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=W2EsEvJhlAZZQPSn3pNUyWB9e4WUrObOqKYk/7OmMuc=; b=bIqrhLUCBfUtQhp5MoLfzTe4epXfaqy4MLX1JtLW9w+hOnF/iLrGgJ6qMNyUZTfqKo 6pz6akXTKphi7bxgnJQ+oXn3qGXkvjpc7SEF4tnJU3uzutFPe3YjZ6MebVjPQmcr7JEu x+2MkTJy9x1AGAsFWG2MnbyQMIoTeQOjGP/ri/A3+LzRcHU5JQljTYb2k6EE0sl0kkEn eg2wd5J/BXs/nunL8tPthI9VIrnoSjfv+uAyziq7+bEivs09zu2XQAEQ4WTIvDLalCJB ikVvy0XkF9owAsGzYW89zze7iPXQLVw2CIya2VjjY4nUUcoP4O9aNk0gLfgyVi31r0DF LWig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=L0SMSt4q; dkim=neutral (no key) header.i=@linutronix.de header.b=cR6YDafD; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g6-20020a056402320600b00461701dab0csi732038eda.526.2022.11.10.14.48.22; Thu, 10 Nov 2022 14:48:44 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=L0SMSt4q; dkim=neutral (no key) header.i=@linutronix.de header.b=cR6YDafD; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231702AbiKJWhc (ORCPT + 93 others); Thu, 10 Nov 2022 17:37:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbiKJWhb (ORCPT ); Thu, 10 Nov 2022 17:37:31 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D15AB87B; Thu, 10 Nov 2022 14:37:30 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668119847; 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: in-reply-to:in-reply-to:references:references; bh=W2EsEvJhlAZZQPSn3pNUyWB9e4WUrObOqKYk/7OmMuc=; b=L0SMSt4q7jIhlzsoMg/xRFF+mS5mvQInBQrHnxfqgLft7IMQvdhT0dYdY7yePwM9Fv+G4C Jo7De6PJWh1b57zTUEvA/r0LIsHe+Ele14Jqom9ODT7aG/xmLKVcR6kEkUGj65//fEAUEn LU694e9AwzJ05OHi702f+znr9M7EsMbvzWj5bFjKIV8TV6mgQ7YRykr3ApF1NcKh2+ZLZR /Mme5fix7hlnZP8MTGD/Hc3n5tv9+dRIWuECLKRCUQYsHHRPQUysQApkyADc/Utz/ZXHBL oNUuV/8UY2GMEtRqZNNwfY5AAaqIXXvG0DR5T0VeSz3HrDewe4dlY+d0MJrS1g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668119847; 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: in-reply-to:in-reply-to:references:references; bh=W2EsEvJhlAZZQPSn3pNUyWB9e4WUrObOqKYk/7OmMuc=; b=cR6YDafDK7z9RudGpmOn+Lr/YsZxGTyyB4YVYSNXVaaNOgu+QC1ESLllubJrkI6jh2NdsI K/UxS8kYMw8BavCA== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Helge Deller , Greg Kroah-Hartman , Javier Martinez Canillas , Thomas Zimmermann , Juergen Gross , Boris Ostrovsky , Tom Rix , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH printk v3 33/40] printk, xen: fbfront: create/use safe function for forcing preferred In-Reply-To: References: <20221107141638.3790965-1-john.ogness@linutronix.de> <20221107141638.3790965-34-john.ogness@linutronix.de> <877d026blr.fsf@jogness.linutronix.de> Date: Thu, 10 Nov 2022 23:43:26 +0106 Message-ID: <87mt8ywi55.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,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 2022-11-10, Petr Mladek wrote: >>>> + /* Only the new head can have CON_CONSDEV set. */ >>>> + WRITE_ONCE(cur_pref_con->flags, cur_pref_con->flags & ~CON_CONSDEV); >>> >>> As mentioned in the reply for 7th patch, I would prefer to hide this >>> WRITE_ONCE into a wrapper, e.g. console_set_flag(). It might also >>> check that the console_list_lock is taken... >> >> Agreed. For v4 it will become: >> >> console_srcu_write_flags(cur_pref_con, cur_pref_con->flags & ~CON_CONSDEV); > > I am happy that your are going to introduce an API for this. > > Just to be sure. The _srcu_ in the name means that the write > will use WRITE_ONCE() so that it can be read safely in SRCU > context using READ_ONCE(). Do I get it correctly, please? Yes. > I expect that the counter part will be console_srcu_read_flags(). > I like the name. It is better than _unsafe_ that I proposed earlier. Since the only flag that is ever checked in this way is CON_ENABLED, I was planning on calling it console_srcu_is_enabled(). But I suppose I could have it be: (console_srcu_read_flags() & CON_ENABLED). That would keep it more abstract in case anyone should want to read other flag bits under SRCU. There are only 4 call sites that need this, so I suppose we don't need a special _is_enabled() variant. Thanks for the suggestion! John