Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp17421ima; Thu, 25 Oct 2018 14:35:22 -0700 (PDT) X-Google-Smtp-Source: AJdET5c4zof3uJaVlc6V9huCupkMtNOF+ZheE4VNZn4o5ypM9yyHl21zpNwj/ViaOLGkJ1W5KXYA X-Received: by 2002:a63:b15:: with SMTP id 21-v6mr811262pgl.130.1540503322816; Thu, 25 Oct 2018 14:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540503322; cv=none; d=google.com; s=arc-20160816; b=z9b1gBGJ9pHBy/ixlnBIWXzrIcXox0IxZhpqNhfhkMjzg8RXIgEAhe4kdGgO4j3hPH zI8bTULWiIW6YymsTzNlC2vn5C5StOGz3wikX63/8aY3F2WHGboHr3ZfZWrWQaKIRMwL CpFBF3Wkzf3y/Ma617B4bXueNb1MoSrJNy1gi0d13fVTF9XQ6drZLCgk6BVuPTlTR+Vt Z1w1IJHr/iCtBz2YQici7drFjOJaHeK/X/Xef89+NG0HbctFFagAPquy/xEfCcR7QFnU CHIJozDvZWoxCbCR9vooanqheT9oI02fVqpn42beZy/OJ35mpqLmJUAX8rOi05nAYe58 6mzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pXeXT1bGIRgoB6EEvvy7stnLwiEBI6SOgVykDqQ2/LM=; b=bGQEbQWLvLJpHMCEQsuHyFXFQbmPhaNHALVHSGkFEqXCRAt9puVFekFAdIlpBhRWd4 AumzdauKwv9lTKcef1MYNa4LYR7m0YfEJMDm2cKp+hp0yK8bsYgccM64W+atB/5/YzPv b8iIlUzPhHwcIwW80pH8T7WTF+njoeG8Nk0OM60bjzYOxsLuCE0YcWcnqRr3zFNBdZ43 KQVCyGqrrSaLP6RHGyO6HBozk1MzVEllkFnpFybZV4mM/N/tuTwajAe96/RBHmugHycy 7PYoyxeHsStsyI5LEhsgEt2daHFMDnC4/GIR+4qG3wyA4RiT2E0YDLQgjKm3bgkwfKNa BzCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YsinEIB+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p6-v6si8995540pgp.243.2018.10.25.14.35.02; Thu, 25 Oct 2018 14:35:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YsinEIB+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726330AbeJZGGK (ORCPT + 99 others); Fri, 26 Oct 2018 02:06:10 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33427 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725941AbeJZGGK (ORCPT ); Fri, 26 Oct 2018 02:06:10 -0400 Received: by mail-wm1-f65.google.com with SMTP id y140-v6so2808570wmd.0; Thu, 25 Oct 2018 14:31:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pXeXT1bGIRgoB6EEvvy7stnLwiEBI6SOgVykDqQ2/LM=; b=YsinEIB+/2Jw41EaI7oHae+Ljat7nrENo0+1KhQE4zDVOefM2xLdlojMJrJ8PDzIZ3 30LDSaknbN/zEDgYqmau40HWX+KOvvV3mUB4SF359LtLc03xtIlRGYiaYLWpZFScfWle BV0DlM058hiSS81HO7oXK/2nIst9I57akevUcXu+A/tiusDG+EIjZyEAjAN9mmxVE4P9 z8mIyNJiRT1iL3Xt67Qs3UTkWcMVxfQkPI1ZvbO2jClz4Yh1LqzXNzNtvZiR84ELU4n7 mEZUDXzlw/xt8nKPNL6Xq3ni7UIYNlTEAppXVVv+xWxTIw1cWWUuB6CDlGlvkDMv0iDv CpsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pXeXT1bGIRgoB6EEvvy7stnLwiEBI6SOgVykDqQ2/LM=; b=HlEKvs5p7cqGiFE0xSn4AdfrdxlIHSd4AC6HVgNF1IAm7YuHLbI6po1v7n9KRpkdZR ihfOeWgloZLpeHgkYpKNwYVe+YAVaS1jgSIkISQa6fTSv2WBGF2Qs7qnDdx0DOI+xPYa EFK4Lko8qPRwMgm9euO/xXp4L+RgnsGhEPJCF3NPKQrrQq/XdU8g89+XKBlLV6X1cPK2 MvLk2x373CMK+SgbnrkLYx5NETV3SdIVBguezHVkrnCW1pZ7+b3TPhV8/XrPGUMVzJmh xpk5T9oJqF6Rnyz56baCz3h8xnsQucmiZD0XVY1Q+Ku2fE8dUuKCEh9g6eN1m/tDfkPT 93gg== X-Gm-Message-State: AGRZ1gKvHh3MXfq0q1f5xboIZ/Ij+kWvpSS+p1az6cLhdO6RuVpRExZV 8c+ZMmn210OEVTpt53eBxkA= X-Received: by 2002:a1c:85d0:: with SMTP id h199-v6mr3268892wmd.127.1540503106989; Thu, 25 Oct 2018 14:31:46 -0700 (PDT) Received: from flashbox ([2a01:4f8:10b:24a5::2]) by smtp.gmail.com with ESMTPSA id l140-v6sm4400263wmb.24.2018.10.25.14.31.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Oct 2018 14:31:46 -0700 (PDT) Date: Thu, 25 Oct 2018 14:31:44 -0700 From: Nathan Chancellor To: Bart Van Assche Cc: Nick Desaulniers , ooo@electrozaur.com, "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, LKML Subject: Re: [PATCH] libosd: Remove ignored __weak attribute Message-ID: <20181025213144.GB24709@flashbox> References: <20180930205448.26205-1-natechancellor@gmail.com> <10b12992-3570-4646-374b-82cbd7276839@acm.org> <1538503063.193396.6.camel@acm.org> <1538521591.193396.8.camel@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1538521591.193396.8.camel@acm.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 02, 2018 at 04:06:31PM -0700, Bart Van Assche wrote: > On Tue, 2018-10-02 at 15:33 -0700, Nick Desaulniers wrote: > > On Tue, Oct 2, 2018 at 10:57 AM Bart Van Assche wrote: > > > Explicitly initialized global and static variables end up in the .data > > > section and need space in that section. > > > > Unless the initial value is zero. > > https://godbolt.org/z/curRoO > > > > So you don't wind up with an increase in binary size simply by having > > global variables initialized to zero, right? Instead the kernel knows > > to create a zero'd out mapping for bss. You don't need a run of zeros > > in the binary. > > > > So I disagree when you said earlier "zero initializers should be left > > out to minimize the size of object files." I assert they don't affect > > the size of the binary. > > > > If you had many global variables all initialized to zero, why would > > you encode that many zeros in a binary, when you can just set a size > > on the bss section and have the kernel create the appropriate sized > > and zero'd mapping? > > > > > That is not the case if the > > > initializer is left out and these variables end up in the .bss section. > > > > From my above link, gcc will put globals without initializers into "common." > > No matter what particular compiler versions do with explicit initialization > to zero, the preferred kernel coding style is to leave out such explicit > initialization. > > Bart. Hi Bart, I'm sorry if I didn't follow the conclusion of this conversation properly but this is the below diff you were initially looking for, correct? If so, Boaz and Nick, do you have any objections if this is v2? I'd like to get this patch accepted so the warning can be fixed for everyone. Thanks, Nathan ================================================================================ diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index e19fa883376f..4250f739beb3 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c @@ -58,6 +58,8 @@ enum { OSD_REQ_RETRIES = 1 }; +static const struct osd_obj_id osd_root_object; + MODULE_AUTHOR("Boaz Harrosh "); MODULE_DESCRIPTION("open-osd initiator library libosd.ko"); MODULE_LICENSE("GPL"); diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c index eaf36ccf58db..770c758baaa9 100644 --- a/drivers/scsi/osd/osd_uld.c +++ b/drivers/scsi/osd/osd_uld.c @@ -73,6 +73,7 @@ static const char osd_name[] = "osd"; static const char *osd_version_string = "open-osd 0.2.1"; +static const struct osd_obj_id osd_root_object; MODULE_AUTHOR("Boaz Harrosh "); MODULE_DESCRIPTION("open-osd Upper-Layer-Driver osd.ko"); diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h index 48e8a165e136..eb31357ec8b3 100644 --- a/include/scsi/osd_types.h +++ b/include/scsi/osd_types.h @@ -28,8 +28,6 @@ struct osd_obj_id { osd_id id; }; -static const struct __weak osd_obj_id osd_root_object = {0, 0}; - struct osd_attr { u32 attr_page; u32 attr_id;