Skip to content

Instantly share code, notes, and snippets.

View ehabkost's full-sized avatar

Eduardo Habkost ehabkost

View GitHub Profile
Searching 6027 files for "^( +)[^ \n][^\n][^\n][^\n][^\n][^\n][^\n][^(\n][^(\n][^(\n][^\n]*= *\n\1 [^ ]" (regex)
qemu/block.c:
3762 static void bdrv_aio_cancel_em(BlockDriverAIOCB *blockacb)
3763 {
3764: BlockDriverAIOCBSync *acb =
3765: container_of(blockacb, BlockDriverAIOCBSync, common);
3766 qemu_bh_delete(acb->bh);
3767 acb->bh = NULL;
....
@ehabkost
ehabkost / failing config file
Created February 14, 2013 18:43
Config file where "nokvm" variants are all skipped
variants:
- unknown_qemu:
- rhel64:
- qemu13:
only unknown_qemu
variants:
- cpu.unset:
- cpu.set:
variants:
- 486:
@ehabkost
ehabkost / gist:8716439
Created January 30, 2014 19:07
CPU model probing through QMP
https://github.com/ehabkost/qemu/tree/work/cpu-model-classes
You can run it as:
$ qemu-system-x86_64 -enable-kvm -machine none -monitor stdio -qmp unix:/tmp/qmp,server,nowait -nographic
Then:
$ ./scripts/qmp/qmp-shell /tmp/qmp
[...]
import re, sys
fieldre = re.compile(r'^ *\.([a-z0-9_]+) *= *(.*?),? *([^,]*?)\n', re.M)
def fixmachine(m):
print >>sys.stderr,"whole: %r" % (m.group(0))
name = m.group(2)
if name.endswith('_machine'):
name = name[:-len('_machine')]
fields = m.group(4)
print >>sys.stderr,"fields: %r" % (fields)
@ehabkost
ehabkost / msrs.c
Last active December 16, 2015 15:27
#include <stdio.h>
#define HV_X64_MSR_CRASH_CTL 0x40000105
#define MAX_MCG_BANKS 32 /* The limit in the Linux kernel */
#define MCE_BANKS_DEF 10 /* The default */
#define MCG_BANKS MAX_MCG_BANKS
/* Macros copied from other files: */
#define MAX_FIXED_COUNTERS 3
# This is an automatically-generated collection of command-lines that could crash QEMU
#
# It was generated by the script at:
# https://github.com/ehabkost/qemu-hacks/blob/work/device-crash-script/scripts/device-crash-test.py
#
# Using QEMU built from commit 940a8ce075e3408742a4edcabfd6c2a15e2539eb
#
# "exit code: -6" means abort()
# "exit code: -11" means Segmentation fault
ERROR: failed: machine=n810 binary=./aarch64-softmmu/qemu-system-aarch64 device=ast2400-a1 accel=tcg
[
{
"request": [
"version"
],
"result": {
"os-release": "NAME=Fedora\nVERSION=\"24 (Workstation Edition)\"\nID=fedora\nVERSION_ID=24\nPRETTY_NAME=\"Fedora 24 (Workstation Edition)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:24\"\nHOME_URL=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=24\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=24\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\nVARIANT=\"Workstation Edition\"\nVARIANT_ID=workstation\n",
"rpm-qf": "file /home/ehabkost/rh/proj/virt/qemu/v2.8.0-build/x86_64-softmmu/qemu-system-x86_64 is not owned by any package\n",
"help": "QEMU emulator version 2.8.0 (v2.9.0-rc1-83-g9caf9e64d6-dirty)\nCopyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers\n"
}
Raw commands that generated some of the files:
(qemu-qmp is at:
https://github.com/ehabkost/misc-build-scripts/blob/master/qemu-qmp
)
for d in *-softmmu/;do ../../scripts/qemu-qmp $b/qemu-system-* -machine none -display none -- qom-list-types > $d/qom-types.json;done
for d in *-softmmu/;do ../../scripts/qemu-qmp $d/qemu-system-* -machine none -display none -- qom-list-types > $d/qom-types.json;done
for d in *-softmmu;do (echo '{"execute":"qmp_capabilities"}';jq -c '.return[] | { execute: "query-device-type", arguments: { typename: .name } }' < $d/qom-types.json; echo '{"execute":"quit"}'; ) | $d/qemu-system-* -display none -qmp stdio;done
for d in *-softmmu;do (echo '{"execute":"qmp_capabilities"}';jq -c '.return[] | { execute: "query-device-type", arguments: { typename: .name } }' < $d/qom-types.json; echo '{"execute":"quit"}'; ) | $d/qemu-system-* -machine none -S -display none -qmp stdio;done
@ehabkost
ehabkost / 2to3 selected output.txt
Created May 11, 2018 18:20
2to3 output on QEMU source tree
So, most of the 2to3 fixes give false positives, but some fixers give some useful pointers:
'2to3 -f print' gives us this:
scripts/analyse-9p-simpletrace.py
scripts/analyse-locks-simpletrace.py [*]
scripts/analyze-migration.py
scripts/device-crash-test
scripts/dump-guest-memory.py [*]
scripts/kvm/kvm_flightrecorder
/* Copyright (C) 2019 Red Hat Inc.
*
* Authors:
* Eduardo Habkost <ehabkost@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/