From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D9BDC433F5 for ; Mon, 9 May 2022 05:29:11 +0000 (UTC) Received: from localhost ([::1]:39442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnvxG-0005ex-DZ for qemu-devel@archiver.kernel.org; Mon, 09 May 2022 01:29:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnvwC-0004xW-BQ for qemu-devel@nongnu.org; Mon, 09 May 2022 01:28:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:37317) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnvwA-0008Pu-6i for qemu-devel@nongnu.org; Mon, 09 May 2022 01:28:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652074080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7qxqZV6o+MIYgdaGb1zF3ZyGcQ7E54xzCz53tu5CN1U=; b=Pxg1BB+lZApnwx2qw3c23aA+2gY2IHkNGj1GU80UEj1K0HUiyeGK7gzNm38xhufiVZqSov MPublM2tF8BTAnTl9F4TvfoTbAK6h7nUIrVGHuCv6e8RTHiApqvsOjqlIBfZ5sx8sACJsF TyFrJ1JTPPYqg9DReh4J1ll0lLNmcFw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-647-A3xDSRcwPkK4UfepoiA_Cg-1; Mon, 09 May 2022 01:27:57 -0400 X-MC-Unique: A3xDSRcwPkK4UfepoiA_Cg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E27E5185A7A4; Mon, 9 May 2022 05:27:56 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.112.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B7D362026D64; Mon, 9 May 2022 05:27:56 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 7EC5C21E6880; Mon, 9 May 2022 07:27:55 +0200 (CEST) From: Markus Armbruster To: Jason Wang Cc: Paolo Bonzini , Andrew Melnychenko , qemu-devel Subject: Re: ebpf/rss.bpf.skeleton.h generated by what? References: <87a6bulueg.fsf@pond.sub.org> <8a8b144a-c9d6-41b0-71fd-c7850dce9c93@redhat.com> Date: Mon, 09 May 2022 07:27:55 +0200 In-Reply-To: (Jason Wang's message of "Sat, 7 May 2022 15:08:00 +0800") Message-ID: <87bkw7e0mc.fsf@pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Jason Wang writes: > On Sat, May 7, 2022 at 2:58 PM Paolo Bonzini wrote: >> >> On 5/7/22 08:53, Jason Wang wrote: >> > On Sat, May 7, 2022 at 2:46 PM Paolo Bonzini wrote: >> >> >> >> On 5/7/22 07:05, Jason Wang wrote: >> >>>> If it was generated by something in the tree, it should not be committed >> >>>> to git. Doesn't look like it is. >> >>> Andrew may know more. >> >>> >> >>> I remember it was generated by libbpf. >> >> >> >> What is the source? >> > >> > It's tools/ebpf/rss.bpf.c. Aha: $ cat tools/ebpf/Makefile.ebpf [...] $(OBJS): %.o:%.c $(CLANG) $(INC_FLAGS) \ -D__KERNEL__ -D__ASM_SYSREG_H \ -I../include $(LINUXINCLUDE) \ $(EXTRA_CFLAGS) -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@ bpftool gen skeleton rss.bpf.o > rss.bpf.skeleton.h ---> cp rss.bpf.skeleton.h ../../ebpf/ and $ cat docs/devel/ebpf_rss.rst [...] RSS eBPF program ---------------- RSS program located in ebpf/rss.bpf.skeleton.h generated by bpftool. So the program is part of the qemu binary. Initially, the eBPF program was compiled by clang and source code located at tools/ebpf/rss.bpf.c. Prerequisites to recompile the eBPF program (regenerate ebpf/rss.bpf.skeleton.h): llvm, clang, kernel source tree, bpftool Adjust Makefile.ebpf to reflect the location of the kernel source tree $ cd tools/ebpf $ make -f Makefile.ebpf [...] Together, this answers my "what" question. It doesn't answer my next question: why? That one gets answered ... >> Thanks, maybe we can reuse some of the support for cross compilation >> that will be introduced soon. > > That would be better. ... here: > The reason we don't auto generate during make is > to avoid adding new dependencies (where libbpf/bpftool is not popular > at that time). Always, always, *always* document your reasons for doing stuff right in the commit message, unless they are blindingly obvious. I understand reasons can be obvious enough to the author. Document them anyway if there is any chance they are not obvious to others.