Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754718AbbFAFeV (ORCPT ); Mon, 1 Jun 2015 01:34:21 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:33838 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751144AbbFAFeO (ORCPT ); Mon, 1 Jun 2015 01:34:14 -0400 Date: Mon, 1 Jun 2015 14:32:45 +0900 From: Namhyung Kim To: Wang Nan Cc: paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, jolsa@kernel.org, dsahern@gmail.com, daniel@iogearbox.net, brendan.d.gregg@gmail.com, masami.hiramatsu.pt@hitachi.com, lizefan@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [RFC PATCH v4 17/29] bpf tools: Relocate eBPF programs Message-ID: <20150601053245.GA22455@danjae> References: <1432704004-171454-1-git-send-email-wangnan0@huawei.com> <1432704004-171454-18-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1432704004-171454-18-git-send-email-wangnan0@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1066 Lines: 23 On Wed, May 27, 2015 at 05:19:52AM +0000, Wang Nan wrote: > If an eBPF program access a map, LLVM generates a relocated load > instruction. To enable the usage of that map, relocation must be done > by replacing original instructions by map loading instructions. > > Based on relocation description collected during 'opening' phase, this > patch replaces the instructions with map loading with correct map fd. I think this message is a bit confusing.. How about this? If an eBPF program accesses a map, LLVM generates a load instruction with pseudo map fd. Since actual map fd can only be known after it loads the map at runtime, it records such information in relocation section(s). So in order to access the map, relocation must be done by replacing original (pseudo) map fd with correct map fd. Thanks, Namhyung -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/