Author: hiren
Date: Wed May  8 16:43:52 2013
New Revision: 250373
URL: http://svnweb.freebsd.org/changeset/base/250373

Log:
  MFC: 233569
  
  Fix crash on VirtualBox (and probably on some real hardware):
  
  - Do not cover error returned by pmc_core_initialize with the
    result of pmc_uncore_initialize, fail right away.
  - Give a user something to report instead failing silently.
  
  Submitted by: gonzo
  Reported by:  Alexandr Kovalenko <ne...@nevermind.kiev.ua>
  Approved by:  sbruno (mentor)

Modified:
  stable/9/sys/dev/hwpmc/hwpmc_core.c
  stable/9/sys/dev/hwpmc/hwpmc_intel.c

Modified: stable/9/sys/dev/hwpmc/hwpmc_core.c
==============================================================================
--- stable/9/sys/dev/hwpmc/hwpmc_core.c Wed May  8 16:31:11 2013        
(r250372)
+++ stable/9/sys/dev/hwpmc/hwpmc_core.c Wed May  8 16:43:52 2013        
(r250373)
@@ -2613,8 +2613,12 @@ pmc_core_initialize(struct pmc_mdep *md,
        PMCDBG(MDP,INI,1,"core-init cputype=%d ncpu=%d ipa-version=%d",
            md->pmd_cputype, maxcpu, ipa_version);
 
-       if (ipa_version < 1 || ipa_version > 3) /* Unknown PMC architecture. */
+       if (ipa_version < 1 || ipa_version > 3) {
+               /* Unknown PMC architecture. */
+               printf("hwpc_core: unknown PMC architecture: %d\n",
+                       ipa_version);
                return (EPROGMISMATCH);
+       }
 
        core_cputype = md->pmd_cputype;
 

Modified: stable/9/sys/dev/hwpmc/hwpmc_intel.c
==============================================================================
--- stable/9/sys/dev/hwpmc/hwpmc_intel.c        Wed May  8 16:31:11 2013        
(r250372)
+++ stable/9/sys/dev/hwpmc/hwpmc_intel.c        Wed May  8 16:43:52 2013        
(r250373)
@@ -250,6 +250,9 @@ pmc_intel_initialize(void)
                KASSERT(0, ("[intel,%d] Unknown CPU type", __LINE__));
        }
 
+       if (error)
+               goto error;
+
        /*
         * Init the uncore class.
         */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to