From owner-freebsd-current@FreeBSD.ORG Mon Feb 14 18:46: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 5A531106564A; Mon, 14 Feb 2011 18:46:00 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 96BCE8FC13; Mon, 14 Feb 2011 18:45:59 +0000 (UTC) Received: by wwf26 with SMTP id 26so5050040wwf.31 for ; Mon, 14 Feb 2011 10:45:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=64q6JSSQfSSpku3FmhgZY2eu0Fv6wznyTEJR/qi4fqM=; b=UfvCdFiDc0PNcOxh7ADvAkZnP7jAxyFowVqIPyp+SMNQ5d2uIgZJUvCxZKXQP1J9/q IDRgivTrReNnoTORUkK8XCFMps1C9Rso3eS7S3Mik1EqGUW67B7UvQibETa8rAAhhSfL qJfytzViXy0US/jCPq/9JNoxX8H1uNWNdxd98= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=BBH0GtMFAHup2p1seL/UnCylfT8FHXCfp3E8ho7yrmMCmuUrmaMwT2SmzuFj/F74f7 X2fL3meYj8/hcTwKHsqDKvYh6zVz2QdM3n56FcbRMEMltFz+KQ7zA0dUxJQYFRiEClor 4HtQF9HZKREXkVbUXOMmP2cBEKx9Z2TMmIcfc= MIME-Version: 1.0 Received: by 10.216.4.2 with SMTP id 2mr3542350wei.51.1297709158337; Mon, 14 Feb 2011 10:45:58 -0800 (PST) Received: by 10.216.86.200 with HTTP; Mon, 14 Feb 2011 10:45:58 -0800 (PST) In-Reply-To: <201102141337.59203.jhb@freebsd.org> References: <201102141330.20330.jkim@FreeBSD.org> <201102141337.59203.jhb@freebsd.org> Date: Mon, 14 Feb 2011 10:45:58 -0800 Message-ID: From: Matthew Fleming To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org, Jung-uk Kim Subject: Re: acpi_resource bug? 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: Mon, 14 Feb 2011 18:46:00 -0000 On Mon, Feb 14, 2011 at 10:37 AM, John Baldwin wrote: > On Monday, February 14, 2011 1:30:18 pm Jung-uk Kim wrote: >> On Monday 14 February 2011 10:29 am, Matthew Fleming wrote: >> > On Mon, Feb 14, 2011 at 6:24 AM, John Baldwin >> wrote: >> > > On Sunday, February 13, 2011 2:46:07 pm Matthew Fleming wrote: >> > >> I'm not very familiar with the acpi code, but we have seen an >> > >> intermittent issue on boot: >> > >> >> > >> 1) should the length of the bcopy() be changed to either respect >> > >> res->Length or the actual length of the ACPI_RESOURCE_DATA for >> > >> the type? >> > > >> > > It should just use res->Length: >> > >> > Is there a guarantee that res->Length is <=3D sizeof(ACPI_RESOURCE) ? >> >> No. =A0Please try the attached patch (after your r218685). > > I think your patch is correct, but are you saying that ACPICA will return= a > resource with a size that doesn't match its type? > > ACPI_RESOURCE_DATA is a union of all the various resource types, and it d= oes > contain both ACPI_RESOURCE_IRQ and ACPI_RESOURCE_EXTENDED_IRQ, so it's ha= rd > to see how res->Length would be greater than the size of ACPI_RESOURCE. Jung-uk Kim's patch makes acpi_resource match the other bcopy's in the acpica directory, and in the case of what I saw it would bcopy 8+5 bytes instead of res->Length =3D=3D 16. My concern was that res->Length seemed primarily to be an offset from the current resource to the next one, and I didn't see why that may not include a lot of padding (including more than the target of the bcopy was prepared for). However, my code will also copy bytes we don't care about any time res->Length is rounded up from the actual struct size. The patch looks fine to me. I don't have direct access to the machine that was intermittently crashing so I can't really try the new patch, but my change resolved the issue on it. Thanks, matthew