From owner-freebsd-current@FreeBSD.ORG Fri Dec 23 02:52:00 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC247106564A; Fri, 23 Dec 2011 02:52:00 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4B1908FC18; Fri, 23 Dec 2011 02:52:00 +0000 (UTC) Received: by iadj38 with SMTP id j38so16040157iad.13 for ; Thu, 22 Dec 2011 18:51:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=references:in-reply-to:mime-version:content-transfer-encoding :content-type:message-id:cc:x-mailer:from:subject:date:to; bh=xv00cOMZuV5ayo3qUJZtigfqcLxNJ1G/u23kMBK+toI=; b=VCiz2T+swX5ulU6IbJ+f2iB98dIweo5Uq8fQ3Haw1ISI1coRBt4QMn95BsSAU3Zw+h ovxKw6lT0iySGA175us/juawewohDcOdvf1RK++8qyglTpCkrW6L/lmAMWZo8RdN7gkP 3BHukc1I1FZJ0p0rS0nAG9dkW13M0pN/ENOAE= Received: by 10.42.161.132 with SMTP id t4mr13327117icx.16.1324608719903; Thu, 22 Dec 2011 18:51:59 -0800 (PST) Received: from [10.75.41.133] (mobile-166-205-136-165.mycingular.net. [166.205.136.165]) by mx.google.com with ESMTPS id gh9sm38954438igb.3.2011.12.22.18.51.54 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Dec 2011 18:51:59 -0800 (PST) References: <4EF34E52.2040905@FreeBSD.org> <20111222192549.GA19008@freebsd.org> <20111223005932.GA65042@freebsd.org> In-Reply-To: <20111223005932.GA65042@freebsd.org> Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: <25FBBF23-CDFA-429E-966D-A90409D8F2BD@gmail.com> X-Mailer: iPhone Mail (9A405) From: Garrett Cooper Date: Thu, 22 Dec 2011 18:51:47 -0800 To: Alexander Best Cc: "freebsd-current@freebsd.org" , Dimitry Andric , Benjamin Kaduk Subject: Re: [patch] Cleaning up amd64 kernel optimization options X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2011 02:52:00 -0000 On Dec 22, 2011, at 4:59 PM, Alexander Best wrote: > On Thu Dec 22 11, Benjamin Kaduk wrote: >> On Thu, 22 Dec 2011, Alexander Best wrote: >>=20 >>> On Thu Dec 22 11, Dimitry Andric wrote: >>>> Hi, >>>>=20 >>>> I would like to ask some feedback on the attached patch, which cleans u= p >>>> the kernel optimization options for amd64. This was touched upon >>>> earlier by Alexander Best in freebsd-toolchain, here: >>>=20 >>> i've been using such settings for a few months now and haven't noticed a= ny >>> problems. >>>=20 >>> however bruce evans raised a good point (in a private mail). when you=20= >>> compile a >>> kernel without debugging enabled, -O2 is the default. if you experience=20= >>> issues, >>> and enable debugging, -O0 now becomes the default. in case the problems=20= >>> with >>> the kernel were caused by the -O2 option and aren't present with the -O0= >>> option, the newly built kernel with debugging enabled will not help you=20= >>> fix the >>> problems. in that case you would need to set -O2 explicitly in CFLAGS. h= is >>> exact words were: >>>=20 >>> " >>> I don't like -O2 for anything. However, if it is only a default, it is >>> not a problem provided it can be canceled easily. And for debugging, yo= u >>> want the default to be the same as without debugging, so that (by defaul= t) >>> you debug the same code that caused the problem. >>> " >>>=20 >>> however i don't think this is fixable. using -O0 for debuggable and >>> non-debuggable kernels will cause too much of a slowdown. >>>=20 >>> having -O2 as the default flag for non-debuggable kernels and -O2 -g for= >>> debuggable kernels might cause situations, where debugging isn't possibl= e, >>> where with -O0 -g it would have been. >>>=20 >>> so i guess although bruces concerns are valid, they are impossible to=20= >>> solve. >>=20 >> Where does -O0 come in? I only see talk of -O (i.e. -O1) versus -O2. >=20 > sorry. of course i meant -O: >=20 > .if defined(DEBUG) > _MINUS_O=3D -O > CTFFLAGS+=3D -g > .else > [..] Back in the 7.x days, I ran into some code that wasn't easily to debug becau= se the compiler optimized things out with -O2 by inlining and otherwise shif= ting around code, so setting breakpoints in gdb became difficult. So from th= at point on I've gotten into the habit of doing -O explicitly in make.conf i= f DEBUG_FLAGS was specified. Just a thought.. -Garrett=