Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp577200pxb; Tue, 15 Feb 2022 22:39:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyx6fuQIofj3pTxg6Q0oBiSrgsyVMza0a/HaL/+lSgGz/TYqW2u/HEAEeRM+d4caxmqCCS X-Received: by 2002:a17:90a:6be5:b0:1b8:8d88:2bd3 with SMTP id w92-20020a17090a6be500b001b88d882bd3mr132193pjj.29.1644993551390; Tue, 15 Feb 2022 22:39:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644993551; cv=none; d=google.com; s=arc-20160816; b=n4bOcdIFQof63/VLS/kyvuT8t7N27EAfUHQugJNZc4MNVX/niBz+lFSzKEK9ZLHX+X Qt8qz+v3zZerUcl+EVSX985lN9PXirD5TQ7RhIFbKC+MNR/vEEHusCrq4EZ+2VxYYqcA Ca7revirgg3h5Ma6iXgU/dDWcbdqqmsGrVdyvADjRWeR3BqCvuZUplvbSLs8JPByV4Rq yjsSe9+HlNBFARqn845ttL77Qk0Kr5Im0TY2gzaWFKR+WZBRTgRfdwa2zN4KKMyD78kh Vf32VcHd2w0WREpbyqVAHGocqppWv0gqLin1zBRfUA9AcjebdC5eoggHOsHkaK7FfEie IcRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HEtcDpWLQ83O3kPD573D0V/wU8u6oJoMHsArXW8ggTY=; b=VIkbJwqNFRcpcjidaHwrlPvq5Ie/42z0p1ERsv5JNTZJzPFzyHBuTVtDa8x95gIhTT Dl66uAsd5u6nPxSe0bNdovehFWtIATfGqSp2MKkndZwKw+NNSkYLNrb0e/OCZCrKpifs BVij7mm8+GcZZdi7jdA23WRHMbh8y/e7INiHVT4LVdJswukF5wR+ycdMYzxikQXCSuA7 78mgXnZ+jqyoGQmT/BIa7Lto3HaEXyyAQjSKc/YURsXbK9HHxnZFktOsz+tLDEnqJrz/ 0d4YGUwi0Bgo+3gUQn8dwStKO9+aVSli96Xycun9Yc4JX0DPx5xRDaxvKCpGYQutFNKe K7mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ZMyUBd7Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id my10si19726690pjb.134.2022.02.15.22.39.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 22:39:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ZMyUBd7Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DDA701B6528; Tue, 15 Feb 2022 22:29:39 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242193AbiBORIh (ORCPT + 99 others); Tue, 15 Feb 2022 12:08:37 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242199AbiBORIe (ORCPT ); Tue, 15 Feb 2022 12:08:34 -0500 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 930CC11ACCE; Tue, 15 Feb 2022 09:08:23 -0800 (PST) Received: from zn.tnic (dslb-088-067-221-104.088.067.pools.vodafone-ip.de [88.67.221.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 0275D1EC0411; Tue, 15 Feb 2022 18:08:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1644944898; 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:in-reply-to:in-reply-to: references:references; bh=HEtcDpWLQ83O3kPD573D0V/wU8u6oJoMHsArXW8ggTY=; b=ZMyUBd7Z8t9L2at60sSRbMjSjlXH1ydK5QvTBj+d8zZVPIueCVb2QkuTDl/Wm2zp9SZ1x6 vO9BEQtOOErGCmuptcuZKzralCFnDyBf9kucvpMNbCretI3/Yz4qAP6du7199mQB2dTX+K oorw53TY5bZCC6eQo7JBNHNv3Dp+1dA= Date: Tue, 15 Feb 2022 18:08:20 +0100 From: Borislav Petkov To: Eliav Farber Cc: mchehab@kernel.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, ronenk@amazon.com, talel@amazon.com, hhhawa@amazon.com, jonnyc@amazon.com, hanochu@amazon.com Subject: Re: [PATCH 4/4] EDAC: Refactor edac_align_ptr() flow Message-ID: References: <20220113100622.12783-1-farbere@amazon.com> <20220113100622.12783-5-farbere@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220113100622.12783-5-farbere@amazon.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Thu, Jan 13, 2022 at 10:06:22AM +0000, Eliav Farber wrote: > Modify flow to be more clear: > - Calculate required alignment based on size. > - Check if *p is aligned and fix if not. > - Set return ptr to to be *p. > - Increase *p by new size for the next call. Right, as I said earlier, piling more on this crap design is not the right thing to do. Looking at the call sites, what I think you should do instead is simply compute the whole allocation size by making sure the alignment of those substruct element pointers we're assigning to, is 8 or so, for simplicity. You can store the offsets in those helper variables, like it is done now. Then do the allocation and add the offsets to the pointer kzalloc has returned. And then get rid of that edac_align_ptr() crap. This thing is silly beyond repair and passing in that **p offset back'n'forth is making stuff more complicated than it is - one can simply do that computation before calling kzalloc and doesn't need a "helper" which ain't helping. I'd say. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette