From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.9 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382548; b=R7iWywcD3HPDmdR8Cc4swPCX+j5Kr+ByxD5Msi+QugKi3w4NuY7Vxxup6oGXLQSVxZY3 t076SfQoZwbEAwICDtRm+5rxulyXDkOFt3rbnue0ZFmvskg7X6pDfFDicXQ7znD++dRbZ MA6MPPOgHn6/q5mUzdUc7M4epT2i5CQRMnXlVYnQ5XDuMrOd8IqeiOihxczSDHKXNg7j+ +PHBTnk73h7ZNYerit8NMYk+NBceaFmAgwJF5UhD5TQ3oWBDgSI8eCiNVnE4p9EbICTdZ dCE2mtjxTsNogWOtmhaSpudW1yGgV0XrbNWGZyGBn0c+JBXaJBEQ3z+POYRqmwNEaxg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382548; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:Organization; bh=XVkHk0Sy/Lwe21UxF0iwaQVSsGcP8CyydjMQAJCinlo=; b=YeqQcOUraLnZq9oeyMLp0Kb5CXoaN+ior7kFMFaLVtwTCMU7h+as83oi+qppzSdfPbCh QKHsgXCHiWF77pfYdVsxlE4dlXg9bZl9HiCtwWx5o6vhx9maQi/8KPK6ost2bKyj9qQ/e Pj05YpCmTTPmD0Wbu9G11watU/+8/1LrVTk3T/tUMnDwtkOOnSgHBHuAF0CPLO2HR8MMO ARI45pCX/zEuvXpe4pl1E8Qo02jAcmgypCT1IQz7EezYGkLseUaX250cWk21jHQQ8ZHtR en1slsGZ+TblRD5o6yjsP+iiHToR9dXnilbC1xo7+SrBfIAJS2oQBTYRwOhtNErR3dg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b="ZrL+/WY+"; arc=none smtp.remote-ip=192.198.163.9 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4821606A33A for ; Fri, 4 Dec 2026 11:09:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A4821606A33A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ZrL+/WY+ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796382548; x=1827918548; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=XVkHk0Sy/Lwe21UxF0iwaQVSsGcP8CyydjMQAJCinlo=; b=ZrL+/WY+w6ORZhNcwpKlOHCshKn821Qv6qae8ihxe5A3JGxJCDRAJzAs CvnrptBNECdCoRuozEN4FjqUmyx3g1ucVoPFa9uAk65e80BN+gqhkq9Ue FVedsOgGonhuyJ3t3H2ZiPbqScubg5xrMhfOIdCfDWopdXuLOtrChJubP SZ+x2N0YUzcFMcfWJNBPx7S0tWOxhCoJ03o+bikL3ZwHGdJPshp1gz5f8 RnnTOTw6dkEtpLHoVHf57zgzkUmtr8Lk918azA2SlQ1f85WDLpUYyTnNu DtDjxIl2ZhwXIWmKO0brX7bCDQLkTaa6HqXHHKh3gPUkJsGN0wcb7Z9rm Q==; X-CSE-ConnectionGUID: f9rJlO/sTDufdg9i3l1QzQ== X-CSE-MsgGUID: SRv5GsHsT7yhwKgsCQOZ9A== X-IronPort-AV: E=McAfee;i="6800,10657,11985"; a="5224940" X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="5224940" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 03:09:07 -0800 X-CSE-ConnectionGUID: +021UuynSKiUQ2+7ajaL5A== X-CSE-MsgGUID: icEg4digTDeAZezEKme1/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="13917218" Received: from alekseim-mobl.ger.corp.intel.com (HELO localhost) ([10.245.245.10]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 03:09:04 -0800 Date: Fri, 4 Dec 2026 13:09:02 +0200 From: Andy Shevchenko To: Johan Hovold Cc: Eric Yun Lin Chiang , Greg Kroah-Hartman , "Rafael J . Wysocki" , Danilo Krummrich , Bartosz Golaszewski , driver-core@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] devres: update node debug info on in-place devm_krealloc() Message-ID: References: <20261203005704.3066960-1-ericyunlinchiang@gmail.com> <20261204003919.2280818-1-ericyunlinchiang@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo On Fri, Dec 04, 2026 at 10:28:46AM +0100, Johan Hovold wrote: > On Fri, Dec 04, 2026 at 11:13:28AM +0200, Andy Shevchenko wrote: > > On Fri, Dec 04, 2026 at 08:39:19AM +0800, Eric Yun Lin Chiang wrote: > > > On Thu, Dec 03, 2026 at 01:42:35PM +0200, Andy Shevchenko wrote: > > > > Do we really support shrinking for realloc() in kernel? > > > > I am under the impression that we don't, so in such a case info should > > > > not be updated. Please, check this and confirm. > > > > > > devm_krealloc() accepts a smaller size and returns the same pointer, > > > like krealloc() does, but no memory is given back. My changelog said > > > "shrunk", which made it sound otherwise. > > > > > > The patch only changes the size recorded in the node's debug info, so > > > on its own it only changes debug output, which is not much of a reason. > > > I wrote it as groundwork for letting KASAN check devres allocations > > > against the requested size rather than the rounded-up bucket, and I > > > should not have sent it without that context. Please consider this one > > > withdrawn. I will come back with the KASAN part as one RFC series, > > > together with a concrete case it catches. > > > > Doesn't matter. We should not lie to the users of the traces. If size was not > > shrunk, it is not changed based on what the caller of krealloc() asked for. > > If you want to add that to the trace, it should be an additional field or > > so, not the lie. OTOH you can introduce memory shrinking support to krealloc() > > but I have no idea what will be a perception of any of these approaches. > > I believe krealloc() can shrink, unlike devm_krealloc(). Do we have a test case for that? Because as I read the __do_krealloc() I see that *sometimes* (if some conditions happen)it might allocate a new buffer with a smaller size. kasan_krealloc() in all three cases returns the same address back without any reallocation done. Where am I wrong? -- With Best Regards, Andy Shevchenko