From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85335363C64 for ; Tue, 31 Mar 2026 02:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774922837; cv=none; b=QtL6uZHKJPYo4qwNanqxMWoA7At4CYInUFVPLy4hTPtdzVdXnSeMcgFNB3jmStbYsLJ+JgbvmmtjKnEk3Y0kJl8MYxtEqQWB4gHQLPHSNQkTtUAcZugpfvnkh4Rf6ctL9GNQt6CO3M+jMSvCO/DoEFyGfLaaudzO5tRPV3vUgnk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774922837; c=relaxed/simple; bh=NzmQHwb3DbgXOf7m7zELxwBshVRaHQ8Qfu7nuXCO/24=; h=From:To:Cc:Subject:In-Reply-To:Date:Message-ID:References; b=BWIG0hl8X7MXHI9u3zzeFYOCCe4bbswUK38sGph6ip/xIZIYM9mada1B5kIQN+/tKpp+rJJvnpQvELkdEJH3GcAvA3nZlV+IiKDbh8glMXJimdMSVsUdac/GAdi1BhpstvoJRASLvX21aQwWDPoXRDet2cnvSiQoc4h6mdtp2Zs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gKgGC5x0; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gKgGC5x0" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2a7a9b8ed69so50339785ad.2 for ; Mon, 30 Mar 2026 19:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774922836; x=1775527636; darn=vger.kernel.org; h=references:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=Q7OinmlPHVygQxvfDVFJvK0ZY1pvhoxnbxOEnZnjSoM=; b=gKgGC5x0CegKFVleHEoHftXYrluyoNtECxQz8JJ1cbRIHU0SFA6caBBseHdjzuDpf0 W+7m9OHFfHm7j7l/V2oeQz4muDgNy9oKWxSYNCx8o9m2X/pNsbzQPqihZtEaWPXLvZdi i2qgNelQieYYqFvQWyq4fqBovHH35piZi7LfPYY01f3fDf3qJQ0eOaidxeXmAi6muZo3 EYs5z4tniecsz1rmwfq50rN+/kac9BP3uhfbsgH81rMAigoQLpLmGO4jayMkD6TK8eNN 5VizO4lFJ488kiTJ8zH66UI7f2drwA+FTDJ7l4DnBFv/d33g761BHuyXaKt2yCVWRuO/ 2FLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774922836; x=1775527636; h=references:message-id:date:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Q7OinmlPHVygQxvfDVFJvK0ZY1pvhoxnbxOEnZnjSoM=; b=Jp2BI0REO1V0jDGRHFr5l5VqXf/9zej4lIyELo5gIIrhiI1NcwGtAfXgLrLUQW8/o+ VTSpryFo2GLW4D6no5qA8/JmqixtmVw8iVCYhgU/xNBiL4cMzPl0xNPXxBHEUcrRYVWz T5dpPLIWapXdcUFFuLYASx5m20zylKmglRHTs/14QEx8RpP0Qs0T6sBY4JguhHiXcAaM iPn2QOotmjJ0aHcGAvgJfeDgYZdSGDju+3HCsLV7DZQMdXSHf+uL8+5Q2d5JuKvNni1q Qb3um+bKI7SS/rNCxFFMVgcrLuO4QGFterQoK3SeG/vPkbv8Pes4WfZ0JpNaCQirigf9 7qJQ== X-Forwarded-Encrypted: i=1; AJvYcCWMgyUY55kYYoe1L863cnS7mC/YmbrFIweC7xpPeS8Wz671a2vSFWfckGWIGx3uXQ+4Znhe4expTm5Dp4Q=@vger.kernel.org X-Gm-Message-State: AOJu0YwIJqUUY+KltDBNv3DbHQuB8lMEcsDWD0U9viek8hKAO5Wpck2M lAG0NHfK9x1dWtqDqthaSu7LhAOuJOEcvxGdZkiQRgDEOmz6Jh2gTMpYa8s/cjBU X-Gm-Gg: ATEYQzyeFMKpEfHZE2b2TbC5TYMt5710qneyVgdvuMBoGmhAHmMt5BRO4Pt4B89Ubaw 4ziH0DfK40pDoZVHZvXE13bc8YaT2cR3zaY3aDfsDNbVSaU0I3OzyFniD3ea4KnZ0QTb/jI0+SV jI/92C1DrX+OMJAwrAHttVCpya7NtGi3wd5ot19y/+KXJUwEbnESoydom/+BeDOf2IYC1/S77D5 AxozV2DWodCD+tOnDg/G0CotvlKYaai4sWPXxVJ7cdV/0wGrNfCsVWF/t8RKAhwDqe0YnSz5aWD wT8dMa6Tj+fnB1IaK+oTj65xRPIaCbHMwAy3kpPYOtGuIIYmfA6j8ueR+TSM9gwYuOwAotQlM4F uHktpGZVtKDslBDQPG0zoEdCsYP2SC7k6SiC2pS3FA+Wxn529WzrrNBvPEcX5Hp8cZO3P1WP+XO MnuDzVM0TOerIt/Z2b9DS1sA== X-Received: by 2002:a17:902:e809:b0:2ae:4150:3118 with SMTP id d9443c01a7336-2b0cdc3b9d9mr146889945ad.12.1774922835833; Mon, 30 Mar 2026 19:07:15 -0700 (PDT) Received: from pve-server ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b24264256asm93998405ad.13.2026.03.30.19.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2026 19:07:15 -0700 (PDT) From: Ritesh Harjani (IBM) To: Venkat Rao Bagalkote , linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com, arnd@arndb.de, Christophe Leroy , Venkat Rao Bagalkote Subject: Re: [PATCH v4] char/nvram: Remove redundant nvram_mutex In-Reply-To: <20260330103530.6873-1-venkat88@linux.ibm.com> Date: Tue, 31 Mar 2026 07:19:54 +0530 Message-ID: References: <20260330103530.6873-1-venkat88@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Venkat Rao Bagalkote writes: > The global nvram_mutex in drivers/char/nvram.c is redundant and unused, > and this triggers compiler warnings on some configurations. > > All platform-specific nvram operations already provide their own internal > synchronization, meaning the wrapper-level mutex does not provide any > additional safety. > > Remove the nvram_mutex definition along with all remaining lock/unlock > users across PPC32, x86, and m68k code paths, and rely entirely on the > per-architecture nvram implementations for locking. > > Suggested-by: Arnd Bergmann > Signed-off-by: Venkat Rao Bagalkote > --- > v4: > - Remove all remaining nvram_mutex call sites, completing the mutex removal > Let me cut paste the review from Sashiko here.. Does this removal expose the underlying raw spinlock to concurrent userspace contention? Looking at ppc_md.nvram_sync() implementations like core99_nvram_sync() on PowerMac, the code acquires a raw spinlock (nv_lock) and performs hardware flash memory operations with polling loops and udelay() calls that can take hundreds of milliseconds to complete. Because IOC_NVRAM_SYNC does not require CAP_SYS_ADMIN, any user with access to the device can call this ioctl. Previously, nvram_mutex provided a sleepable barrier for concurrent IOC_NVRAM_SYNC callers. Without it, won't secondary callers spin on the raw spinlock with interrupts disabled for the entire duration of the first caller's slow flash I/O? Could this prolonged spinning with IRQs disabled completely freeze the waiting CPUs and trigger NMI watchdog timeouts or system lockups? First of all the above problem is only being talked about PowerMAC and not for x86 / m68k. In there I think, we just read/write few bytes under the spinlock. On PowerMac too, I don't think the above problem gives a reason, to keep a redundant locking at a generic wrapper layer which can affects other platforms/archs. And the comment in PowerMac code above nv_lock says: // XXX Turn that into a sem static DEFINE_RAW_SPINLOCK(nv_lock); So, it looks like Sashiko review comment can be ignored, and the patch looks right to me, which kills the redundant mutex lock from here. So as for this patch please feel free to add... Reviewed-by: Ritesh Harjani (IBM) ... But I would also let Chrisptophe comment from ppc32 / PowerMac perspective. -ritesh