Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1493392rdb; Wed, 20 Sep 2023 10:34:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQRZ2YYim0L15TxB9ALKugUH/U4FJBnemUmxm7ctj6mvSP6IxNOHRJK45nFz3PGcbdBxv3 X-Received: by 2002:a05:6a21:6d92:b0:13f:65ca:52a2 with SMTP id wl18-20020a056a216d9200b0013f65ca52a2mr3439851pzb.5.1695231288867; Wed, 20 Sep 2023 10:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695231288; cv=none; d=google.com; s=arc-20160816; b=TuXHfX3WE/kI3YXtNE+bHaOI2M5rhk1Xwq8Xb87KU1nuBjb1O85lth04kxS89HTtPL eaG564EPGwTLqSGVaJEseQmILiFQwt/brlQQkay8WadM7MhLQqIuOEOGUrzq0NXiAY1H Umi155jx3fqBPoclLQUTgNvLZA6CV8aeUCv6snwitYYBO9m7ZU5g4scRY5dTYs6Srp7M KCPIGC5TXOjqhUiQXTD4iDaXurrMkASyEMCDVmz8DH1Uon2Jpnys1bVS0FtQLqG6KdLe 1FsGsKdo3g7jhsX6TAoMOHqKdq61uCVS2Op0A9jD7nriKOzTjhp6QtybYgt91uRzAGPS lKMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=22RUU3xjWYgOyPIarHY1PFIkXsagj8lBn1DZZtJSdXQ=; fh=gGmKNoxbq9ZsjlZrSJ0DvJC8YmoP5YrwG+wrkliu2WQ=; b=LeGX2KG4zhjfps9QQc14AyVu8F5F5kbvuxdmv9aEYOrxtPeRiUR20Bpgr3h9MFLHru NyP4+6L/MFJx+3StfrrfqWZV5KMRh77GcVDrL92+4GdheKALlzRleoQv4P/Fe31IPtLQ uSMEgtDrXJBWCdqXO6WKTiRlb1LjutQNL94utod2iCFPHed2DtpI7uh7Q8f3qeIeMLM/ xa28WOpo2q4A8+4TthwxasutETkJw1XJPYGLzJfWSIDWFPMLrMhjibdoDpLKdZo/L4Ex TqURqk5KbDonQIplxQbWFCTn2ZYWLuidwb5gUxbSiFSBAKsbmFB1qRZ1IfLC7DB3GOkD 1VRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AIrW76fA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id d18-20020a056a00199200b0068fcc67e73asi12565467pfl.18.2023.09.20.10.34.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 10:34:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AIrW76fA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 9839380DE626; Wed, 20 Sep 2023 06:28:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234982AbjITN2y (ORCPT + 99 others); Wed, 20 Sep 2023 09:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234748AbjITN2x (ORCPT ); Wed, 20 Sep 2023 09:28:53 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C21E091 for ; Wed, 20 Sep 2023 06:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695216527; x=1726752527; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=WxMtIZ61Id7gLIhG9mLeL9QFJJu0t4qZaBV1PGf0U0c=; b=AIrW76fAbc3Y9QKVXha4fa1TQ5O/8Ec3uoHJvN7MNxq6hq5vAtLAdodX uxDhLV/96rurSakeIOLqgRWBNfuvkBYGvOL9tJLua+qKW/nuR34pJxYaZ w760q5aSiYNrgwF+YGaymuqJWNH8brLe8N9F7g/WZyZw61OrQsMagHC43 /rNL2bkZV5UvUhcQKvna4C+lE0AvjkfjikO6S8iQvXOEq3c3MzCLcB+kl hQp28jQ6JTq8nFq5EkT/un5aBhYyO4Q7y0GHWn7SZzH8YMqWa2thoO/2z vb5WvRJEg2L8tJe3vDLq3vPQiqfQTuiI6q2WMvWavlvWjNuY/4fez7Fbj g==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="365276846" X-IronPort-AV: E=Sophos;i="6.03,162,1694761200"; d="scan'208";a="365276846" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 06:28:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="836843556" X-IronPort-AV: E=Sophos;i="6.03,162,1694761200"; d="scan'208";a="836843556" Received: from smile.fi.intel.com ([10.237.72.54]) by FMSMGA003.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 06:28:42 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC0) (envelope-from ) id 1qixFu-0000000DUbC-3Eh1; Wed, 20 Sep 2023 16:28:38 +0300 Date: Wed, 20 Sep 2023 16:28:38 +0300 From: Andy Shevchenko To: John Ogness Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Kees Cook , Luis Chamberlain , Andrew Morton , Peter Zijlstra , Josh Poimboeuf , Arnd Bergmann , "Guilherme G. Piccoli" Subject: Re: [PATCH printk v2 09/11] panic: Add atomic write enforcement to oops Message-ID: References: <20230919230856.661435-1-john.ogness@linutronix.de> <20230919230856.661435-10-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230919230856.661435-10-john.ogness@linutronix.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 20 Sep 2023 06:28:54 -0700 (PDT) On Wed, Sep 20, 2023 at 01:14:54AM +0206, John Ogness wrote: > Invoke the atomic write enforcement functions for oops to > ensure that the information gets out to the consoles. > > Since there is no single general function that calls both > oops_enter() and oops_exit(), the nesting feature of atomic > write sections is taken advantage of in order to guarantee > full coverage between the first oops_enter() and the last > oops_exit(). > > It is important to note that if there are any legacy consoles > registered, they will be attempting to directly print from the > printk-caller context, which may jeopardize the reliability of > the atomic consoles. Optimally there should be no legacy > consoles registered. ... > + if (atomic_read(&oops_cpu) == smp_processor_id()) { > + oops_nesting--; > + if (oops_nesting == 0) { > + atomic_set(&oops_cpu, -1); Between read and set the variable can change, can't it? If not, why this variable is atomic then? Or, why it's not a problem? If the latter is the case, perhaps a comment to explain this? > + /* Exit outmost atomic section. */ > + nbcon_atomic_exit(NBCON_PRIO_EMERGENCY, oops_prev_prio); > + } > + } > + put_cpu(); -- With Best Regards, Andy Shevchenko